chapter four

4 Architecting and building multi-agent systems

 

This chapter covers

  • Architecting multi-agent systems
  • Balancing agents with agentic flows
  • Understanding handoffs in agent flows
  • Validating agent flows with guardrails

Shortly after single AI agent systems emerged, developers and researchers quickly began adding more agents. The concept was simple: more agents meant more difficult goals could be tackled and solved. They experimented with numerous patterns, from agent armies and armadas to collaborative agent teams and various other architectures. Over time and through practical, real-world use, several key architectures emerged.

In this chapter, we explore the main practical patterns for building multi-agent systems. We will look at why and when we may need to move from single-agent systems to more complex workflows. Then we delve into how agents communicate and transition from one another, and how we can monitor and protect agent-to-agent communication.

4.1 Architecting multi-agent systems

Multi-agent architectures are more powerful than single-agent systems. If not employed effectively, though, multiple agents are often more costly, have increased latency, and are more unpredictable. With due diligence and following best practices, multi-agent architectures become easier to develop and maintain.

4.1.1 Decision-making for agent systems

4.1.2 Communicating with shared-memory, message-passing, and MCP

4.1.3 Channeling multi-agent coordination strategies

4.2 Balancing agents with agentic flows

4.2.1 Transforming agents to agent flows

4.2.2 Building an Agent-to-Agent flow

4.2.3 Agency and decision making in agent flows

4.3 Understanding handoffs in aAgent flows

4.3.1 Agent-to-agent flow with handoffs

4.3.2 Visualizing agent flows

4.3.3 Monitoring the handoff

4.4 Validating agent flows with guardrails

4.4.1 Implementing input and output guardrails

4.4.2 Using agents as guardrails

4.4.3 Adding guardrails to pass off agent flows

4.5 Exercises

4.6 Summary