ExamplescriptintermediateRunnableguided-flow
Handoffs
Runnable example (intermediate) for script.
Key Facts
- Level
- intermediate
- Runtime
- Python
- Pattern
- Inspectable flow with visible system boundaries
- Interaction
- Live sandbox • Script
- Updated
- 14 March 2026
Navigate this example
Library
Browse examplesReopen the wider library to compare adjacent patterns and linked learning paths.Interaction
Run sandbox nowTry the interaction directly in this example’s guided sandbox surface.Source
Open full sourceRead the real implementation, highlighted checkpoints, and runtime requirements.MCP
Call via MCPUse the same resource inside agents, deterministic exports, and MCP setup flows.
02-handoffs.py
python
from agents import Agent, Runner
import asyncio
import nest_asyncio
nest_asyncio.apply()
tech_support_agent = Agent(
name="Tech Support Agent",
instructions="You handle technical issues with our product. Be concise and helpful.",
)
billing_agent = Agent(
name="Billing Agent",
instructions="You handle billing and payment inquiries. Be concise and helpful.",
)
triage_agent = Agent(
name="Triage Agent",
instructions="Analyze the customer ticket and handoff to the appropriate specialist agent.",
handoffs=[tech_support_agent, billing_agent],
)
async def main():
result = await Runner.run(
triage_agent, input="My app keeps crashing when I try to open it."
)
print(result.final_output)
if __name__ == "__main__":
asyncio.run(main())