9 Orchestrating multi-agent systems
This chapter covers
- Using three collaboration patterns: Workflow, Agent as Tool, and Transfer
- Implementing composable workflows with Sequential, Parallel, and Loop
- Wrapping agents as tools with context isolation
- Transferring control between agents using a dynamically created transfer tool
- Connecting agents across networks with the A2A protocol
Throughout this book, we’ve explored how a single agent can perform diverse tasks. By assigning roles through system prompts and providing tools, we enabled capabilities such as web search, calculation, and code execution. A single agent could solve many problems in the General AI Assistants (GAIA) benchmark. But real-world problems are more complex. As an agent’s responsibilities grow, system prompts become longer, and the number of required tools increases. It’s like expecting one person to be a developer, product manager, designer, and operations specialist. No matter how capable that person is, performance suffers when roles multiply. We’ll address this challenge by implementing a multi-agent system in which multiple agents collaborate. We’ll assign each agent a specialized role and dedicated tools and then orchestrate the agents to work together.