OpenAI handoffs transfer conversation ownership to a specialist, while agents-as-tools let a manager retain ownership and call specialists for bounded work. Use handoffs when the specialist should control the next response; use manager orchestration when one agent must synthesize. Add specialists only when contracts, tools, context, or policy materially differ.
You will implement a billing/technical router, choose the ownership pattern, and measure whether specialization improves outcomes.
handoff_demo.py:
After a handoff, last_agent identifies the specialist that completed the run. If that specialist should remain in control next turn, preserve it with the chosen continuation strategy.
Use specialist.as_tool(...) when a manager needs a classification, translation, or summary but must integrate it into one final outcome. The manager sees specialist output as a tool result and retains responsibility.
Do not use a handoff merely to get a helper result. Do not use a manager when the specialist needs its own user dialogue and approval boundary.
Build a labeled set containing clear billing, clear technical, ambiguous, mixed, and out-of-scope requests. Measure correct route, unnecessary handoff, failed handoff, time/cost, and policy exposure. Inspect confusion pairs rather than optimizing aggregate accuracy alone.
Failure injection: Give overlapping handoff descriptions. If routing oscillates or misroutes, narrow the contracts and add deterministic pre-routing for exact cases before adding prompt complexity.
Limit handoff depth, record ownership changes, control what history crosses boundaries, attach different tool/policy sets per specialist, and ensure approval state survives nested calls. A specialist is a security boundary only if the harness enforces its tool and context isolation.
Add a mixed-intent policy: either split into two bounded specialist calls under a manager or ask the user to prioritize. Compare the two approaches using traces and evaluation results.