Designing Multi-Agent Systems
Principles, Patterns and Implementation for AI Agents
Multi-agent systems represent the next frontier in generative AI applications. But how do we design and coordinate these systems effectively? When should we use them? This hands-on book by author Victor Dibia draws on extensive experience building multi-agent tools (AutoGen, AutoGen Studio, Agent Framework) to help you understand how multi-agent systems work, when to use them, and how to architect, implement, and deploy them effectively.
What You Will Learn
Multi-Agent Fundamentals
Core concepts and design patterns for multi-agent collaboration
Build from Scratch
Guides you through building a multi-agent system library from scratch
Evaluation & Optimization
Testing, measuring performance, and building reliable systems at scale
Real-World Applications
Complete implementations for data analysis, software engineering, and information processing
Learn Multi-Agent Systems from First Principles
Rather than teaching yet another framework that may become obsolete, this book takes a first-principles approach. You'll incrementally build PicoAgents-a feature-complete library covering agents, tools, memory, workflows, and multi-agent orchestration.
15 chapters, in four parts
The full table of contents, and what each chapter covers.
Part I: Foundations of Multi-Agent Systems
3 chaptersPart I establishes the theoretical foundations needed to understand multi-agent systems in an accessible format - defining what agents and multi-agent systems are, presenting a taxonomy of orchestration patterns, and articulating user experience design principles that apply to both end users and developers.
Understanding Multi-Agent Systems
This chapter introduces agents as entities that can reason, act, communicate, and adapt - distinguishing them from models that only generate text. It defines multi-agent systems and guides readers through building their first multi-agent system: a poet-critic collaboration using round-robin orchestration, demonstrating how specialized agents work together through conversation until termination conditions are met.
Multi-Agent Patterns
This chapter provides a taxonomy of multi-agent orchestration patterns, organizing approaches along a spectrum from explicit to emergent control. It presents deterministic workflow patterns (sequential, conditional, parallel, supervisor) that offer fine-grained control with predictable behavior, contrasted with autonomous patterns (plan-based, handoff, conversation-driven) where control flow is delegated to AI reasoning.
UX Principles for Multi-Agent Systems
This chapter examines the user experience implications of multi-agent systems, framing the shift from traditional interface design to delegation design. It traces UI evolution from command-line to multimodal interfaces and articulates four essential UX design principles: capability discovery, cost-aware action delegation, observability and provenance, and interruptibility.
Part II: Building Multi-Agent Systems from Scratch
6 chaptersPart II transitions from theory to practice, teaching readers to build multi-agent systems from first principles by implementing a complete Python library called picoagents. The section covers agent fundamentals, workflow patterns, autonomous orchestration, and computer use agents—providing hands-on implementation experience with concepts introduced in Part I.
Building an Agent From Scratch
This chapter implements the core agent execution loop from scratch, establishing design principles including async-first architecture, event-based streaming, component serialization, and graceful cancellation. It begins building the picoagents library progressively—starting with simple Q&A agents and advancing to multi-tool workflows, implementing model clients that support multiple LLM providers.
Building Computer Use Agents
This chapter extends the agent framework to handle interface automation through computer use agents—systems that interact with user interfaces like web browsers and desktop applications. It implements action sequence generation, interface representation (DOM parsing, visual understanding, or hybrid approaches), and action execution using browser automation tools.
Building Multi-Agent Workflows
This chapter implements workflow patterns as deterministic computational graphs where nodes represent computation units and edges define control flow. It builds type-safe workflow steps using Pydantic for validation, conditional edges enabling branching and parallel execution, and an intelligent workflow runner with dependency resolution, concurrent execution, and streaming observability.
Building Autonomous Multi-Agent Orchestration
This chapter implements autonomous orchestration patterns where AI models drive coordination decisions at runtime. It establishes the orchestrator loop (select agent, execute turn, check termination, repeat) that underlies all coordination patterns, then builds composable termination conditions and a round-robin orchestrator with streaming observability—demonstrating the trade-off between workflow predictability and autonomous adaptability.
Building Modern Web Experiences for Agent Applications
This chapter teaches how to build web interfaces for multi-agent systems, starting with a minimal ~200-line implementation using FastAPI and vanilla JavaScript with Server-Sent Events (SSE) for real-time streaming. It covers the two essential components of agent web applications (backend API and frontend UI), demonstrates UX principles like observability and capability discovery, explains when to choose SSE over WebSockets, and introduces the PicoAgents WebUI as both a development tool and reference implementation for studying production patterns with React.
But What About Multi-Agent Frameworks?
This chapter presents ten core capabilities that distinguish effective multi-agent frameworks from basic implementations. Rather than comparing specific frameworks (which change constantly), it provides systematic evaluation criteria, practical questions to assess any framework, and decision guidelines for choosing between building from scratch versus adopting existing solutions.
Part III: Evaluation, Optimization, and Responsible AI
4 chaptersPart III addresses the critical challenges of making multi-agent systems work reliably and responsibly through systematic evaluation, optimization, security, and ethical frameworks.
Evaluating Multi-Agent Systems
This chapter introduces the concept of trajectories—complete sequences of reasoning and actions that unfold during task execution—as the fundamental unit of evaluation for models, agents, and multi-agent systems. It builds an evaluation framework integrated into the picoagents library, implementing metrics and judges that work across different system complexities, covering reference-based evaluation, reference-free evaluation using LLM judges, and practical evaluation planning strategies.
Optimizing Multi-Agent Systems
This chapter explores techniques for improving multi-agent system performance and reliability in production. It identifies ten common failure modes—including inadequate instructions, model capability gaps, instruction-model mismatching, poor tool quality, inappropriate pattern selection, missing termination conditions, lack of memory, absent metacognition, missing evaluation infrastructure, and poor human delegation policies—providing concrete optimization strategies for each.
Protocols for Distributed Agents
This chapter addresses distributed agent architectures where components run across separate execution contexts—different machines, regions, or organizations—communicating over networks. It explores Model Context Protocol (MCP) for standardized tool and context integration with agentic capabilities, and Agent-to-Agent Protocol (A2A) for cross-organizational collaboration.
Ethics and Responsible AI for Multi-Agent Systems
This chapter examines how agentic AI ethics fundamentally differs from traditional AI ethics across four dimensions: controllability, action capability, domain scope, and verification. It analyzes agentic noise as platform imbalance, explores distributed responsibility challenges, emergent risks from agent interactions, and security as ethical imperative when agents can act.
Part IV: Real-World Applications
2 chaptersPart IV demonstrates complete implementations of multi-agent systems applied to real-world business problems, showcasing workflow patterns, cost optimization, and production deployment strategies.
Answering Business Questions from Unstructured Data
This chapter tackles the challenge of answering business questions that require semantic understanding across large volumes of unstructured text. It implements a four-stage sequential workflow demonstrating key production patterns: two-stage filtering to reduce costs, enforced structured outputs using Pydantic schemas to eliminate hallucination, checkpointing for resumability, independent component testing, and continuous cost monitoring.
Software Engineering Agent
This chapter teaches the foundational pattern used by modern AI coding assistants like GitHub Copilot, Cursor, and Claude Code: agent capability emerges from tools + prompts + memory. It demonstrates building a software engineering agent that can autonomously write code, run tests, and iteratively improve solutions.