Swarm — routines + handoffs (OpenAI, 2024; Agents SDK 2025)
Triage Agent
instructions:
"route user to the right specialist"
functions: transfer_to_refunds, sales, support
tool returns refund_agent
tool returns sales_agent
tool returns support_agent
Refund Agent
process_refund(order_id)
"refund processed for order 77"
Sales Agent
quote_product(product)
"quote: $99/mo"
Support Agent
open_ticket(issue)
"ticket opened"
how the primitives work
agent = (instructions, tools)
handoff = tool that returns Agent
runtime detects Agent-valued return
switches active agent for next turn
no state machine, no DSL, just tool calls
stateless tradeoff
Swarm persists nothing between runs
memory is the caller's problem
Agents SDK (2025) adds: sessions, tracing
guardrails, handoff filters on top
handoff primitive survives; production ergonomics added