Skip to main content

Customer Support Escalation with Handoffs

This example demonstrates how to configure an agent with handoff agents — pre-defined specialist agents that the main agent can delegate to when a task requires specific expertise.

What This Example Shows

  • Defining handoff agents inline within the agent_config
  • How the main agent decides when to hand off to a specialist
  • Nested agent specifications with independent configurations
  • Using handoffs through the /v1/agent/completions endpoint

How Handoffs Work

Unlike sub-agent delegation where agents are created dynamically at runtime, handoffs are pre-defined in your request. You specify the specialist agents upfront, and the main agent can route tasks to them as needed.

Step 1: Setup

Step 2: Define the Agent with Handoffs

The main agent gets a handoffs array containing fully configured specialist agents:

Step 3: Run It

Expected Behavior:
  1. Support-Triage-Agent receives the query and identifies it as a technical issue
  2. Hands off to Technical-Support-Agent
  3. Technical-Support-Agent provides debugging steps for the rate limit error

Step 4: Test Different Routes

Each handoff agent is a fully independent agent with its own model, system prompt, and configuration. The main agent decides which specialist to route to based on the task content.

Next Steps