# Patter

> Open-source Python and TypeScript SDK that gives an AI agent a phone number

- Category: Multimodal Generation / Audio, Music & Voice
- Language: Python
- Licence: MIT
- Repository: https://github.com/PatterAI/Patter
- Website: https://getpatter.com
- Canonical page: https://ai-tldr.dev/tools/patter/

## In short

Patter is an open-source SDK that gives your AI agent a phone number. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed MIT. To get started: install the SDK.

## Overview

Patter is an open-source SDK that gives your AI agent a phone number. You write the agent logic; Patter handles everything between it and the phone network — the agent loop, the language model, speech-to-text, text-to-speech, real-time voice, audio processing and the telephony carrier. The project positions itself as an open-source alternative to hosted voice-agent platforms such as Vapi and Retell, for builders who want to own the stack.

Every layer of a call is pluggable. A carrier (Twilio, Telnyx or Plivo) puts the call on the internet, the SDK transcodes the audio and handles barge-in, and an engine produces the reply. In engine mode a single realtime provider such as OpenAI Realtime, Gemini Live, Ultravox or ElevenLabs ConvAI does speech-to-speech; in pipeline mode you pick separate STT, LLM and TTS vendors; a third, hybrid mode is also available. The README counts more than 27 provider integrations across the stack, and any of them can be swapped with one line.

The SDK ships in Python and TypeScript with the same surface, hooks and events in both. On top of the voice stack it adds an automatic LLM fallback chain for mid-call provider failover, built-in tools, call transfer and guardrails that behave the same on every carrier, an OpenTelemetry trace of each call, and an embedded web dashboard for live calls, latency and per-component cost. It runs in your own process under the MIT licence, with your own provider keys.

## What it does

- One API in Python and TypeScript at full parity — a working phone agent takes about four lines
- Choose the provider for every layer: LLMs (OpenAI, Anthropic, Gemini, Groq, Cerebras), STT (Deepgram, AssemblyAI, Whisper and more), TTS (ElevenLabs, Cartesia, Rime and more)
- Realtime, pipeline and hybrid voice modes, with realtime engines such as OpenAI Realtime, Gemini Live, Ultravox and ElevenLabs ConvAI
- Telephony over Twilio, Telnyx or Plivo, with a built-in Cloudflare quick tunnel for local development
- Tool calling, call transfer, guardrails and an automatic LLM fallback chain, plus Silero VAD, Krisp and DeepFilterNet audio processing
- Embedded dashboard for live calls, latency waterfalls and cost breakdowns, and a vendor-neutral OpenTelemetry trace per call

## Getting started

Patter installs from PyPI or npm as `getpatter`. Provider and carrier credentials are read from environment variables such as TWILIO_ACCOUNT_SID and OPENAI_API_KEY; the docs list the full catalogue.

1. Install the SDK

   Pick the language you build in — both packages expose the same API.

```bash
pip install getpatter
# or
npm install getpatter
```

2. Give an agent a phone number (Python)

   Create a Patter instance with a carrier and number, define an agent with a realtime engine and a system prompt, and serve it. `tunnel=True` spawns a Cloudflare quick tunnel and points your number at it; in production use a static webhook URL instead.

```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 for Acme Corp.",
    first_message="Hello! How can I help?",
)
await phone.serve(agent, tunnel=True)
```

3. Or the same agent in TypeScript

   Swap Twilio for Telnyx or Plivo to change carrier.

```typescript
import { Patter, Twilio, OpenAIRealtime } from "getpatter";

const phone = new Patter({ carrier: new Twilio(), phoneNumber: "+15550001234" });
const agent = phone.agent({
  engine: new OpenAIRealtime(),
  systemPrompt: "You are a friendly receptionist for Acme Corp.",
  firstMessage: "Hello! How can I help?",
});
await phone.serve({ agent, tunnel: true });
```

4. Switch to pipeline mode for full control

   Instead of one engine, pick each stage: speech-to-text, the LLM and text-to-speech. Each reads its API key from the environment.

```python
from getpatter import DeepgramSTT, AnthropicLLM, ElevenLabsTTS

agent = phone.agent(
    stt=DeepgramSTT(),
    llm=AnthropicLLM(),
    tts=ElevenLabsTTS(),
    system_prompt="...",
)
await phone.serve(agent)
```

5. Start from a template

   Self-contained template repos cover inbound and outbound calls, tool calling, custom voices, a dashboard and a production setup. Clone one, add your keys and run.

```bash
git clone https://github.com/PatterAI/patter-inbound-agent
cd patter-inbound-agent
cp .env.example .env    # fill in your keys
cd python && pip install -r requirements.txt && python main.py
```

## When to use it

- Answer inbound calls with an AI receptionist or booking assistant on a Twilio, Telnyx or Plivo number
- Place outbound calls with answering-machine detection and voicemail drop
- Let a phone agent look up CRM records or create tickets mid-call through tool calling
- Replace a hosted per-minute voice platform with a self-hosted SDK where you choose every LLM, STT and TTS vendor
