<!-- Markdown representation of https://www.getpatter.com/products/python-sdk -->
> Give your Python AI agent a phone number with 4 lines of code. Inbound, outbound, real-time voice. Open source.

Canonical URL: https://www.getpatter.com/products/python-sdk
Site map: https://www.getpatter.com/sitemap.xml · Overview for LLMs: https://www.getpatter.com/llms.txt · Developer resources: https://www.getpatter.com/developers

---
Open Source MIT Licensed

# 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`

main.py 4 lines

```python
from getpatter import Patter, Twilio, OpenAIRealtime

phone = Patter(carrier=Twilio(), phone_number="+15550001234")
agent = phone.agent(engine=OpenAIRealtime(), system_prompt="You are a friendly receptionist.")
await phone.serve(agent, tunnel=True)
```

Quick Start

## 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

[Getting started guide →](https://docs.getpatter.com)

Features

## Everything you need to connect your agent to phone calls

### Instance-based voice stack

Pass typed instances: `engine=OpenAIRealtime()` or `engine=ElevenLabsConvAI()` for end-to-end, or mix `stt=`, `llm=`, `tts=` freely across 6 STTs, 5 LLMs, and 5 TTSs.

### 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.

### 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.

## Start building in minutes

Install the SDK, write a handler, connect a phone number.

[Read the docs →](https://docs.getpatter.com/python-sdk/overview)
