Skip to main content

What Is an Agent?

An agent is one agent_id, one brain, and one or more voices. The brain answers turns; each voice is a voice profile the agent can speak with. The brain belongs to the agent, not to a voice - so editing the brain reaches every voice at once. client.agents replaces the old five-concern publish with three separate statements:
client.pipes is the deprecated predecessor of a single agent-voice row. It still writes the same rows, but every call now raises a DeprecationWarning. See Speech Pipe for the migration table.

The Brain: One Parameter, Four Sources

brain= takes exactly one of four typed sources. Passing two is unrepresentable, so there is no precedence rule and no validation error to memorise.
  • Playbook(id) is a live reference, not a snapshot: editing the playbook changes the agent on its next call.
  • Prompt(text) is the shortest path from nothing to a talking agent - no process of yours runs at all.
  • Runner() normally registers under the agent’s own id. Pass an id only when agent sales-bot is served by a runner registered as my-brain-v2.
  • Endpoint(...) accepts model, api_key, headers, query, extra_body, timeout_s and max_retries. The api_key is stored on the agent and redacted on every read path - the API never echoes it back.

Creating an Agent

agents.voice.create() parameters

Swap brain=Prompt(...) for brain=Runner() and the same call configures an agent your own AgentRunner drives. Nothing else about the agent changes.

Adding More Voices

A second voice inherits the agent’s brain unchanged - same logic, another language or persona.

Reading Agents

Agent fields

AgentVoice fields


Updating an Agent

A brain change reaches every voice of the agent. That is the point of the model - one brain, N voices - but it means an update is never scoped to a single language.

Deleting an Agent


Attaching a Phone Number

attach() also takes number_id= (the upstream id), plus inbound_trunk_id= / outbound_trunk_id=. Pass the real number_id when you have it: on the upsert branch the path id is stored as the cross-plane back-reference, so passing only a phone number records a phone number where a database id belongs.
detach() is a DELETE on /attach, not a POST to /detach - the platform models detaching as removing the attachment. There is no /detach route.
For the number lifecycle itself - provisioning, syncing, trunks - see Numbers.

Full Method Reference


Next Steps

AgentRunner & Sessions

Run the worker a Runner() brain points at, and act on live calls - say, transfer, end, record.

Voice Profiles

Browse the catalog and pick the profile_id you pass as voice_profile.

Numbers

Provision, sync, and route phone numbers.

Analytics

Attach a prompt plus a field spec and get structured data from every call.