snake_case - with retries, typed errors and webhook verification built in. Sync and async clients. One dependency: httpx.
Authenticate
base_url (staging), timeout (seconds, default 30), max_retries (default 1). Use it as a context manager or call client.close().
Async
Every method is available onAsyncNixflex as an awaitable - same names, same arguments.
Agents
create and update take any field the API accepts as keyword arguments - see Create agent.
Calls
client.campaigns.create(agent_id=..., from_number=..., prompt=..., recipients=[{"phone": "+44...", "variables": {...}}]) dials immediately unless you pass schedule_type="schedule"; client.campaigns.launch(campaign_id) starts a scheduled one.
Phone numbers
import_ has a trailing underscore because import is a Python keyword. Telnyx numbers use telnyx_api_key and telnyx_connection_id.
Caller context
What the agent knows about a caller on one of your numbers. First number is yours, second is the caller’s. See Caller context.set() is kept; pass None to remove it. last_call and open_item are written by the engine and cannot be set.
SMS
Webhooks
Account and bring your own
set() is verified by the API with a real probe before saving; get() never returns secrets. Fields on Your own storage, Your own LLM, Your own TTS.
Errors
Every non-2xx response raises a typed exception. Catch by class:Retries
Built in and identical to the Node SDK: a 429 is retried once afterRetry-After (capped at 30 s); network failures retry once; 5xx retries only GET and DELETE. A POST is never retried after a 5xx - a call is never dialled twice. Set max_retries=0 to disable.
Related
- Node.js SDK · Other languages · CLI · MCP server
- PyPI · GitHub