Skip to main content

Engines

An engine is an end-to-end speech-to-speech runtime. Pass an engine instance to phone.agent(engine=...) and Patter wires the audio stream straight through to the provider — no separate STT or TTS is needed. Patter ships with two engine classes today: Each class ships as both a flat alias (from getpatter import OpenAIRealtime) and a namespaced class (from getpatter.engines import openaiopenai.Realtime()). They are equivalent. If you need full control over STT, LLM, and TTS independently, use pipeline mode instead and omit engine=.

OpenAIRealtime

OpenAI’s Realtime API — the lowest-latency option.
import asyncio
from getpatter import Patter, Twilio, OpenAIRealtime

phone = Patter(carrier=Twilio(), phone_number="+15550001234")   # TWILIO_* from env

agent = phone.agent(
    engine=OpenAIRealtime(voice="nova"),                        # OPENAI_API_KEY from env
    system_prompt="You are a helpful assistant.",
    first_message="Hello!",
)

async def main():
    await phone.serve(agent)

asyncio.run(main())
ParameterTypeDefaultDescription
api_keystr""OpenAI API key. Reads from OPENAI_API_KEY when empty.
voicestr"alloy"One of "alloy", "echo", "fable", "onyx", "nova", "shimmer".
modelstr"gpt-4o-mini-realtime-preview"OpenAI Realtime model ID.
Namespaced form:
from getpatter.engines import openai as openai_engine

engine = openai_engine.Realtime()                     # reads OPENAI_API_KEY
engine = openai_engine.Realtime(voice="nova", model="gpt-4o-mini-realtime-preview")

ElevenLabsConvAI

ElevenLabs Conversational AI — premium voice quality using a managed agent configured in the ElevenLabs dashboard.
import asyncio
from getpatter import Patter, Twilio, ElevenLabsConvAI

phone = Patter(carrier=Twilio(), phone_number="+15550001234")   # TWILIO_* from env

agent = phone.agent(
    engine=ElevenLabsConvAI(agent_id="agent_abc123"),           # ELEVENLABS_API_KEY from env
    system_prompt="You are a warm and friendly concierge.",
)

async def main():
    await phone.serve(agent)

asyncio.run(main())
ParameterTypeDefaultDescription
api_keystr""ElevenLabs API key. Reads from ELEVENLABS_API_KEY when empty.
agent_idstr""ElevenLabs agent ID (from the ConvAI dashboard). Reads from ELEVENLABS_AGENT_ID when empty.
voicestr""Optional override for the agent’s default voice ID.
Namespaced form:
from getpatter.engines import elevenlabs as elevenlabs_engine

engine = elevenlabs_engine.ConvAI()                   # reads env
engine = elevenlabs_engine.ConvAI(agent_id="agent_abc123", voice="rachel")

What’s Next

LLM

Compare engine mode with pipeline mode.

STT

STT for pipeline mode.

TTS

TTS for pipeline mode.