Multi-Agent Collaboration Patterns
๐ Date: 2026-04-18 | โฑ๏ธ Reading Time: ~15 minutes
1. Why Multi-Agent?โ
Single LLM agents quickly reveal their limitations as domains expand and tool usage becomes complex. Key limitations observed in production environments include:
- Context Window Saturation: Even Claude Opus 4.7's 1M tokens are quickly exhausted in large monorepos and long sessions, with key context pushed out by summarization loss.
- Tool Sprawl: Connecting 20+ MCP tools to a single agent causes tool-choice accuracy to drop sharply (see Anthropic 2024 "Building effective agents").
- Expertise Range Limits: Code review, SQL writing, and security analysis require different system prompts and few-shot configurations. Hard to satisfy all with one prompt.
- Cost-Accuracy Tradeoff: Using Opus-class models for all subtasks explodes costs; using only Haiku-class increases failure rate in complex reasoning.
Multi-agent systems solve these limitations through role decomposition, scoped context, and parallel execution. However, the following dysfunctions must also be explicitly managed.
| Dysfunction | Cause | Mitigation |
|---|---|---|
| Communication cost | Inter-agent message serialization, mutual re-summarization | Structured shared state, pass only essential fields on handoff |
| Consensus delay | Round repetition in Voting/Debate | Round cap, timebox, early termination condition |
| Token cost explosion | N agents ร avg tokens ร rounds | Conditional escalation, model tiering (Haiku โ Sonnet โ Opus) |
| Failure propagation | One agent failure halts entire chain | Circuit breaker, fallback agent, allow partial results |
| Observability complexity | Nested traces, difficult root cause analysis | Langfuse/OTel hierarchy, mandatory agent_name span tag |
Introduce multi-agent only when subtasks benefit from (a) clearly separated roles or (b) independent parallel execution. For linear pipelines, single agent + tool-use is almost always cheaper.
2. Core Collaboration Patternsโ
This section organizes 6 patterns repeatedly observed in production. Most systems are hybrids combining 2-3 of these.
2.1 Orchestrator-Worker (Router Pattern)โ
The orchestrator agent receives user requests, decomposes them into sub-tasks, and assigns them to specialized worker agents. It collects worker results and synthesizes the final response.
- Representative Implementations: LangGraph Supervisor, Strands Agents Graph, OpenAI Agents SDK Handoff.
- Best For: Clearly classifiable domains (SQL / code / search), fixed worker pools.
- Caution: Orchestrator easily becomes bottleneck. Fan-out parallelizable sub-tasks with
asyncio.gatheretc.
2.2 Hierarchical Supervisor (Manager-Team)โ
Multi-layer expansion of Orchestrator-Worker. Top-level Supervisor delegates to multiple Team Leads, and each Team Lead manages Specialists.
- Representative Implementations: LangGraph Multi-Agent Supervisor, CrewAI
Crew(process=Process.hierarchical, manager_agent=...). - Best For: Large-scale tasks requiring 3+ decision layers (e.g., full service refactoring, enterprise doc generation).
- Caution: Deeper supervisor hierarchies increase latency and cost. Recommend not exceeding 2-3 levels.
2.3 Voting / Ensembleโ
Send the same question independently to N agents (or models) and conclude by majority vote or weighted average.
- Techniques: Self-consistency, Mixture-of-Agents (MoA), majority voting, weighted ensemble.
- Best For: Math problems, classification tasks, RAG answer verification with high hallucination risk.
- Cost: Exactly N times. Many cases report Haiku ร 5 ensemble achieving higher accuracy than Opus ร 1.
- Implementation Tip: Secure diversity by setting different temperatures per agent or using different prompt templates.
2.4 Debate / Adversarialโ
Two agents critique and rebut each other's answers through rounds, then a third judge agent selects the conclusion.
- Best For: Complex reasoning, code defect exploration, policy/ethical judgment.
- Effect: Society of Minds and Multi-Agent Debate papers report accuracy improvements vs single agent.
- Limitation: Token cost accumulates per round. Typically capped at 2-3 rounds + Judge structure.
2.5 Plan-and-Executeโ
Planner agent establishes overall execution plan first, then Executor agent(s) execute step-by-step. When needed, Re-Planner receives intermediate results and revises the plan.
- Representative Implementations: LangChain Plan-and-Execute, OpenAI Deep Research (Planner + Browser + Writer), Claude Code's TodoWrite + executor pattern.
- Best For: Long-running tasks (research reports, large-scale refactoring, multi-step data pipelines).
- Key Point: Secure cost efficiency by separating planning to high-performance models (Opus, GPT-5 Reasoning) and execution to mid/low-tier models.
2.6 Blackboard / Shared Memoryโ
All agents record observations and intermediate results in central storage (blackboard). Each agent autonomously contributes when seeing tasks matching their expertise.
- Storage: Redis, Postgres (LangGraph checkpointer), DynamoDB, or file system.
- Best For: Long sessions (hours+), async collaboration, environments with frequent agent join/leave.
- Caution: Race conditions โ guarantee consistency with optimistic locking, version numbers, or event sourcing.
3. Implementation Framework Comparison (As of 2026-04)โ
| Framework | Core Abstraction | Language | Key Patterns | License |
|---|---|---|---|---|
| LangGraph | StateGraph + Node | Python/JS | Supervisor, Swarm, Conditional routing | MIT |
| CrewAI | Crew + Agent + Task | Python | Sequential / Hierarchical / Consensus | MIT |
| AutoGen (v0.4+) | ConversableAgent + GroupChat | Python | Conversation + Workflow | Apache 2.0 |
| Strands Agents SDK | Agent + Graph (Python) | Python | Orchestrator, Handoff | Apache 2.0 |
| OpenAI Agents SDK | Agent + Handoff | Python/TS | Orchestrator-Worker, Handoff | Apache 2.0 |
| Amazon Bedrock AgentCore | Agent + Action Group | AWS SDK | Managed, MCP native | AWS managed |
3.1 LangGraphโ
Defines state transitions between nodes as a graph based on StateGraph. Most patterns can be implemented in 10-50 lines with create_react_agent, create_supervisor, and swarm helpers. Deploy via LangGraph Platform (paid) or self-host, with Postgres/Redis checkpointer supporting long-running recovery.
3.2 CrewAIโ
Expresses role-based collaboration with natural language declarations. Provides 3 modes: Process.sequential, Process.hierarchical, Process.consensual, with manager_agent configuring hierarchical supervision structure. In production, clear "role / goal / backstory" writing determines quality.
3.3 AutoGen (v0.4+)โ
Microsoft Research framework redesigned in v0.4 based on actor-model. Configures conversational multi-agent with GroupChat, SelectorGroupChat, MagenticOne, with strong integration with code execution environments (Docker, Jupyter).
3.4 Strands Agents SDKโ
Open-source SDK released by AWS in 2025, tightly integrated with Bedrock but also supporting direct OpenAI/Anthropic calls. Agent + Graph abstraction similar to LangGraph, treats MCP tools as first-class citizens. Strands Agents Handoff has similar design intent as OpenAI Agents SDK handoff.
3.5 OpenAI Agents SDKโ
GA-level SDK released by OpenAI in March 2025 as Swarm successor. Can compose nearly all patterns with 4 primitives: Agent, Runner, handoff, guardrail. Fast observability setup with tracing integrated into OpenAI Dashboard.
3.6 Amazon Bedrock AgentCoreโ
Provides managed Action Group, Knowledge Base, Guardrails, Memory on top of Agents for Bedrock. MCP native support facilitates external tool integration, suitable for regulated industries with multi-agent execution within IAM/VPC boundaries.
- Rapid Prototyping: CrewAI or OpenAI Agents SDK
- Complex State Transitions & Recovery: LangGraph + Postgres checkpointer
- AWS Ecosystem Lock-in: Strands Agents SDK or Bedrock AgentCore
- Research & Experimentation: AutoGen v0.4 (easy exploration of various conversation patterns)
3.7 Minimal Implementation Example: Supervisor Patternโ
# LangGraph โ Supervisor routes to either Researcher or Coder
from langgraph.graph import StateGraph, END
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-sonnet-4-5")
researcher = create_react_agent(llm, tools=[web_search], name="researcher")
coder = create_react_agent(llm, tools=[execute_python], name="coder")
def supervisor(state):
decision = llm.invoke([
{"role": "system", "content": "Route to 'researcher' or 'coder'. Reply with one word."},
{"role": "user", "content": state["input"]},
]).content.strip().lower()
return {"next": decision}
graph = StateGraph(dict)
graph.add_node("supervisor", supervisor)
graph.add_node("researcher", researcher)
graph.add_node("coder", coder)
graph.set_entry_point("supervisor")
graph.add_conditional_edges("supervisor", lambda s: s["next"],
{"researcher": "researcher", "coder": "coder"})
graph.add_edge("researcher", END)
graph.add_edge("coder", END)
app = graph.compile()
# CrewAI โ Hierarchical Crew
from crewai import Agent, Task, Crew, Process
manager = Agent(role="Engineering Manager",
goal="Distribute, review, and approve",
backstory="10-year platform lead")
coder = Agent(role="Coder", goal="Implement features", backstory="...")
reviewer = Agent(role="Reviewer", goal="Code review", backstory="...")
crew = Crew(agents=[coder, reviewer],
tasks=[Task(description="Implement auth endpoint", agent=coder),
Task(description="Review and feedback", agent=reviewer)],
manager_agent=manager,
process=Process.hierarchical)
result = crew.kickoff()
# OpenAI Agents SDK โ Handoff
from agents import Agent, Runner, handoff
triage = Agent(
name="Triage",
instructions="Classify questions and route to appropriate agent.",
handoffs=[
handoff(Agent(name="BillingBot", instructions="Billing inquiries")),
handoff(Agent(name="TechBot", instructions="Technical inquiries")),
],
)
result = await Runner.run(triage, input="I was charged twice for this invoice.")
4. State Sharing, Conflict Resolution & Failure Recoveryโ
4.1 State Sharing Modelsโ
| Model | Description | Representative Implementations |
|---|---|---|
| Shared Memory | Everyone reads/writes central storage | LangGraph StateGraph, Redis/Postgres |
| Message Passing | Agent communication via message queue only | AutoGen GroupChat, AWS SQS |
| Blackboard | Event sourcing + subscription | Kafka, EventBridge |
| Handoff Context | Context passed at call time, separated thereafter | OpenAI Agents SDK, Strands Handoff |
In production, Shared Memory + Handoff Context combination is most common. Common state (user requests, accumulated results) in shared state, agent-specific work instructions in handoff payload.
4.2 Conflict Resolution Strategiesโ
- Voting: Majority vote or weighted average. Designate tiebreaker agent for ties.
- Referee Agent: Judge makes final decision in Debate pattern.
- Deterministic Winner Rule: Hard rules like "security reviewer rejection mandates rework."
- Priority Queue: Other agents wait when urgent work is in progress.
4.3 Failure Recoveryโ
- Retry Budget: Max retries and token budget per agent. Escalate upward when exceeded.
- Per-Agent Circuit Breaker: Temporarily block specific agent when consecutive failure rate exceeds threshold.
- Fallback Agent: Bypass with simpler prompt + cheaper model. Accept quality degradation to secure availability.
- Checkpointer Recovery: Resume from intermediate state with LangGraph/Strands checkpoint feature (essential for long tasks).
5. Observability (Langfuse + OpenTelemetry)โ
Multi-agent system traces naturally have hierarchical structure. Correctly representing this in Langfuse/OTel dramatically simplifies debugging and performance analysis.
5.1 Trace Hierarchy Designโ
Trace: user-request-<uuid>
โโโ Span: orchestrator.plan
โโโ Span: worker.retriever
โ โโโ Span: tool.vector_search
โ โโโ Span: llm.claude-opus-4-7
โโโ Span: worker.coder
โ โโโ Span: llm.sonnet-4-5
โโโ Span: judge.reviewer
โโโ Span: llm.opus-4-7
5.2 Essential Span Attributesโ
Consistently assign the following attributes to each span. These form the basis for dashboard filtering and alerting in operations.
agent.name: Agent identifier (e.g.,retriever,coder,judge)agent.role: Role (e.g.,worker,supervisor,critic)agent.model: Model used (e.g.,claude-opus-4-7,gpt-5-reasoning)handoff.reason: Handoff reason (when switched to another agent)handoff.from/handoff.toround.index: Voting/Debate round numbertokens.input/tokens.output/cost.usd
5.3 Langfuse Dashboard Examplesโ
- Per-Agent Latency p95:
agent.nameIdentify bottlenecks by grouping - Handoff Heatmap:
handoff.fromรhandoff.tomatrix - Per-Round Cost: Debate/Voting pattern cost convergence verification
- Failure Rate:
status=errorspans byagent.nameAggregate
Langfuse v3.xoperates as OTel native collector. Using traceparent W3C standard in apps connects to AWS X-Ray, Datadog, Grafana Tempo as single trace.