chapter twelve

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 (B&Bs) 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 component

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

Summary