[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3

Handoffs & Multi-Agent Patterns

🤖 The Agents SDK 18 min 350 BASE XP⌨ HANDS-ON LAB

Agent-to-Agent Delegation

Handoffs are the primary mechanism for multi-agent collaboration. When Agent A encounters a task outside its expertise, it delegates to Agent B by executing a handoff - a typed tool call that transfers control and conversation history.

from agents import Agent, Runner

billing_agent = Agent(
    name="Billing Agent",
    instructions="Handle billing questions, refunds, and subscription changes.",
    model="o3-mini"
)

tech_agent = Agent(
    name="Tech Support",
    instructions="Handle technical issues, bugs, and feature requests.",
    model="o3-mini"
)

triage_agent = Agent(
    name="Triage Agent",
    instructions="Determine if the user needs billing help or technical support. Hand off accordingly.",
    handoffs=[billing_agent, tech_agent],
    model="gpt-4o-mini"  # Use cheaper, fast model for routing
)

result = await Runner.run(triage_agent, "I was charged twice last month")
# Triage → Billing Agent (automatic handoff)

Multi-Agent Patterns

PatternDescriptionUse Case
Manager/RouterCentral agent routes to specialistsCustomer support triage
PipelineAgents chain sequentiallyResearch → Write → Edit
Peer-to-PeerAgents hand off freely between each otherCollaborative problem solving
🎯 Cost Tip: Use cheaper models (gpt-4o-mini) for routing/triage agents, and frontier reasoning models (o3-mini or o1) for specialist agents that need deep logic.
⌨ HANDS-ON LABBootstrap Agents SDK Multi-Agent Handoff
⭐ +200 XP

In OpenAI's Agents SDK, agents hand off tasks to specialized peers. Install the SDK and inspect the agent definition.

1Install the official OpenAI Agents SDK via pip.
2Run python -c to test an Agent handoff definition.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 2 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
What happens during a handoff?
The first agent is destroyed
Control and conversation history transfer to the target agent
Both agents run in parallel
The user must restart the conversation