Use handoff orchestration
Unit 7 of 10 · Module 14: Orchestrate a multi-agent solution using the Microsoft Agent Framework
Before you start
Short explainers for ideas this lesson builds on. Watch these first if they're new to you.
Read this lesson
The hotel desk
At a grand hotel, you tell the front desk your problem, and they walk you over to the right person: the concierge, billing, or housekeeping. That person now owns your request, and might pass you on again. Handoff orchestration works that way. Agents pass control directly to each other, with no manager in the middle, and only one agent works at a time. It fits when you can't tell in advance which expert you'll need, because it only becomes clear as the conversation goes, as in customer support.
When it fits, and when it doesn't
Use it when requests need different specialists and you can't predict which ones or in what order, and when you can describe clearly when to pass the request on and to whom. Avoid it when the agents and their order are known upfront, when simple rules could route requests, when a wrong transfer would frustrate people, when several things must happen at once, or when requests might bounce around endlessly. Handoff also differs from using an agent as a tool. A tool returns control to the main agent, which stays in charge. In a handoff, the new agent takes over the task and gets the whole conversation.
In code
In code, create a triage agent and specialists, say refunds, order status, and returns, each with its own tools. Pass them all to HandoffBuilder, choose the start agent, and add a termination condition. Behind the scenes, the framework gives each agent handoff tools, and calling one passes control. By default any agent can hand off to any other, but you can restrict the routes with add_handoff, like triage to orders or returns, and returns to refunds. Handoff is interactive: when an agent needs something from the customer, the workflow pauses with a request for user input, and you send the reply to carry on. Add approval mode to risky tools like refunds, and checkpoints so a long conversation can pause and resume.
Facts from Microsoft's documentation: Workflow orchestrations in Agent Framework; Handoff orchestration (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.