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 began adding more agents. The concept was simple: more agents meant they could tackle and solve more difficult goals. The 2023 wave (AutoGPT, BabyAGI) was the first to go viral, and both surfaced the same failure mode within weeks. Unconstrained loops where one agent kept spawning subgoals were impressive in demos and brittle in practice. The next wave responded with structure. MetaGPT introduced role-based teams that mirrored a software company (CEO, product manager, engineer, QA). CrewAI and AutoGen formalized collaborative team patterns where agents had defined responsibilities and communication channels. By 2024, the experimentation had moved from “more agents will solve it” to “the right shape of agents will solve it,” and several key architectures emerged.

It was also during this period that increasingly complex single-agent systems began to surface. 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 in tool use, reasoning and planning for detailed tasks, and the ability to switch focus.

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 agent 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.5 Exercises

Summary