🛠️ Multiエージェントパターン集
複数のAIエージェントが連携し、複雑なタスクを効率的に解決するためのシステム設計や協調動作を支援するSkill。
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
This skill should be used when the user asks to "design multi-agent system", "implement supervisor pattern", "create swarm architecture", "coordinate multiple agents", or mentions multi-agent patterns, context isolation, agent handoffs, sub-agents, or parallel agent execution.
🇯🇵 日本人クリエイター向け解説
複数のAIエージェントが連携し、複雑なタスクを効率的に解決するためのシステム設計や協調動作を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o multi-agent-patterns.zip https://jpskill.com/download/3186.zip && unzip -o multi-agent-patterns.zip && rm multi-agent-patterns.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/3186.zip -OutFile "$d\multi-agent-patterns.zip"; Expand-Archive "$d\multi-agent-patterns.zip" -DestinationPath $d -Force; ri "$d\multi-agent-patterns.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
multi-agent-patterns.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
multi-agent-patternsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
💬 こう話しかけるだけ — サンプルプロンプト
- › Multi Agent Patterns を使って、最小構成のサンプルコードを示して
- › Multi Agent Patterns の主な使い方と注意点を教えて
- › Multi Agent Patterns を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] multi-agent-patterns
マルチエージェントアーキテクチャパターン
マルチエージェントアーキテクチャは、複数の言語モデルインスタンスに作業を分散させ、それぞれが独自のコンテキストウィンドウを持ちます。適切に設計された場合、この分散により、単一エージェントの限界を超える機能が可能になります。不適切に設計された場合、調整のオーバーヘッドが発生し、利点が打ち消されます。重要な洞察は、サブエージェントは主にコンテキストを分離するために存在し、役割分担を擬人化するためではないということです。
使用するタイミング
このスキルをアクティブにするのは、次の場合です。
- 単一エージェントのコンテキスト制限がタスクの複雑さを制約している場合
- タスクが自然に並列サブタスクに分解される場合
- 異なるサブタスクが異なるツールセットまたはシステムプロンプトを必要とする場合
- 複数のドメインを同時に処理する必要があるシステムを構築する場合
- 単一コンテキストの限界を超えてエージェントの機能を拡張する場合
- 複数の専門コンポーネントを持つ本番エージェントシステムを設計する場合
コアコンセプト
マルチエージェントシステムは、分散を通じて単一エージェントのコンテキスト制限に対処します。主に3つのパターンが存在します。集中制御のためのスーパーバイザー/オーケストレーター、柔軟な引き渡しのためのピアツーピア/スウォーム、階層化された抽象化のための階層型です。重要な設計原則はコンテキスト分離です。サブエージェントは、組織の役割をシミュレートするのではなく、主にコンテキストを分割するために存在します。
効果的なマルチエージェントシステムには、明示的な調整プロトコル、追従を避けるための合意メカニズム、ボトルネック、分岐、エラー伝播などの障害モードへの注意深い配慮が必要です。
詳細なトピック
なぜマルチエージェントアーキテクチャなのか
コンテキストのボトルネック 単一エージェントは、推論能力、コンテキスト管理、ツール調整において固有の限界に直面します。タスクが複雑になるにつれて、コンテキストウィンドウは蓄積された履歴、取得されたドキュメント、ツール出力で満たされます。パフォーマンスは、lost-in-middle効果、注意力の不足、コンテキスト汚染といった予測可能なパターンに従って低下します。
マルチエージェントアーキテクチャは、複数のコンテキストウィンドウに作業を分割することでこれらの制限に対処します。各エージェントは、サブタスクに焦点を当てたクリーンなコンテキストで動作します。結果は調整レイヤーで集約され、単一のコンテキストがすべての負担を負うことはありません。
トークン経済の現実 マルチエージェントシステムは、単一エージェントのアプローチよりも大幅に多くのトークンを消費します。本番データは以下を示しています。
| アーキテクチャ | トークン乗数 | ユースケース |
|---|---|---|
| 単一エージェントチャット | 1倍ベースライン | シンプルなクエリ |
| ツール付き単一エージェント | 約4倍ベースライン | ツール使用タスク |
| マルチエージェントシステム | 約15倍ベースライン | 複雑な調査/調整 |
BrowseComp評価に関する調査では、パフォーマンスの分散の95%を3つの要因が説明していることがわかりました。トークン使用量(分散の80%)、ツール呼び出しの数、モデル選択です。これは、並列推論の容量を追加するために、別々のコンテキストウィンドウを持つエージェント間で作業を分散するマルチエージェントのアプローチを検証するものです。
重要なことに、より良いモデルにアップグレードすることは、トークン予算を2倍にするよりも大きなパフォーマンス向上をもたらすことがよくあります。Claude Sonnet 4.5は、以前のSonnetバージョンでトークンを2倍にするよりも大きな向上を示しました。GPT-5.2の思考モードも同様に、生のトークン増加を上回ります。これは、モデル選択とマルチエージェントアーキテクチャが相補的な戦略であることを示唆しています。
並列化の議論 多くのタスクには、単一エージェントが順次実行しなければならない並列化可能なサブタスクが含まれています。調査タスクでは、複数の独立したソースの検索、異なるドキュメントの分析、競合するアプローチの比較が必要になる場合があります。単一エージェントはこれらを順次処理し、各ステップでコンテキストを蓄積します。
マルチエージェントアーキテクチャは、各サブタスクを専用のエージェントに新しいコンテキストで割り当てます。すべてのエージェントが同時に作業し、結果をコーディネーターに返します。実際の合計時間は、すべてのサブタスクの合計ではなく、最も長いサブタスクの期間に近づきます。
専門化の議論 異なるタスクは、異なるエージェント構成(異なるシステムプロンプト、異なるツールセット、異なるコンテキスト構造)から恩恵を受けます。汎用エージェントは、考えられるすべての構成をコンテキストに保持しなければなりません。専門エージェントは、必要なものだけを保持します。
マルチエージェントアーキテクチャは、組み合わせ爆発なしに専門化を可能にします。コーディネーターは専門エージェントにルーティングし、各エージェントはドメインに最適化されたリーンなコンテキストで動作します。
アーキテクチャパターン
パターン1:スーパーバイザー/オーケストレーター スーパーバイザーパターンでは、中央のエージェントが制御を担い、スペシャリストに委任し、結果を統合します。スーパーバイザーはグローバルな状態と軌道を維持し、ユーザーの目的をサブタスクに分解し、適切なワーカーにルーティングします。
User Query -> Supervisor -> [Specialist, Specialist, Specialist] -> Aggregation -> Final Output
使用するタイミング:明確な分解を伴う複雑なタスク、ドメイン間の調整が必要なタスク、人間の監視が重要なタスク。
利点:ワークフローの厳密な制御、ヒューマン・イン・ザ・ループ介入の実装が容易、事前定義された計画への遵守を保証。
欠点:スーパーバイザーのコンテキストがボトルネックになる、スーパーバイザーの障害がすべてのワーカーに波及する、スーパーバイザーがサブエージェントの応答を誤って言い換える「伝言ゲーム」問題。
伝言ゲーム問題とその解決策 LangGraphのベンチマークでは、スーパーバイザーアーキテクチャは当初、スーパーバイザーがサブエージェントの応答を誤って言い換え、忠実度を失う「伝言ゲーム」問題のため、最適化されたバージョンよりも50%パフォーマンスが低いことがわかりました。
解決策:サブエージェントが応答を直接ユーザーに渡すことを可能にする forward_message ツールを実装します。
def forward_message(message: str, to_user: bool = True):
"""
サブエージェントの応答をスーパーバイザーの統合なしに直接ユーザーに転送します。
次の場合に使用します。
- サブエージェントの応答が最終的で完全である場合
- スーパーバイザーの統合が重要な詳細を失う場合
- 応答形式を正確に保持する必要がある場合
"""
if to_user:
return {"type": "direct_response", "content" 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Multi-Agent Architecture Patterns
Multi-agent architectures distribute work across multiple language model instances, each with its own context window. When designed well, this distribution enables capabilities beyond single-agent limits. When designed poorly, it introduces coordination overhead that negates benefits. The critical insight is that sub-agents exist primarily to isolate context, not to anthropomorphize role division.
When to Use
Activate this skill when:
- Single-agent context limits constrain task complexity
- Tasks decompose naturally into parallel subtasks
- Different subtasks require different tool sets or system prompts
- Building systems that must handle multiple domains simultaneously
- Scaling agent capabilities beyond single-context limits
- Designing production agent systems with multiple specialized components
Core Concepts
Multi-agent systems address single-agent context limitations through distribution. Three dominant patterns exist: supervisor/orchestrator for centralized control, peer-to-peer/swarm for flexible handoffs, and hierarchical for layered abstraction. The critical design principle is context isolation—sub-agents exist primarily to partition context rather than to simulate organizational roles.
Effective multi-agent systems require explicit coordination protocols, consensus mechanisms that avoid sycophancy, and careful attention to failure modes including bottlenecks, divergence, and error propagation.
Detailed Topics
Why Multi-Agent Architectures
The Context Bottleneck Single agents face inherent ceilings in reasoning capability, context management, and tool coordination. As tasks grow more complex, context windows fill with accumulated history, retrieved documents, and tool outputs. Performance degrades according to predictable patterns: the lost-in-middle effect, attention scarcity, and context poisoning.
Multi-agent architectures address these limitations by partitioning work across multiple context windows. Each agent operates in a clean context focused on its subtask. Results aggregate at a coordination layer without any single context bearing the full burden.
The Token Economics Reality Multi-agent systems consume significantly more tokens than single-agent approaches. Production data shows:
| Architecture | Token Multiplier | Use Case |
|---|---|---|
| Single agent chat | 1× baseline | Simple queries |
| Single agent with tools | ~4× baseline | Tool-using tasks |
| Multi-agent system | ~15× baseline | Complex research/coordination |
Research on the BrowseComp evaluation found that three factors explain 95% of performance variance: token usage (80% of variance), number of tool calls, and model choice. This validates the multi-agent approach of distributing work across agents with separate context windows to add capacity for parallel reasoning.
Critically, upgrading to better models often provides larger performance gains than doubling token budgets. Claude Sonnet 4.5 showed larger gains than doubling tokens on earlier Sonnet versions. GPT-5.2's thinking mode similarly outperforms raw token increases. This suggests model selection and multi-agent architecture are complementary strategies.
The Parallelization Argument Many tasks contain parallelizable subtasks that a single agent must execute sequentially. A research task might require searching multiple independent sources, analyzing different documents, or comparing competing approaches. A single agent processes these sequentially, accumulating context with each step.
Multi-agent architectures assign each subtask to a dedicated agent with a fresh context. All agents work simultaneously, then return results to a coordinator. The total real-world time approaches the duration of the longest subtask rather than the sum of all subtasks.
The Specialization Argument Different tasks benefit from different agent configurations: different system prompts, different tool sets, different context structures. A general-purpose agent must carry all possible configurations in context. Specialized agents carry only what they need.
Multi-agent architectures enable specialization without combinatorial explosion. The coordinator routes to specialized agents; each agent operates with lean context optimized for its domain.
Architectural Patterns
Pattern 1: Supervisor/Orchestrator The supervisor pattern places a central agent in control, delegating to specialists and synthesizing results. The supervisor maintains global state and trajectory, decomposes user objectives into subtasks, and routes to appropriate workers.
User Query -> Supervisor -> [Specialist, Specialist, Specialist] -> Aggregation -> Final Output
When to use: Complex tasks with clear decomposition, tasks requiring coordination across domains, tasks where human oversight is important.
Advantages: Strict control over workflow, easier to implement human-in-the-loop interventions, ensures adherence to predefined plans.
Disadvantages: Supervisor context becomes bottleneck, supervisor failures cascade to all workers, "telephone game" problem where supervisors paraphrase sub-agent responses incorrectly.
The Telephone Game Problem and Solution LangGraph benchmarks found supervisor architectures initially performed 50% worse than optimized versions due to the "telephone game" problem where supervisors paraphrase sub-agent responses incorrectly, losing fidelity.
The fix: implement a forward_message tool allowing sub-agents to pass responses directly to users:
def forward_message(message: str, to_user: bool = True):
"""
Forward sub-agent response directly to user without supervisor synthesis.
Use when:
- Sub-agent response is final and complete
- Supervisor synthesis would lose important details
- Response format must be preserved exactly
"""
if to_user:
return {"type": "direct_response", "content": message}
return {"type": "supervisor_input", "content": message}
With this pattern, swarm architectures slightly outperform supervisors because sub-agents respond directly to users, eliminating translation errors.
Implementation note: Implement direct pass-through mechanisms allowing sub-agents to pass responses directly to users rather than through supervisor synthesis when appropriate.
Pattern 2: Peer-to-Peer/Swarm The peer-to-peer pattern removes central control, allowing agents to communicate directly based on predefined protocols. Any agent can transfer control to any other through explicit handoff mechanisms.
def transfer_to_agent_b():
return agent_b # Handoff via function return
agent_a = Agent(
name="Agent A",
functions=[transfer_to_agent_b]
)
When to use: Tasks requiring flexible exploration, tasks where rigid planning is counterproductive, tasks with emergent requirements that defy upfront decomposition.
Advantages: No single point of failure, scales effectively for breadth-first exploration, enables emergent problem-solving behaviors.
Disadvantages: Coordination complexity increases with agent count, risk of divergence without central state keeper, requires robust convergence constraints.
Implementation note: Define explicit handoff protocols with state passing. Ensure agents can communicate their context needs to receiving agents.
Pattern 3: Hierarchical Hierarchical structures organize agents into layers of abstraction: strategic, planning, and execution layers. Strategy layer agents define goals and constraints; planning layer agents break goals into actionable plans; execution layer agents perform atomic tasks.
Strategy Layer (Goal Definition) -> Planning Layer (Task Decomposition) -> Execution Layer (Atomic Tasks)
When to use: Large-scale projects with clear hierarchical structure, enterprise workflows with management layers, tasks requiring both high-level planning and detailed execution.
Advantages: Mirrors organizational structures, clear separation of concerns, enables different context structures at different levels.
Disadvantages: Coordination overhead between layers, potential for misalignment between strategy and execution, complex error propagation.
Context Isolation as Design Principle
The primary purpose of multi-agent architectures is context isolation. Each sub-agent operates in a clean context window focused on its subtask without carrying accumulated context from other subtasks.
Isolation Mechanisms Full context delegation: For complex tasks where the sub-agent needs complete understanding, the planner shares its entire context. The sub-agent has its own tools and instructions but receives full context for its decisions.
Instruction passing: For simple, well-defined subtasks, the planner creates instructions via function call. The sub-agent receives only the instructions needed for its specific task.
File system memory: For complex tasks requiring shared state, agents read and write to persistent storage. The file system serves as the coordination mechanism, avoiding context bloat from shared state passing.
Isolation Trade-offs Full context delegation provides maximum capability but defeats the purpose of sub-agents. Instruction passing maintains isolation but limits sub-agent flexibility. File system memory enables shared state without context passing but introduces latency and consistency challenges.
The right choice depends on task complexity, coordination needs, and acceptable latency.
Consensus and Coordination
The Voting Problem Simple majority voting treats hallucinations from weak models as equal to reasoning from strong models. Without intervention, multi-agent discussions devolve into consensus on false premises due to inherent bias toward agreement.
Weighted Voting Weight agent votes by confidence or expertise. Agents with higher confidence or domain expertise carry more weight in final decisions.
Debate Protocols Debate protocols require agents to critique each other's outputs over multiple rounds. Adversarial critique often yields higher accuracy on complex reasoning than collaborative consensus.
Trigger-Based Intervention Monitor multi-agent interactions for specific behavioral markers. Stall triggers activate when discussions make no progress. Sycophancy triggers detect when agents mimic each other's answers without unique reasoning.
Framework Considerations
Different frameworks implement these patterns with different philosophies. LangGraph uses graph-based state machines with explicit nodes and edges. AutoGen uses conversational/event-driven patterns with GroupChat. CrewAI uses role-based process flows with hierarchical crew structures.
Practical Guidance
Failure Modes and Mitigations
Failure: Supervisor Bottleneck The supervisor accumulates context from all workers, becoming susceptible to saturation and degradation.
Mitigation: Implement output schema constraints so workers return only distilled summaries. Use checkpointing to persist supervisor state without carrying full history.
Failure: Coordination Overhead Agent communication consumes tokens and introduces latency. Complex coordination can negate parallelization benefits.
Mitigation: Minimize communication through clear handoff protocols. Batch results where possible. Use asynchronous communication patterns.
Failure: Divergence Agents pursuing different goals without central coordination can drift from intended objectives.
Mitigation: Define clear objective boundaries for each agent. Implement convergence checks that verify progress toward shared goals. Use time-to-live limits on agent execution.
Failure: Error Propagation Errors in one agent's output propagate to downstream agents that consume that output.
Mitigation: Validate agent outputs before passing to consumers. Implement retry logic with circuit breakers. Use idempotent operations where possible.
Examples
Example 1: Research Team Architecture
Supervisor
├── Researcher (web search, document retrieval)
├── Analyzer (data analysis, statistics)
├── Fact-checker (verification, validation)
└── Writer (report generation, formatting)
Example 2: Handoff Protocol
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 the primary benefit of multi-agent systems
- Choose architecture pattern based on coordination needs, not organizational metaphor
- Implement explicit handoff protocols with state passing
- Use weighted voting or debate protocols for consensus
- Monitor for supervisor bottlenecks and implement checkpointing
- Validate outputs before passing between agents
- Set time-to-live limits to prevent infinite loops
- Test failure scenarios explicitly
Integration
This skill builds on context-fundamentals and context-degradation. It connects to:
- memory-systems - Shared state management across agents
- tool-design - Tool specialization per agent
- context-optimization - Context partitioning strategies
References
Internal reference:
- Frameworks Reference - Detailed framework implementation patterns
Related skills in this collection:
- context-fundamentals - Context basics
- memory-systems - Cross-agent memory
- context-optimization - Partitioning strategies
External resources:
- LangGraph Documentation - Multi-agent patterns and state management
- AutoGen Framework - GroupChat and conversational patterns
- CrewAI Documentation - Hierarchical agent processes
- Research on Multi-Agent Coordination - Survey of multi-agent systems
Skill Metadata
Created: 2025-12-20 Last Updated: 2025-12-20 Author: Agent Skills for Context Engineering Contributors Version: 1.0.0
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.