Skip to main content
Haggle Hero Light

Welcome to Haggle

Haggle is an AI-powered service marketplace that revolutionizes how you find and hire local service providers. Instead of manually calling multiple plumbers, electricians, or cleaners, Haggle does it all for you:
  1. Understands your needs using Grok LLM
  2. Finds local providers via intelligent web search
  3. Calls providers automatically using AI voice agents
  4. Negotiates the best price on your behalf

Quick Start

Get Haggle running locally in under 5 minutes

How It Works

Understand the complete workflow from query to negotiation

API Reference

Explore the FastAPI endpoints and data models

Architecture

Deep dive into the tech stack and system design

Key Features

Haggle uses Grok LLM to understand natural language requests like “fix my leaky faucet” and automatically infers the service type needed (e.g., plumber, electrician).
# From services/grok_llm.py:20
async def infer_task(query: str) -> str:
    """Use Grok LLM to infer the service task from a user query."""
    client = Client(api_key=XAI_API_KEY)
    chat = client.chat.create(model="grok-3-fast")
    
    chat.append(system(system_prompt))
    chat.append(user(f"What type of service professional is needed for: {query}"))
    
    for response, chunk in chat.stream():
        if chunk.content:
            full_response += chunk.content
    
    return full_response.strip().lower()
After identifying the task, Haggle generates 3-5 contextual questions to better understand your specific needs. These questions are tailored to the service type.
# From main.py:109
async def generate_clarifying_questions(
    task: str,
    query: str,
    zip_code: str,
    date_needed: str,
    price_limit: Union[float, str]
) -> List[Dict[str, str]]:
    # Returns questions like:
    # - "What is the specific issue you're experiencing?"
    # - "Is water actively leaking right now?"
    # - "How old is the fixture or pipe with the issue?"
Haggle uses OpenAI’s web search to find local service providers in your area, extracting business names and phone numbers automatically.
# From services/grok_search.py:69
response = client.responses.create(
    model="gpt-4o",
    tools=[{"type": "web_search_preview"}],
    input=f"Find {job.task} services near zip code {job.zip_code}",
)
The most powerful feature: Haggle calls providers using AI voice agents (powered by Grok Realtime API) and negotiates prices on your behalf.
# From backend/app.py:41
def generate_prompt(provider: dict) -> str:
    return f"""
    YOU ARE a homeowner calling for service.
    Your task is to secure the lowest possible price, 
    using ${provider.get('max_price', 200)} as a target range.
    
    Use common, human-like negotiation tactics to encourage 
    the technician to drop their initial quote.
    """

Tech Stack

Haggle is built with cutting-edge AI and modern web technologies:

FastAPI

High-performance Python backend with async support

Next.js

Modern React framework for the frontend

Supabase

PostgreSQL database with realtime capabilities

Grok LLM

xAI’s language model for task inference and question generation

OpenAI

Web search and advanced AI capabilities

Twilio

Voice infrastructure for automated calls

Project Structure

haggle/
├── main.py                  # Main FastAPI application
├── backend/
   └── app.py              # Voice agent backend (Twilio + Grok Realtime)
├── services/
   ├── grok_llm.py         # Task inference, questions, price extraction
   └── grok_search.py      # Provider discovery via OpenAI web search
├── db/
   └── models.py           # Supabase provider models
├── frontend/
   ├── app/
   └── page.tsx        # Main Next.js app
   ├── components/
   ├── landing-page.tsx
   ├── questions-flow.tsx
   └── call-console.tsx
   └── lib/
       └── api.ts          # Frontend API client
└── schemas.py              # Pydantic data models

Use Cases

Home Repairs

Plumbing, electrical, HVAC, and general handyman services

Home Services

Cleaning, painting, landscaping, and pest control

Professional Services

Auto mechanics, locksmiths, and moving companies

Emergency Services

Urgent repairs with priority provider matching

Example Workflow

Here’s how a typical Haggle session works:
// 1. User submits request
const response = await startJob(
  "fix my toilet",           // Natural language query
  "123 Main St, San Jose",  // Address
  "95126",                   // ZIP code
  "$250",                    // Budget
  "2025-12-10"              // Date needed
)

// 2. AI infers task and generates questions
console.log(response.task)       // "plumber"
console.log(response.questions)  // 5 clarifying questions

// 3. User answers questions
const result = await completeJob(response.job_id, {
  q1: "The toilet is constantly running",
  q2: "Yes, water runs non-stop",
  // ...
})

// 4. System finds and saves providers
console.log(result.providers)    // 5 local plumbers

// 5. AI voice agents call and negotiate
await startCalls(job_id)

// 6. Get negotiated prices
const status = await getProviderStatus(job_id)
console.log(status[0].negotiated_price)  // $125 (saved $125!)
Phase 1 Complete: The current version includes task inference, provider discovery, and database persistence. Voice negotiation is fully implemented via the backend service.

Why Haggle?

Save Time

No more calling 10+ providers yourself. Haggle handles all the calls in parallel.

Save Money

AI negotiation agents work to get you the best price, often below initial quotes.

Save Energy

Let AI handle the tedious work of explaining your problem repeatedly.

Transparent Process

See real-time call status, transcripts, and negotiated prices.

What’s Next?

1

Get Started

Follow the Quick Start guide to run Haggle locally
2

Understand the Flow

Read How It Works to understand the complete workflow
3

Explore the API

Check out the API Reference to integrate Haggle
4

Customize

Learn how to add new service types and customize AI prompts
API Keys Required: Haggle requires API keys for xAI (Grok), OpenAI, Twilio, and Supabase. See the Quick Start for setup instructions.

Build docs developers (and LLMs) love