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.

It was also during this period that the development of increasingly complex single-agent systems began to emerge. The concept was simple: a lone agent eliminated the need for complex, multi-agent coordination and communication strategies. In practice, though, single agents have limitations on tool use, reasoning/planning detailed tasks, and the ability to switch focus.

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

4.1.1 Decision-making and control patterns

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