Skip to main content
A handoff lets an agent pass a call to another agent. A front desk agent can hand billing questions to a billing agent, which can hand the caller back when it’s done. Each agent is built, tested and updated on its own, so different teams can own different parts of a conversation. When the model hands off, the call continues with the target agent’s system prompt, voice, tools and other settings, starting from the conversation history you choose. You don’t need to run a server to change stages, as you would with call stages.

When to Use Handoffs

Splitting Work Between Agents → Give each part of a conversation its own agent with a focused prompt and only the tools it needs, such as triage, billing and scheduling. Compacting Long Conversations → An agent can hand off to itself, replacing a long conversation with a summary.

Defining a Handoff

Handoffs are part of an agent’s callTemplate. This front desk agent hands billing questions to a billing agent. The model fills in {{issue}} when it hands off, and {{customerName}} comes from the call’s templateContext.
The model sees each handoff as a tool. Handoffs aren’t tools in the API, though, so a call’s toolOverrides don’t affect them.

Conversation History

conversationHistory sets what the target agent starts with. It takes one of these:
  • {"retain": true} → Keep the whole conversation.
  • segments → Build the history from segments, in order. Each one is either a slice of the existing messages or a template of new messages. A slice works like a Python slice: {"start": -4} keeps the last four messages. Templated messages may use {{variables}}, and each one must set a role.
A short summary is often better than the whole conversation, because the target agent then only has to follow what matters for its part. The existing messages end with the model’s handoff tool call and its result, which uses toolResultText if it’s set.

Template Variables

The target agent’s templates, such as its system prompt, are filled the same way as the templated history messages:
  • Variables the call’s templateContext has take their values from it.
  • The model generates the rest when it hands off. They appear to the model as the handoff tool’s parameters, using the types in the target agent’s contextSchema.
The target agent’s tool authTokens are different: the model never generates them, so they always come from the call’s templateContext. The default contextSchema of an agent requires the variables that the auth tokens of every agent it can reach through handoffs use. If you set contextSchema yourself, it must include them.

What Changes on a Handoff

A handoff starts a new call stage. These settings come from the target agent:
  • systemPrompt and temperature
  • voice, voiceOverrides or externalVoice
  • languageHint and transcriptionSettings
  • timeExceededMessage and inactivityMessages
  • selectedTools and handoffs
  • sharedSecrets
Settings the target agent doesn’t set are left unset rather than kept from the previous agent. Everything else belongs to the call and comes from the agent the call started with. That includes model, medium, firstSpeakerSettings, maxDuration, recordingEnabled, vadSettings and triggers.
Things to Remember
  • The call keeps its model. The target agent’s model is ignored.
  • A handoff ends the call’s threads, like any stage change.
  • Use List Call Stages to see each agent’s part of a call.

Compacting a Conversation

A handoff to the agent itself continues the call with the same settings and a new conversation history. This one replaces the conversation with a summary the model writes, followed by the last four messages:
An agent’s ID isn’t known until the agent exists, so create the agent first and then add the handoff to itself.

Updating and Deleting Agents

A call continues with the agent revisions that were published when it started, however many times it hands off. Updating or deleting an agent doesn’t affect calls in progress. Publishing an agent also publishes a new revision of every agent that can reach it through handoffs, so new calls use the update right away. If one of those agents can’t be updated, for example because its contextSchema lacks a variable that a tool auth token of the updated agent uses, the request fails with a 409 that lists those agents, and nothing is published. Deleting an agent that other agents hand off to fails with a 409 that lists those agents. Remove their handoffs first.