Skip to main content

Prerequisites

Before installing Haggle, ensure you have the following:

Python 3.x

Required for the backend API service

Node.js & npm

Required for the Next.js frontend (v16.0.7+)

Supabase Account

For PostgreSQL database hosting

API Keys

xAI API key for Grok LLM

Installation

1

Clone the repository

Clone the Haggle repository to your local machine:
git clone <repository-url>
cd haggle
2

Install Backend Dependencies

Install Python dependencies using pip:
pip install -r requirements.txt
This installs the following key dependencies:
  • FastAPI (v0.115.0+) - Web framework
  • Uvicorn (v0.30.0+) - ASGI server
  • Supabase (v2.0.0+) - Database client
  • xAI SDK (v0.1.0+) - Grok LLM integration
  • httpx (v0.27.0+) - Async HTTP client
  • Rich (v13.0.0+) - CLI interface
3

Install Frontend Dependencies

Navigate to the frontend directory and install Node.js dependencies:
cd frontend
npm install
The frontend uses:
  • Next.js (v16.0.7) - React framework
  • React (v19.2.0) - UI library
  • Tailwind CSS (v4.1.9) - Styling
  • Radix UI - Component primitives
4

Set Up Supabase Database

Create the required database table in Supabase:
  1. Go to your Supabase Dashboard
  2. Select your project
  3. Navigate to SQL Editor
  4. Copy the contents of supabase_migration.sql from the repository
  5. Paste and click Run
CREATE TABLE IF NOT EXISTS providers (
    id BIGSERIAL PRIMARY KEY,
    service_provider TEXT NOT NULL,
    phone_number TEXT,
    context_answers TEXT,
    house_address TEXT,
    zip_code TEXT,
    max_price NUMERIC(10, 2),
    job_id TEXT NOT NULL,
    minimum_quote NUMERIC(10, 2),
    problem TEXT,
    negotiated_price NUMERIC(10, 2),
    call_status TEXT,
    call_transcript TEXT,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Create indexes for better query performance
CREATE INDEX IF NOT EXISTS idx_providers_job_id ON providers(job_id);
CREATE INDEX IF NOT EXISTS idx_providers_zip_code ON providers(zip_code);
CREATE INDEX IF NOT EXISTS idx_providers_service_provider ON providers(service_provider);
CREATE INDEX IF NOT EXISTS idx_providers_house_address ON providers(house_address);

-- Enable Row Level Security
ALTER TABLE providers ENABLE ROW LEVEL SECURITY;

-- Development policy (adjust for production)
CREATE POLICY "Allow all operations for anon users" ON providers
    FOR ALL
    USING (true)
    WITH CHECK (true);
The migration includes a permissive RLS policy for development. Update security policies for production use.
5

Verify Installation

Verify your installation by checking the database connection:
# From the project root
python cli.py --demo
This runs a demo workflow that tests:
  • Database connectivity
  • Grok LLM integration (or fallback mode)
  • Provider search functionality
You should see output showing task inference, question generation, and provider search results.

Next Steps

Configuration

Set up environment variables and API keys

Running Locally

Start the development servers

Troubleshooting

If you encounter errors about missing database columns:
  1. Verify the providers table exists in Supabase
  2. Run the migration script from Step 4
  3. Check that all column names match exactly (case-sensitive)
  4. If you have an old table, use supabase_migration_update.sql instead
If you get permission or RLS errors:
  1. Check Row Level Security policies in your Supabase dashboard
  2. Ensure the development policy allows operations
  3. Verify your SUPABASE_KEY is the anon/service_role key, not the project API key
Haggle requires Python 3.x. Check your version:
python --version
# or
python3 --version
If you have multiple Python versions, ensure you’re using the correct one throughout.

Build docs developers (and LLMs) love