12 Multi-agent Systems

 

This chapter covers

  • Connecting tools to data sources
  • Composing multi-agent systems using router and supervisor patterns
  • Debugging, testing, and tracing multi-agent interactions

In chapter 11, we explored the foundations of building AI agents by creating a travel information agent capable of answering user queries about destinations, routes, and transportation options. While a single, specialized agent can be powerful, real-world applications often require the coordination of multiple agents, each handling a distinct area of expertise. In this chapter, we’ll embark on that journey—transforming our travel information agent into a robust, multi-agent travel assistant system.

Imagine planning a trip where you not only need up-to-date travel information but also want to seamlessly book your accommodation. Our enhanced multi-agent travel assistant will do just that: it will be able to answer travel questions and help you reserve hotels or bed and breakfasts in your chosen destination. To achieve this, we’ll begin by building a new agent—the accommodation booking agent.

12.1 Building an Accommodation Booking Agent

12.1.1 Hotel Booking Tool

12.1.2 B&B Booking Tool

12.1.3 ReAct Accommodation Booking Agent

12.2 Building a router-based Travel assistant

12.2.1 Designing the Router Agent

12.2.2 Routing Logic

12.2.3 Building the Multi-Agent Graph

12.2.4 Trying Out the Router Agent

12.3 Handling Multi-Agent Requests with a Supervisor

12.3.1 The Supervisor Pattern: An Agent of Agents

12.3.2 From “One-Way” to “Return Ticket” Interactions

12.3.3 Trying out the Supervisor agent

12.4 Summary