Open-source starter kit for building real-time voice agents with FastAPI, WebSocket streaming, and pluggable ASR/LLM/TTS providers.
This repository provides a working end-to-end voice interaction loop:
- Browser captures microphone audio.
- Backend transcribes speech (ASR).
- LLM generates streaming response text.
- TTS synthesizes response audio chunks.
- Client plays streamed assistant audio with latency telemetry.
It is designed as a practical foundation you can adapt for product prototypes and production pilots.
- FastAPI backend with health and token endpoints
- Real-time WebSocket audio pipeline
- Streaming assistant text and audio chunk responses
- Client-side voice activity detection (VAD)
- Conversation memory support in the pipeline
- Optional tool-call support in LLM adapter
- In-memory latency metrics and summary endpoint
- Web demo UI in static/index.html
main.py # Root launcher that imports app.main
app/
main.py # FastAPI app and websocket route
config.py # Environment-driven settings
telemetry.py # Latency metric store
pipeline/
service.py # ASR -> LLM -> TTS orchestration
adapters.py # Provider integrations
conversation.py # Conversation state manager
tools.py # Tool registry for model calls
transport/
daily.py # Daily.co token + transport helpers
static/
index.html # Main browser demo
index_ws.html # Alternate/demo websocket page
requirements.txt
Dockerfile
docker-compose.yml
git clone https://github.com/lythelab/voice-agent-starter-kit
cd voice-agent-starter-kit
python -m venv .venvWindows PowerShell:
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txtmacOS/Linux:
source .venv/bin/activate
pip install -r requirements.txtCreate a local .env file from .env.example and fill in your keys:
cp .env.example .envWindows PowerShell:
Copy-Item .env.example .env- DAILY_API_KEY
- DAILY_DOMAIN
- DAILY_ROOM_NAME
- DEEPGRAM_API_KEY
- GROQ_API_KEY
- GROQ_MODEL
- CARTESIA_API_KEY
- CARTESIA_VOICE_ID
uvicorn app.main:app --reloadOpen http://127.0.0.1:8000 in your browser.
- Ensure
.envexists at the repository root (see Configure environment above). - Build the image:
docker build -t voice-agent-starter-kit:latest .- Run the container:
docker run --rm -p 8000:8000 --env-file .env voice-agent-starter-kit:latestOpen http://127.0.0.1:8000.
docker compose up --build -dTo stop:
docker compose downThe service listens on container port 8000 and is mapped to host port 8000.
- GET /health
- GET /api/latency/summary
- POST /api/transport/token
- WS /ws/audio-pipeline
The websocket emits event types such as:
- ready
- processing
- transcript
- assistant_text_delta
- assistant_audio_chunk
- pipeline_result
- info
- error
See .env.example for the full list. Key ones include:
- APP_HOST, APP_PORT
- SYSTEM_PROMPT
- CARTESIA_* output settings
- TTS_FILLER_PROBABILITY
- ENABLE_PREFILL_AUDIO_FILLER
- Never commit .env or any file containing API keys.
- Rotate provider keys immediately if they were ever committed.
- Use HTTPS in non-local environments for microphone permissions.
- Keep latency-sensitive calls asynchronous.
- Preserve streaming behavior in websocket events to avoid UI regressions.
- If you add a new provider, implement it behind adapters.py interfaces.
This project is licensed under the MIT License — see the LICENSE file for details.
