Python SDK
Give your Python AI agent a phone number with 4 lines of code. Async-first, type-hinted, production-ready. No Patter backend needed.
pip install getpatter
1from patter import Patter
2
3# Connect to your telephony provider
4phone = Patter(mode="local", openai_key="...", twilio_sid="...", twilio_token="...")
5# Connect your agent to phone calls
6agent = phone.agent(system_prompt="Your prompt", voice="nova")
7# Make an outbound call
8phone.call(agent, to="+1...", from_="+1...")
4 lines to a phone call
- Connect your telephony provider and start handling phone calls
- Patter handles STT, TTS, telephony, and audio streaming
- Embedded local server (FastAPI) — no Patter backend needed
- Works with any LLM — OpenAI, Anthropic, or your own
- Full type hints and async/await support
Everything you need to connect your agent to phone calls
Three Voice Modes
OpenAI Realtime for ultra-low latency, ElevenLabs ConvAI for natural voices, or Pipeline mode with custom STT + TTS.
Telephony Providers
Twilio (mulaw 8kHz) and Telnyx (Beta, PCM 16kHz) out of the box. Bring your own credentials, no Patter account required.
Call Recording
Enable recording per call with recording=True. Recordings stored via your telephony provider.
Call Transfer
Built-in transfer_call tool. Your agent decides when to transfer — Patter handles the redirect.
Machine Detection
AMD on outbound calls with machine_detection=True. Auto-drop voicemail messages when an answering machine is detected.
Event Hooks
on_call_start, on_call_end, on_transcript — lifecycle callbacks for logging, analytics, and custom logic.
Embedded Dashboard
Built-in local dashboard with call metrics, history, and CSV/JSON export. No external tools needed.
DTMF Input
Keypad presses forwarded as [DTMF: N] in the transcript. Build IVR flows with your agent.
Dynamic Variables
{name} placeholders in system prompts replaced from a variables dict at call time.
Works with your stack
Plug in any combination of telephony, speech-to-text, and text-to-speech providers.
Telephony
Twilio (mulaw 8kHz, auto-transcoding) and Telnyx (Beta, native 16kHz PCM). Inbound and outbound.
Speech-to-Text
Deepgram Nova (streaming) and OpenAI Whisper. Configurable language and model via phone.deepgram() / phone.whisper().
Text-to-Speech
ElevenLabs (streaming, multiple voices) and OpenAI TTS (24kHz, auto-resampled). Configured via phone.elevenlabs() / phone.openai_tts().
AI Models
OpenAI Realtime API, ElevenLabs Conversational AI, or bring any LLM via the Pipeline mode handler. Model-agnostic by design.