multi-agent-patterns
Manages complex tasks by distributing work across specialized agents with isolated context windows.
Install
mkdir -p .claude/skills/multi-agent-patterns-georgekhananaev && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12253" && unzip -o skill.zip -d .claude/skills/multi-agent-patterns-georgekhananaev && rm skill.zipInstalls to .claude/skills/multi-agent-patterns-georgekhananaev
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Master orchestrator, peer-to-peer, and hierarchical multi-agent architecturesKey capabilities
- →Distribute work across multiple LM instances.
- →Isolate context windows for sub-agents.
- →Implement supervisor/orchestrator pattern for centralized control.
- →Implement peer-to-peer/swarm pattern for flexible handoffs.
- →Implement hierarchical pattern for layered abstraction.
- →Manage token usage for complex research and coordination.
How it works
The skill distributes tasks across multiple language model instances using orchestrator, peer-to-peer, or hierarchical patterns, ensuring context isolation and managing token efficiency.
Inputs & outputs
When to use multi-agent-patterns
- →Design hierarchical agent systems
- →Parallelize independent subtasks
- →Optimize multi-agent token usage
About this skill
Multi-Agent Architecture Patterns
Distribute work across multiple LM instances w/ isolated context windows. Sub-agents exist to isolate context, not to anthropomorphize roles.
When to Activate
- Single-agent context limits constrain task complexity
- Tasks decompose into parallel subtasks
- Different subtasks need different tools | system prompts
- Building multi-domain agent systems
Core Concepts
Three patterns: supervisor/orchestrator (centralized), peer-to-peer/swarm (flexible handoffs), hierarchical (layered abstraction). Key principle: context isolation — sub-agents partition context, not simulate org roles. Requires explicit coordination protocols & consensus mechanisms avoiding sycophancy.
Token Economics
| Architecture | Token Multiplier | Use Case |
|---|---|---|
| Single agent | 1x | Simple queries |
| Agent w/ tools | ~4x | Tool-using tasks |
| Multi-agent | ~15x | Complex research/coordination |
BrowseComp: token usage explains 80% of performance variance. Model upgrades often outperform doubling token budgets — model selection & multi-agent architecture are complementary.
Parallelization
Tasks w/ independent subtasks: assign each to dedicated agent w/ fresh context. All work simultaneously -> total time approaches longest subtask, not sum of all.
Architectural Patterns
Pattern 1: Supervisor/Orchestrator
User Query -> Supervisor -> [Specialist, Specialist, Specialist] -> Aggregation -> Final Output
Use when: Clear decomposition, cross-domain coordination, human oversight needed Pros: Strict workflow control, easier human-in-the-loop Cons: Supervisor context bottleneck, cascade failures, "telephone game" problem
Telephone Game Fix: forward_message tool lets sub-agents pass responses directly to users:
def forward_message(message: str, to_user: bool = True):
"""Forward sub-agent response directly to user w/o supervisor synthesis."""
if to_user:
return {"type": "direct_response", "content": message}
return {"type": "supervisor_input", "content": message}
Pattern 2: Peer-to-Peer/Swarm
Agents communicate directly via handoff mechanisms. No central control.
def transfer_to_agent_b():
return agent_b # Handoff via fn return
agent_a = Agent(name="Agent A", functions=[transfer_to_agent_b])
Use when: Flexible exploration, emergent requirements Pros: No single point of failure, scales for breadth-first exploration Cons: Coordination complexity grows w/ agent count, divergence risk
Pattern 3: Hierarchical
Strategy Layer (Goals) -> Planning Layer (Decomposition) -> Execution Layer (Atomic Tasks)
Use when: Large-scale projects, enterprise workflows, mixed high/low-level tasks Pros: Clear separation of concerns, different context per level Cons: Inter-layer coordination overhead, strategy-execution misalignment
Context Isolation
Primary purpose of multi-agent architecture. Three mechanisms:
- Full context delegation: Planner shares entire context -> max capability but defeats isolation purpose
- Instruction passing: Planner creates instructions via fn call -> maintains isolation, limits flexibility
- File system memory: Agents read/write persistent storage -> shared state w/o context bloat, adds latency
Consensus & Coordination
- Weighted voting: Weight by confidence/expertise (not simple majority)
- Debate protocols: Adversarial critique > collaborative consensus for complex reasoning
- Trigger-based intervention: Stall triggers (no progress), sycophancy triggers (mimicked answers)
Failure Modes
| Failure | Mitigation |
|---|---|
| Supervisor bottleneck | Output schema constraints, workers return distilled summaries, checkpointing |
| Coordination overhead | Clear handoff protocols, batch results, async communication |
| Divergence | Objective boundaries per agent, convergence checks, TTL limits |
| Error propagation | Validate outputs before passing, retry w/ circuit breakers, idempotent ops |
Examples
Supervisor
├── Researcher (web search, doc retrieval)
├── Analyzer (data analysis, statistics)
├── Fact-checker (verification)
└── Writer (report generation)
def handle_customer_request(request):
if request.type == "billing":
return transfer_to(billing_agent)
elif request.type == "technical":
return transfer_to(technical_agent)
elif request.type == "sales":
return transfer_to(sales_agent)
else:
return handle_general(request)
Guidelines
- Design for context isolation as primary benefit
- Choose pattern by coordination needs, not org metaphor
- Explicit handoff protocols w/ state passing
- Weighted voting | debate for consensus
- Monitor supervisor bottlenecks, use checkpointing
- Validate outputs between agents
- Set TTL limits to prevent infinite loops
- Test failure scenarios explicitly
Integration
Builds on context-fundamentals & context-degradation:
- memory-systems — shared state across agents
- tool-design — tool specialization per agent
- context-optimization — context partitioning strategies
References
- LangGraph — Multi-agent patterns & state management
- AutoGen — GroupChat & conversational patterns
- CrewAI — Hierarchical agent processes
- Multi-Agent Coordination Survey
When not to use it
- →Tasks that do not decompose into parallel subtasks.
- →Simple queries that do not exceed single-agent context limits.
- →When different subtasks do not need different tools or system prompts.
Limitations
- →Supervisor context can become a bottleneck in the orchestrator pattern.
- →Coordination complexity grows with the number of agents in peer-to-peer systems.
- →Inter-layer coordination overhead exists in hierarchical systems.
How it compares
This skill provides structured architectural patterns for multi-agent systems to manage complexity and token usage, unlike a single-agent approach.
Compared to similar skills
multi-agent-patterns side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| multi-agent-patterns (this skill) | 0 | 4mo | No flags | Advanced |
| sequential-thinking | 136 | 9mo | No flags | Intermediate |
| ai-wrapper-product | 5 | 6mo | No flags | Intermediate |
| token-budget | 4 | 4mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by georgekhananaev
View all by georgekhananaev →You might also like
sequential-thinking
mrgoonie
Use when complex problems require systematic step-by-step reasoning with ability to revise thoughts, branch into alternative approaches, or dynamically adjust scope. Ideal for multi-stage analysis, design planning, problem decomposition, or tasks with initially unclear scope.
ai-wrapper-product
davila7
Expert in building products that wrap AI APIs (OpenAI, Anthropic, etc.) into focused tools people will pay for. Not just 'ChatGPT but different' - products that solve specific problems with AI. Covers prompt engineering for products, cost management, rate limiting, and building defensible AI businesses. Use when: AI wrapper, GPT product, AI tool, wrap AI, AI SaaS.
token-budget
toonight
Manages token budget estimation and tracking to prevent context overflow
initializing-memory
letta-ai
Comprehensive guide for initializing or reorganizing agent memory. Load this skill when running /init, when the user asks you to set up your memory, or when you need guidance on creating effective memory blocks.
A-Team
chemistrywow31
Start the A-Team Codex coordinator workflow for designing or restructuring teams
agentic-workflow-designer
Z3Prover
Conversational skill that interviews users to design new agentic workflows