Unpod Python SDK
Developer SDK for Unpod voice infrastructure — management, connectivity, and adapters for building voice agents that talk over real phone calls, browsers, and WebRTC.
Single architectural commitment: the wire between Unpod infrastructure and your code carries text, not audio. You bring the Agent Runner; Unpod brings the voice.
Installation
pip install unpod
# With superdialog integration (recommended)
pip install "unpod[dialog]"
# With LangChain adapter
pip install "unpod[langchain]"
# With MCP adapter
pip install "unpod[mcp]"
Or with uv: uv add unpod (extras: uv add "unpod[dialog]").
To install the latest unreleased code from source:
pip install "unpod @ git+https://github.com/unpod-ai/unpod-python-sdk"
What's New
In 0.7.0 (since 0.6.2; full notes in the changelog):
- Pipecat bots on Unpod calls (preview) — stream a call's audio to your own Pipecat pipeline over a WebSocket.
UnpodFrameSerializer plugs into Pipecat's WebSocket transport; install with pip install "unpod[pipecat]". See Pipecat audio streaming. The org needs audio streaming switched on at the SBC.
answer_url replies — unpod.telephony.answer.Response builds stream, speak, play, wait, dial and hangup actions as SBC JSON or XML; stream() takes keep_call_alive and audio_track.
- Signed stream connections —
verify_stream_request(headers, secret, url=...) checks the SBC's X-Unpod-Signature on the WebSocket upgrade (timestamp, optional replay cache).
- Streaming, matched to the SBC — A-law streams, REST
calls.start_stream() / stop_stream(), all <Stream> options, checkpoint / sendDTMF, and stream status callbacks parsed from what the SBC really sends (started/stopped/failed/degraded).
- More call control —
time_limit, sip_headers, fallback_url, status_callback_events and end_mpc_on_exit on calls.create() / add_participant(); stop_recording, pause_recording, resume_recording and download_recording; play_audio(loop=, length=, mix=); richer CallEvent fields; parse_digits_request(); webhook_secret.reveal().
- Changed:
<Stream> carries the sample rate in contentType only; verify_stream_request needs url= and checks X-Unpod-Signature only.
What's Inside
unpod
├── Management SDK (REST) numbers, voice profiles, speech pipes, calls,
│ sessions, trunks, recordings, transcripts, api keys
├── Connectivity SDK (WSS) AgentRunner, Session, CallContext, hooks
└── Adapters superdialog, LangChain, OpenAI, Anthropic, HTTP, MCP
- Management SDK — CRUD against the Unpod Control Plane: manage numbers (sync/attach/release), browse voice profiles, bind Speech Pipes, trigger and inspect calls.
- Connectivity SDK — runtime for live calls: a long-lived
AgentRunner receives plain-text turns over WSS and dispatches them to your agent, regardless of transport (phone, browser, WebRTC).
- Adapters — plug any dialog logic into a call:
superdialog dialog machines, LangChain runnables, your own HTTP endpoint, or an MCP server.
Quick Example
Configure once — the Quickstart explains why the REST base is the bare host (pipes/calls/numbers spell the full /api/v2/platform/speech/... prefix inside their own request paths, so the derived https://<host>/platform base would double it):
export UNPOD_BASE_URL="https://unpod.ai" # one knob for the rest
export UNPOD_SERVICE_BASE_URL="https://unpod.ai" # bare host: pipes/calls/numbers
export UNPOD_PLATFORM_TOKEN="..." # org-scoped REST auth + AgentRunner registration
export UNPOD_ORG_HANDLE="your-org"
export UNPOD_API_KEY="sk_..." # optional: legacy Bearer key for Client only
from unpod import AsyncClient, AgentRunner, CallContext
client = AsyncClient() # picks up the env above; token auth wins over UNPOD_API_KEY
# Create an embedded voice agent directly from a prompt (no runner/publish step)
embedded = await client.agent.voice.create(
name="support-line",
voice_profile="VP_openai_alloy",
prompt="You are a concise, helpful support assistant.",
)
# Management: pick a voice, bind a Speech Pipe to your agent
profiles = await client.voice_profiles.list(language="en")
pipe = await client.pipes.create(
name="support-line",
voice_profile=profiles[0].id, # a catalog name works too
agent_id="my-voice-agent",
)
# Connectivity: handle every live call with your own logic
async def entrypoint(ctx: CallContext) -> None:
await ctx.session.say("Hi! How can I help you today?")
await ctx.session.run()
AgentRunner(entrypoint=entrypoint, agent_id="my-voice-agent").start()
voice_profiles and client.telephony.* read the org-scoped platform plane, so they need UNPOD_PLATFORM_TOKEN + UNPOD_ORG_HANDLE — a Bearer UNPOD_API_KEY alone cannot reach them.
Telephony
client.telephony works with phone calls on Unpod numbers: attach a number to an agent, control live calls yourself (dial, bridge two people, play, speak, transfer, DTMF, record — preview), and verify signed call events on your webhook.
pip install "unpod>=0.6.2"
# .env — loaded automatically on `import unpod`
UNPOD_BASE_URL=https://unpod.ai
UNPOD_PLATFORM_TOKEN=<api key from Settings → Security → API keys>
UNPOD_ORG_HANDLE=<org handle from Settings → Workspace → General>
from unpod import Client
with Client() as client:
free = [
n.number for n in client.telephony.numbers.list() if n.status == "not_assigned"
]
result = client.telephony.numbers.attach(free[0], agent_id="sales-agent")
print(result.numbers[0].ok, result.numbers[0].error)
Everything else — call control, inbound config, webhooks, errors, troubleshooting — is in the Telephony guide.
Documentation
| Guide |
What it covers |
| Overview |
What Unpod owns vs what you own, the three layers |
| Quickstart |
Install to a dispatched call, transcribed from a live run |
| Run your agent |
Where the runner process lives (local vs Publish), the identity trio, reconnection and failover, the four call_end reasons |
| Management SDK |
REST client API reference |
| Connectivity SDK |
AgentRunner, Session, hooks, controls |
| Adapters |
The DialogAdapter protocol led by the stream() hot path, the six bundled adapters, and how to write your own |
| Deployment |
The three shipped ways an agent reaches traffic — LLM endpoint, voice agent, phone number |
| Browser quickstart |
Testing an agent in the browser with no phone number, via examples/browser_playground/ |
| Telephony |
client.telephony: install, credentials, numbers, call control, inbound config, signed call events, errors, troubleshooting |
The old Architecture guide was archived on 2026-07-30 — package structure and data flow are now in Overview, concurrency and multi-replica in Run your agent and Connectivity SDK. It is kept, with a banner listing what did not survive a code check, at docs/archive/05-architecture.md.
Full index, including the archive: docs/README.md.
Full platform documentation: docs.unpod.ai
Development
git clone https://github.com/unpod-ai/unpod-python-sdk
cd unpod-python-sdk
uv sync --extra dev
uv run pytest
License
Apache-2.0