AI Agents for Beginners - 8. Multi-Agent Design Pattern
Multi-agent design patterns — when to use them, building blocks of agent communication and coordination, Group Chat / Hand-off / Collaborative Filtering patterns, and a WorkflowBuilder pipeline walkthrough.
June 9, 2026
AI Agents for Beginners - 8. Multi-Agent Design Pattern
This post summarizes Lesson 08 of Microsoft's AI Agents for Beginners course.
Scenarios Where Multi-Agents Are Applicable
A Multi-Agent System is a design pattern where multiple agents work together to achieve a common goal.
Using multi-agents provides significant benefits particularly in the following three scenarios:
Using multi-agents provides significant benefits particularly in the following three scenarios:
| Scenario | Description | Example |
|---|---|---|
| Large Workloads | Dividing large tasks into smaller units for parallel processing | High-volume data pipelines |
| Complex Tasks | Separating complex tasks into specialized domains | Autonomous driving: navigation, obstacle detection, and communication agents |
| Diverse Expertise | Each agent possesses distinct expertise | Healthcare: diagnosis, treatment planning, and patient monitoring agents |
Advantages of Using Multi-Agents Over a Singular Agent
Single-agent systems work well for simple tasks, but multi-agent systems offer several advantages when dealing with complex tasks.
| Advantage | Description |
|---|---|
| Specialization | Each agent focuses on a specific task → No confusion even with complex requests |
| Scalability | Scale the system by adding new agents without needing to modify existing ones |
| Fault Tolerance | If one agent fails, the remaining agents continue operating |
For example, implementing a travel booking system as a single agent (mom-and-pop) results in a complex, hard-to-maintain system that tries to handle flights, hotels, and car rentals all at once. Configuring it as a multi-agent (franchise) system modularizes each domain with dedicated agents, making expansion and maintenance much easier.
Single Agent vs Multi-AgentMermaidflowchart LR subgraph Single["Single Agent (Mom & Pop)"] SA["SingleAgent\nHandles flights + hotels\n+ car rentals all-in-one"] end subgraph Multi["Multi-Agent (Franchise)"] FA["FlightAgent"] HA["HotelAgent"] CA["CarAgent"] end User1["User"] --> SA User2["User"] --> FA & HA & CA
Building Blocks of Implementing the Multi-Agent Design Pattern
Key building blocks for implementing a multi-agent system:
| Building Block | Description | Travel Booking Example |
|---|---|---|
| Agent Communication | Determines information sharing methods and protocols between agents | Flight agent passes travel dates to hotel agent |
| Coordination Mechanisms | Coordination between agents to align with user preferences and constraints | Coordinating hotel location with car rental pickup point |
| Agent Architecture | Internal decision-making structure and learning mechanisms of agents | Recommending flights using an ML model based on past preferences |
| Visibility | Tools for tracking agent activities and interactions | Monitoring each agent's status via a dashboard |
| Multi-Agent Patterns | Choosing centralized, decentralized, or hybrid architectures | Group Chat, Hand-off, Collaborative Filtering |
| Human-in-the-Loop | Defining when agents request human intervention | Requesting user confirmation before final booking |
Multi-Agent Building BlocksMermaidflowchart TD MAD["Multi-Agent\nDesign Pattern"] MAD --> Comm["Agent Communication\nInformation sharing method"] MAD --> Coord["Coordination\nConstraint alignment"] MAD --> Arch["Agent Architecture\nDecision-making & learning"] MAD --> Vis["Visibility\nActivity tracking"] MAD --> Pat["Patterns\nGroup/Hand-off/Filter"] MAD --> HITL["Human-in-the-Loop\nDefine intervention points"]
Multi-Agent Patterns
Group Chat
A pattern where multiple agents exchange messages in a group chat format.
Used in team collaboration, customer support, social networking, and more.
Used in team collaboration, customer support, social networking, and more.
- Can be implemented as a Centralized architecture via a central server, or a Decentralized architecture where agents exchange messages directly
- Each agent sends, receives, and responds to messages in the group chat
Group Chat PatternMermaidflowchart LR GroupChat["Group Chat\n(Central Hub)"] A1["Agent 1\nTravelPlanner"] <--> GroupChat A2["Agent 2\nConcierge"] <--> GroupChat A3["Agent 3\nBudgetReviewer"] <--> GroupChat User["User"] --> GroupChat GroupChat --> User
Hand-off
A pattern where an agent completes a task and hands it off to the next agent.
Well-suited for customer support, task management, and workflow automation.
Well-suited for customer support, task management, and workflow automation.
Hand-off PatternMermaidzenuml title Hand-off Pattern User->AgentA: initial request AgentA->AgentA: process own scope AgentA->AgentB: hand off with context AgentB->AgentB: process own scope AgentB->AgentC: hand off with context AgentC->User: final response
Collaborative Filtering
A pattern where multiple agents collaborate to generate recommendations based on their respective expertise.
Taking a stock recommendation scenario as an example:
Taking a stock recommendation scenario as an example:
| Agent | Area of Expertise |
|---|---|
| Industry Expert Agent | Specific industry domain knowledge |
| Technical Analysis Agent | Chart and pattern analysis |
| Fundamental Analysis Agent | Financial statements and valuation analysis |
By collaborating, these three agents provide a far more comprehensive recommendation than a single agent could.
Collaborative Filtering PatternMermaidflowchart TD User["User\n'Which stock should I buy?'"] --> Coordinator["Coordinator Agent\nDispatch requests & aggregate results"] Coordinator --> IE["Industry Expert Agent\nIndustry trends & sector analysis"] Coordinator --> TA["Technical Analysis Agent\nCharts, patterns & entry point analysis"] Coordinator --> FA["Fundamental Analysis Agent\nFinancial statements & company valuation"] IE --> Agg["Aggregator\nSynthesize multi-angle insights"] TA --> Agg FA --> Agg Agg --> Rec["Comprehensive Recommendation\nHolistic investment recommendation"] Rec --> User
Creating Specialized Agents
Setup
setup.pypython
WorkflowBuilder allows you to connect agents as a directed graph.
First, create specialized agents with focused roles:
First, create specialized agents with focused roles:
specialized_agents.pypython
Specialized AgentsMermaidflowchart LR P["TravelPlanner\nDraft itinerary\n(attractions, logistics)"] C["TravelConcierge\nReview & enhance plan\n(tips, restaurants, issues)"] P -->|"Pass context"| C
Sequential Workflow with WorkflowBuilder
Connect agents into a sequential pipeline using
WorkflowBuilder.add_edge(A, B) defines an edge where the output of A flows as input into B:sequential_workflow.pypython
Sequential Workflow: 2-Agent PipelineMermaidflowchart LR U["User\n'Plan 5-day Paris, $3000'"] --> W["WorkflowBuilder\nstart_executor=planner_agent"] W --> P["TravelPlanner\nDraft itinerary\n(attractions, logistics)"] P -->|"AgentResponseUpdate"| C["TravelConcierge\nReview & enhance plan\n(tips, restaurants, issues)"] C -->|"AgentResponseUpdate"| S["Stream to User"]
Extending the Workflow
One of the greatest advantages of multi-agent patterns is that you can add new agents without modifying existing ones.
Extend it into a 3-step pipeline by adding the BudgetReviewer agent:
Extend it into a 3-step pipeline by adding the BudgetReviewer agent:
extended_workflow.pypython
Extended 3-Agent PipelineMermaidflowchart LR U["User\n'5-day Paris, $3000'"] --> P["TravelPlanner\nDraft itinerary"] --> C["TravelConcierge\nReview & enhance"] --> B["BudgetReviewer\nBudget validation & savings suggestions"] --> R["Final\nItinerary"]
Visibility into Multi-Agent Interactions
As the number of agents grows, tracking interactions becomes essential.
Secure visibility into multi-agent systems using three tools:
Secure visibility into multi-agent systems using three tools:
| Tool | Content | Application |
|---|---|---|
| Logging & Monitoring | Record agents, actions, timestamps, and results in logs | Debugging, performance optimization |
| Visualization Tools | Visualize information flow between agents as a graph | Identifying bottlenecks and inefficiencies |
| Performance Metrics | Track task completion time, throughput, and recommendation accuracy | Pinpointing areas for system improvement |
Travel booking dashboard example: Check each agent's status, user preferences and constraints, and exchanged information between agents at a glance.
Scenario: Refund Process
How would a refund process look when designed with multi-agents?
Agents are categorized into process-specific and general-purpose:
Agents are categorized into process-specific and general-purpose:
Refund-specific agents
| Agent | Role |
|---|---|
| Customer Agent | Represents the customer and initiates the refund process |
| Seller Agent | Represents the seller and processes the refund |
| Payment Agent | Processes the payment refund |
| Resolution Agent | Resolves issues arising during the refund |
| Compliance Agent | Validates compliance with regulations and policies |
General-purpose agents (Reusable across other business processes)
| Agent | Role |
|---|---|
| Shipping Agent | Handles product returns (also usable for outbound purchase shipping) |
| Notification Agent | Sends customer notifications at each step |
| Escalation Agent | Escalates issues to higher-tier support |
| Feedback Agent | Collects customer feedback |
| Audit Agent | Audits the process |
| Analytics Agent | Analyzes data |
Refund Process Multi-Agent SystemMermaid%%{init: {'look': 'handDrawn', 'themeVariables': {'clusterBkg': '#e8efff28', 'clusterBorder': '#aabbcc'}, 'flowchart': {'subGraphTitleMargin': {'top': 14, 'bottom': 8}}}}%% flowchart TD subgraph Core["Core Refund Flow (Sequential)"] Customer["Customer Agent\nRefund request"] Resolution["Resolution Agent\nIssue analysis & coordination"] Seller["Seller Agent\nRefund approval"] Payment["Payment Agent\nPayment refund"] end subgraph Checks["Parallel Validation — Resolution Stage"] direction LR Compliance["Compliance Agent\nCompliance verification"] Security["Security Agent\nSecurity verification"] Knowledge["Knowledge Agent\nPolicy & rules reference"] end subgraph Fulfillment["Parallel Fulfillment — Seller Stage"] Shipping["Shipping Agent\nReturn shipment processing"] end subgraph PostProcess["Post-Processing (Parallel)"] direction LR Feedback["Feedback Agent\nCollect customer feedback"] Analytics["Analytics Agent\nData analysis"] Audit["Audit Agent\nProcess audit"] Reporting["Reporting Agent\nGenerate reports"] Quality["Quality Agent\nQuality verification"] end Escalation["Escalation Agent\nEscalate to higher support"] Notification["Notification Agent\nStep-by-step customer notifications"] Customer --> Resolution Resolution -->|"Complex issue"| Escalation Resolution --> Compliance & Security & Knowledge Compliance & Security & Knowledge --> Seller Seller --> Payment & Shipping Customer & Seller & Payment --> Notification Payment --> Feedback & Analytics & Audit & Reporting & Quality
General-purpose agents (Shipping, Notification, Escalation, etc.) can be reused across other processes, enhancing the overall modularity and scalability of the system.
Summary
Lesson 08 SummaryMermaidflowchart LR Root["Multi-Agent\nDesign Pattern"] Root --> Why["Why Multi-Agent?"] Root --> Blocks["Building Blocks"] Root --> Patterns["Patterns"] Root --> Code["WorkflowBuilder"] Root --> Vis["Visibility"] Why --> W1["Specialization"] Why --> W2["Scalability"] Why --> W3["Fault Tolerance"] Blocks --> B1["Communication"] Blocks --> B2["Coordination"] Blocks --> B3["Architecture"] Patterns --> P1["Group Chat"] Patterns --> P2["Hand-off"] Patterns --> P3["Collaborative\nFiltering"] Code --> C1["create_agent x N"] Code --> C2["WorkflowBuilder\n+ add_edge"] Code --> C3["stream output"] Vis --> V1["Logging"] Vis --> V2["Visualization"] Vis --> V3["Metrics"]
- Multi-Agent Systems overcome the limitations of single agents through Specialization, Scalability, and Fault Tolerance.
- Connect agents into sequential pipelines using
WorkflowBuilder'sadd_edge, and scale by adding new agents without modifying existing code. - Choose agent communication and coordination methods using three core patterns: Group Chat, Hand-off, and Collaborative Filtering.
- As the number of agents grows, securing interaction visibility through Logging, Visualization, and Performance Metrics becomes crucial.