No number yet? The Agent SDK Quickstart starts from a free
number and covers the same steps.
One number, one mode
A number is answered one way at a time. You pick the mode when you attach it.
If you followed the Telephony Quick Start, your number is in
the first mode. Moving it to an agent changes three things:
- Inbound calls go to the agent.
- The number’s inbound config (its answer URL and callbacks) is cleared. You can set it again.
- Agent calls use the number as their caller ID.
Before you start
- A number attached for the Telephony APIs. The Quick Start leaves you with one.
UNPOD_BASE_URL,UNPOD_PLATFORM_TOKENandUNPOD_ORG_HANDLEexported, as in the Introduction.- Python 3.12+ and
pip install unpod. - Room in your plan for the number. The attach checks your plan’s number limit after the
detach has already gone through, so an org at or over its limit loses the number to the
402below.
Create the agent
An agent is a brain plus a voice, under anagent_id you choose. Prompt is a brain that
Unpod runs, so there is no process of yours to deploy.
voice_profile takes a name from client.voice_profiles.list(). The Agent SDK
Quickstart explains voice profiles and the Playbook brain.
Move the number to the agent
A number in your-app mode can’t be reassigned in place, so detach it, then attach it to the agent.status=assigned, and the script stops before attaching if the detach
did not go through. Check the agent_id spelling before you run it: the attach does not
verify that the agent exists, and a number attached to a missing agent goes unanswered.
To confirm the routing, read the number’s row from client.telephony.overview(): see
Check the Lifecycle.
Call the number
Call the number from any phone. The agent answers with the voice and prompt you gave it. You host nothing: no answer URL, no WebSocket server, no Runner. If nothing answers, check the number’sconnection_state: see
Number states.
Place a call with the agent
- You pass no
from_number. Caller ID is the number attached to the agent. An agent with several numbers takes turns between them, least recently used first. datais per-call context the brain can read.- The call is queued:
statusstarts aspending. See Outbound Calls for status, callbacks and transcripts.
Let your app decide per call
A number on an agent can still have an answer URL. When it does, Unpod asks your answer URL on each inbound call, and the verbs you reply with run instead of the agent. Reply with an empty body or<Response/> and the agent answers.
Detach cleared the number’s inbound config, so set the answer URL again: see
Point your number at your app.
If your server times out or returns an error, the call goes to the agent by default: see
When your server is down.
Which attach call
Attach a Number to an Agent has the result
fields and every error for the
telephony.numbers calls.
Two calls.create
The Telephony APIs are documented for numbers in your-app mode. For calls your app
controls, keep a number in that mode, or move this one back.
Move the number back
Release the number from the agent, then attach it for your app:402 above. Once the attach returns, the number
works as from in client.telephony.calls.create.
Next
Run Your Own Brain
Swap
Prompt for Runner() and answer turns from your own process.Brain options
Prompt, Playbook, Runner and Endpoint, and what each one deploys.
Outbound Calls
Campaigns, callbacks and reading results.
Attach a Number to an Agent
The full attach, detach and reassign reference.