Patter: Production Setup
April 14, 2026 · View on GitHub
Patter: Production Setup
Full production configuration with custom LLM, guardrails, tools, dynamic variables, recording, dashboard, and all lifecycle callbacks.
Part of the Patter Voice AI SDK.
Prerequisites
- Twilio account with a phone number
- Anthropic API key (or any LLM provider)
- Deepgram API key for speech-to-text
- ElevenLabs API key for text-to-speech
Quick Start
Python
cd python
cp ../.env.example .env # fill in your keys
pip install -r requirements.txt
python main.py
# Dashboard: http://localhost:8000/dashboard
TypeScript
cd typescript
cp ../.env.example .env # fill in your keys
npm install
npx tsx main.ts
# Dashboard: http://localhost:8000/dashboard
Environment Variables
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | Yes | Anthropic API key for Claude (or swap with your LLM) |
DEEPGRAM_API_KEY | Yes | Deepgram API key for speech-to-text |
ELEVENLABS_API_KEY | Yes | ElevenLabs API key for text-to-speech |
TWILIO_ACCOUNT_SID | Yes | Twilio account SID |
TWILIO_AUTH_TOKEN | Yes | Twilio auth token |
TWILIO_PHONE_NUMBER | Yes | Your Twilio phone number (E.164) |
WEBHOOK_URL | No | Public URL for webhooks (auto-tunneled if omitted) |
DASHBOARD_TOKEN | Yes | Secret token for dashboard authentication |
What This Demonstrates
- Pipeline mode — separate STT (Deepgram), LLM (Claude), and TTS (ElevenLabs) providers
- Custom LLM —
on_messagecallback to call Anthropic Claude (swap with any LLM) - Guardrails — block competitor mentions, PII, medical/legal topics from agent responses
- Tools — function calling with webhook-backed or local tool handlers
- Dynamic variables —
{customer_name},{account_id}placeholders in system prompts - Recording —
recording=Trueenables Twilio call recording - Dashboard —
dashboard=Truewith token auth for real-time call monitoring - Lifecycle callbacks —
on_call_start,on_call_end,on_metricsfor logging and CRM integration - Cost tracking — custom pricing overrides for accurate per-call cost breakdown
Architecture
Phone Call
|
v
Twilio --> Patter Server (port 8000)
|
+-- on_call_start() --> CRM lookup, variable overrides
|
+-- Deepgram STT --> transcription
|
+-- on_message() --> Claude API --> response text
|
+-- Guardrails --> filter response
|
+-- ElevenLabs TTS --> audio
|
+-- on_metrics() --> monitoring
|
+-- on_call_end() --> save transcript, log cost
|
+-- Dashboard (SSE) --> real-time UI
Next Steps
- Inbound Agent — start with the basics
- Tool Calling — deep dive into tools
- Dynamic Variables — per-call personalization
- Dashboard — dashboard-only setup
- Full documentation
- All templates
License
MIT