Patter: Production Setup

April 14, 2026 · View on GitHub

Patter

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

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

VariableRequiredDescription
ANTHROPIC_API_KEYYesAnthropic API key for Claude (or swap with your LLM)
DEEPGRAM_API_KEYYesDeepgram API key for speech-to-text
ELEVENLABS_API_KEYYesElevenLabs API key for text-to-speech
TWILIO_ACCOUNT_SIDYesTwilio account SID
TWILIO_AUTH_TOKENYesTwilio auth token
TWILIO_PHONE_NUMBERYesYour Twilio phone number (E.164)
WEBHOOK_URLNoPublic URL for webhooks (auto-tunneled if omitted)
DASHBOARD_TOKENYesSecret token for dashboard authentication

What This Demonstrates

  • Pipeline mode — separate STT (Deepgram), LLM (Claude), and TTS (ElevenLabs) providers
  • Custom LLMon_message callback 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
  • Recordingrecording=True enables Twilio call recording
  • Dashboarddashboard=True with token auth for real-time call monitoring
  • Lifecycle callbackson_call_start, on_call_end, on_metrics for 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

License

MIT