Live voice agent

Inbound voice lead qualification.

A self-hosted AI phone agent that answers inbound calls, qualifies home-service leads, escalates emergencies, and logs the full outcome without relying on a paid voice-orchestration platform.

What to test

These scenarios are designed to show the actual state machine and failure handling instead of a scripted sales demo.

Routine lead

Say you need an HVAC inspection or garage door repair. The agent should collect service, urgency, address, ZIP, and callback number.

Emergency intercept

Mention a gas leak, burst pipe, smoke, sparks, no heat, or flooding. The agent should bypass the normal flow and escalate.

Out-of-area path

Give a ZIP code outside the configured service area. The agent should politely decline and optionally offer a referral.

System flow

The graph is invoked once per final caller utterance. Each turn updates state, chooses the next node, speaks back, and waits.

01

Twilio stream

Inbound PSTN call opens a bidirectional media stream to FastAPI.

02

Deepgram STT

Mulaw 8 kHz audio becomes final caller utterances.

03

LangGraph

State machine classifies service, urgency, location, and contact.

04

Persistence

Supabase stores calls, leads, duplicates, and call summaries.

05

Response

ElevenLabs or Twilio speaks the next prompt into the live call.

Engineering signals

The system is built with clear boundaries, health checks, tests, and explicit tradeoffs.

Fallbacks

  • Groq to Mistral LLM fallback chain
  • Voicemail degradation when all LLMs fail
  • Twilio Say fallback when ElevenLabs has no balance

Operational safety

  • Twilio signature validation
  • Structured JSON logs
  • Single-worker deployment notes for live call state

Demo clarity

  • Clear testing paths for routine, emergency, and out-of-area calls
  • Decision log explaining architecture and cost choices
  • Tests for graph routing, webhooks, and LLM fallback behavior

LeadPilot AI suite

This voice agent is the first service in a wider home-service automation suite.

Missed Call Text-Back Agent

Texts callers after missed calls, manages replies, handles opt-outs, and extracts qualified lead details.

Outbound Follow-Up Agent

Runs estimate, no-show, re-engagement, and seasonal campaigns with consent-aware SMS or voice outreach.

AI Review Request Agent

Routes completed jobs through sentiment checks before sending review requests or private feedback prompts.

Web Chat Lead Qualifier

Embeddable RAG chat widget that qualifies website visitors and alerts the owner when a lead is ready.

Architecture

The production flow keeps telephony, speech, reasoning, persistence, and integrations separated so failures can be observed and handled without breaking the call.

Caller

PSTN or mobile caller reaches the configured Twilio number.

Twilio Voice

Webhook returns TwiML and starts a bidirectional media stream.

FastAPI Session

Owns call state, routes audio, handles status callbacks, and records outcomes.

Deepgram STT

Final caller utterances drive one graph transition at a time.

LangGraph FSM

Greeting, qualification, emergency escalation, service-area handling, and lead creation.

LiteLLM

Groq primary with Mistral fallback for controlled response generation.

Supabase + FSM APIs

Calls, leads, duplicate checks, and optional Jobber or Housecall Pro handoff.

Speech Response

ElevenLabs Flash TTS with Twilio Say fallback when voice synthesis is unavailable.

/voice /media-stream/{call_sid} /call-status /health structured logs Twilio signature validation
Routes: GET / | POST /voice | WS /media-stream/{call_sid} | POST /call-status | GET /health

Safe database preview

Sanitized Supabase activity. Phone numbers are masked; names, addresses, transcripts, and notes are not exposed.

Loading sanitized activity snapshot...