Lesson 14 / 26

Triage and Specialist Agents

One agent routes, others resolve.

Route first, then specialise

A common pattern is a triage agent (or classifier node) that decides which specialist should handle a request: billing, technical, account. Each specialist has narrow instructions and only its own tools. In code, the Agents SDK expresses routing as handoffs: the triage agent sees each specialist as a tool named like transfer_to_billing_agent and, when it calls it, the conversation continues with that agent. On a canvas, the same design is a classifier followed by an if/else node and separate agent nodes.

Triage, specialists, composition

Split work across focused agents and connect them with clear routing.

Three ideas: triage, composition styles, narrow agents.
Figure 5.1 — Triage, composition and narrow agents.

Handoffs generated by the Agents SDK, run

I ran this with Python 3, the openai-agents package 0.22.3 and pydantic 2.13.5, without any API key: it only builds definitions and schemas, no model is called. The triage agent gets two handoff tools, transfer_to_billing_agent and transfer_to_technical_agent, whose descriptions include each specialist's handoff_description. That description is what the model uses to choose.

from agents import Agent, handoff

billing = Agent(name="Billing agent", instructions="Resolve billing questions.",
                handoff_description="Questions about charges, invoices and refunds")
tech = Agent(name="Technical agent", instructions="Resolve technical problems.",
             handoff_description="App errors, login problems and bugs")
triage = Agent(name="Triage agent", instructions="Route the user to the right specialist.",
               handoffs=[billing, handoff(tech)])
for h in triage.handoffs:
    h = h if hasattr(h, "tool_name") else handoff(h)
    print(f"{h.tool_name:<28} -> {h.agent_name}: {h.tool_description}")

Output:

transfer_to_billing_agent    -> Billing agent: Handoff to the Billing agent agent to handle the request. Questions about charges, invoices and refunds
transfer_to_technical_agent  -> Technical agent: Handoff to the Technical agent agent to handle the request. App errors, login problems and bugs

Write handoff descriptions from the user's view

Describe which requests belong to each specialist in user language: charges, invoices, refunds, not internal team names.

Quick check: What does a handoff do in the Agents SDK?

  • Calls a human by phone
  • Deletes the conversation
  • Trains a new model
  • Transfers the conversation to another agent, exposed to the model as a tool
Answer

Transfers the conversation to another agent, exposed to the model as a tool — Handoffs are routing tools.