AIFCC
記事一覧へ
agent-opsharness-designclaude-workflow

マルチエージェント設計の完全ガイド

13624
1つのagentは便利だ。agentのチームは競争優位になる。 保存しておこう :) 1つのAI agentはリサーチができる。または書くことができる。または分析ができる。またはコードを書ける。しかしこれらすべてを同時にうまくやることはできない。リサーチ、ライティング、営業、カスタマーサポートをすべて担おうとする1人の従業員がすべてをうまくやれないのと同じだ。 解決策は人間が何世紀も前に見つけた答えと同じだ。専門化。 過負荷の1つのagentの代わりに、チームを作る。リサーチだけをするresearch agent。ライティングだけをするwriting agent。分析だけをするanalysis agent。チームを管理し、タスクを割り当て、最終アウトプットを組み立てるcoordinator agent。 各agentは集中している。各agentは特定の仕事において優秀だ。一緒になると、単一のagentでは到底及ばない成果を生み出す。 これをマルチエージェントオーケストレーションと呼ぶ。これは今まさに構築されている最も強力なAIシステムの背後にあるアーキテクチャだ。カスタマーサポートプラットフォーム、リサーチシステム、コンテンツエンジン、ビジネス自動化パイプラインはすべてコアにマルチエージェントチームを使っている。 このコースでは、自分自身のチームを設計・構築・デプロイする方法を教える。 ## アーキテクチャ: ハブ&スポーク すべての効果的なマルチエージェントシステムは同じ基本パターンに従う。ハブ&スポークだ。 ハブ(coordinator agent)は中心に位置する。ユーザーから全体の目標を受け取る。目標をサブタスクに分解する。どのspecialist agentが各サブタスクを担当するかを決定する。スペシャリスト間でコンテキストを渡す。すべてのパーツから最終アウトプットを組み立てる。 スポーク(specialist agents)は集中した専門家だ。各agentは定義された役割、その役割に最適化されたツールの小さなセット、そして専門分野に制約するsystem promptを持つ。 すべてのコミュニケーションはcoordinatorを通じて流れる。スペシャリストは互いに直接話さない。coordinatorはルーティング、品質管理、組み立ての単一ポイントだ。 このアーキテクチャには大きな利点がある。各スペシャリストは集中を保てる。コンテキストの過負荷によるエラーが減る。スペシャリストは独立して開発・テストできる。システムを再構築せずに個別のスペシャリストを入れ替えたりアップグレードしたりできる。coordinatorはデバッグとモニタリングのための単一の観測ポイントを提供する。 ## 誰もが犯す重大なルール違反 これをどれだけ強調しても足りない。これがマルチエージェントシステムで最もよくあるバグだからだ。 Specialist agentはcoordinatorの会話履歴を自動的に引き継がない。 もっと直接的に言おう。coordinatorがスペシャリストを生成するとき、スペシャリストは空のコンテキストから始まる。何も知らない。会話履歴を読んでいない。他のスペシャリストが生成したものを見ていない。プロンプトに明示的に含めたもの以外は何も認識していない。 ほとんどの人は、coordinatorがすべてを知っているからスペシャリストもすべてを知っているはずだと思い込む。そうではない。coordinatorがリサーチデータを集めて、writing specialistにそれをレポートに変えてほしい場合、coordinatorはwriting specialistのプロンプトにすべてのリサーチデータを含めなければならない。単に「リサーチに基づいてレポートを書いて」と言うだけなら、writing specialistはどんなリサーチが行われたかまったく知らない。 ```python # NG — specialistにコンテキストがない writer_prompt = "Write a market analysis report based on the research." # OK — すべてのコンテキストを明示的に渡す writer_prompt = f"""You are a professional report writer. Write a market analysis report using the research findings below. RESEARCH FINDINGS: {research_data} KEY STATISTICS: {statistics} COMPETITOR ANALYSIS: {competitor_data} FORMAT: Executive summary (3 sentences), then 5 sections with headers, each 2-3 paragraphs. Professional tone. Cite specific numbers from the research. AUDIENCE: C-level executives who will read this in under 10 minutes. """ ``` 2つ目のバージョンは長い。しかしそれだけが機能する唯一のバージョンだ。スペシャリストが必要とするすべてのコンテキストを明示的に含めなければならない。例外はない。 ## 最初のマルチエージェントチームを作る: リサーチ&レポートシステム 完全なマルチエージェントチームの構築をガイドしよう。このシステムはリサーチ質問を受け取り、包括的でよく書かれた、ファクトチェックされたレポートを生成する。 チーム構成: - Agent 1: Research Specialist — 情報を検索し、重要な事実を抽出し、生のリサーチデータをまとめる。 - Agent 2: Analyst Specialist — 生のリサーチデータを受け取り、パターンを特定し、結論を出し、ソース間の矛盾を見つける。 - Agent 3: Writer Specialist — 分析済みデータを受け取り、定義されたフォーマットとスタイルで洗練されたレポートを作成する。 - Agent 4: Reviewer Specialist — 完成したレポートを読み、生のリサーチと照らし合わせて精度を確認し、弱い主張を特定し、改善を提案する。 - Agent 0: Coordinator — ワークフロー全体を管理する。 coordinatorのワークフロー: ```markdown Step 1: ユーザーからリサーチ質問を受け取る。 Step 2: 質問をトピック全体をカバーする3-5のサブ質問に分解する。 Step 3: 各サブ質問をResearch Specialistに送る。 Step 4: すべてのリサーチ結果をまとめる。 Step 5: まとめた結果をAnalyst Specialistに送る。 Step 6: 分析+リサーチをWriter Specialistに送る。 Step 7: ドラフトレポート+元のリサーチをReviewer Specialistに送る。 Step 8: Reviewerが問題を指摘した場合: フラグが付いたセクションを修正のためWriterに戻す。 Step 9: 最終レポートをユーザーに届ける。 ``` 各スペシャリストは集中したsystem promptを持つ: Research Specialist: ```markdown You are a research specialist. Your only job is to find accurate, current information on the topic you are given. For each piece of information: - Note the source - Rate your confidence (high/medium/low) - Flag if the information might be outdated Return your findings as a structured list of facts with sources and confidence ratings. Do not analyze. Do not write prose. Just find and organize facts. ``` Analyst Specialist: ```markdown You are a data analyst. Your only job is to analyze research findings and extract insights. Given raw research data: - Identify the 3-5 most important patterns - Note contradictions between sources - Flag claims that lack sufficient evidence - Draw conclusions supported by the data Do not write a final report. Return structured analysis that a writer can turn into polished prose. ``` Writer Specialist: ```markdown You are a professional report writer. Your only job is to turn analyzed data into a polished, readable report. Given analysis and supporting data: - Write in clear, professional prose - Structure with an executive summary followed by detailed sections - Cite specific numbers and sources throughout - Make the report scannable — a reader should grasp key points in under 3 minutes Do not perform new research. Do not change the conclusions from the analysis. Only write. ``` Reviewer Specialist: ```markdown You are a quality reviewer. Your only job is to check the finished report against the original research. Check for: - Claims in the report not supported by the research data - Important findings from the research that the report omits - Logical inconsistencies or weak reasoning - Accuracy of all numbers and statistics - Clarity and readability issues For each issue found: quote the problem, explain what is wrong, and suggest a specific fix. If the report is solid, say so. ``` なぜこのチームが単一agentより優れたアウトプットを生み出すか: research agentは情報探索に深く集中できる。同時にレポートを書く必要がない。analyst agentはパターンに集中できる。情報を探したり文章を書いたりしない。writer agentは高品質な文章に集中できる。リサーチや分析は行わない。reviewer agentはライターが見逃したミスを捉える。レビューがその唯一の仕事だからだ。 各agentは1つのことをうまくやる。coordinatorがパーツが合わさるよう保証する。結果は、すべてをやるよう1つのagentに頼む場合より一貫して高品質だ。 ## 自分自身のマルチエージェントチームを設計する リサーチ&レポートチームは1つの構成に過ぎない。あらゆる複雑なワークフローにマルチエージェントチームを作れる。 Content Team: Researcher → Outline Architect → Draft Writer → Editor → Formatter トピックを受け取り、洗練されたマルチフォーマットのコンテンツを生成する。 Customer Support Team: Classifier → Knowledge Base Searcher → Response Drafter → Quality Checker 複数の検証レイヤーでサポートチケットを処理する。 Business Analysis Team: Data Collector → Trend Analyzer → Risk Assessor → Recommendation Writer 生のビジネスデータを受け取り、実行可能な戦略的推奨事項を生成する。 設計原則は常に同じだ: - 各agentは1つの明確な責任を持つ - 各agentは集中したツールセットを持つ(最大3〜5個) - すべてのコミュニケーションはcoordinatorを通じて流れる - コンテキストはagent間で明示的に渡される。想定しない - coordinatorは次のagentに渡す前に各ステージでアウトプットを検証する ## 3つの失敗パターン(とその防止策) **失敗1: 狭すぎる分解** coordinatorが「AIが産業に与える影響」をソフトウェアとヘルスケアのサブトピックだけに分解し、金融、教育、製造、メディア、法律を完全に見落とす。 防止策: coordinatorに分解の前にフルスコープを列挙するよう指示する。自己確認ステップを追加する: 「分解を見直してください。このトピックのすべての主要な側面をカバーしていますか?重要な領域が欠けていれば追加してください。」 **失敗2: 失われたコンテキスト** research agentが発見した情報が、coordinatorがそれを渡さなかったためにwriting agentに届かない。 防止策: coordinatorは各後続agentのプロンプトに前のすべてのagentのアウトプットを含めなければならない。coordinatorのワークフローに明示的なコンテキスト渡しを組み込む。 **失敗3: 伝言ゲーム効果による品質低下** 各agentが前のagentのアウトプットからニュアンスを微妙に変えるか失う。4つのagentを通じて情報が渡るころには、重要な詳細が希薄になっている。 防止策: すべてのステージに元のソースデータを含める。前のagentのアウトプットだけでなく、生のリサーチも含める。writerは分析だけでなく、生のリサーチも受け取るべきだ。 ## 結論 単一agentは便利だ。マルチエージェントチームは強力だ。 アーキテクチャは明快だ: coordinatorがスペシャリストを管理し、各スペシャリストは1つのことをうまくやり、すべてのコンテキストは明示的に渡され、coordinatorが最終アウトプットを組み立てる。 今週、最初のチームを作ろう。リサーチ&レポートの構成から始める。本物のリサーチ質問でテストする。品質が、すべてをやるよう単一agentに頼む場合と比べてどうか観察する。 品質の差を体験したら、複雑なタスクに単一agentのワークフローに戻ることは二度とないだろう。 AIの未来は1つのagentがすべてをやることではない。すべてをうまくやるagentのチームにある。 より多くのagentアーキテクチャガイド、オーケストレーションパターン、システム構築については @eng_khairallah1 をフォローしてほしい。 お役に立てれば幸いです、Khairallah ❤️
原文を表示 / Show original
One agent is useful. A team of agents is a competitive advantage. Save this :) A single AI agent can research, or write, or analyze, or code. But it cannot do all of these things well simultaneously. Just like a single employee who tries to handle research, writing, sales, and customer support will do all of them poorly. The solution is the same solution humans figured out centuries ago: specialization. Instead of one overloaded agent, you build a team. A research agent that only researches. A writing agent that only writes. An analysis agent that only analyzes. A coordinator agent that manages the team, assigns tasks, and assembles the final output. Each agent is focused. Each agent is excellent at its specific job. Together they produce work that no single agent could match. This is called multi-agent orchestration and it is the architecture behind the most powerful AI systems being built right now. Customer support platforms, research systems, content engines, and business automation pipelines all use multi-agent teams at their core. This course teaches you how to design, build, and deploy your own. The Architecture: Hub and Spoke Every effective multi-agent system follows the same fundamental pattern: hub and spoke. The hub (coordinator agent) sits at the center. It receives the overall goal from the user. It decomposes the goal into subtasks. It decides which specialist agent handles each subtask. It passes context between specialists. It assembles the final output from all the pieces. The spokes (specialist agents) are focused experts. Each one has a defined role, a small set of tools optimized for that role, and a system prompt that constrains it to its specialty. All communication flows through the coordinator. Specialists never talk to each other directly. The coordinator is the single point of routing, quality control, and assembly. This architecture has massive advantages. Each specialist stays focused - reducing errors from context overload. Specialists can be developed and tested independently. You can swap out or upgrade individual specialists without rebuilding the system. The coordinator provides a single point of observability for debugging and monitoring. The Critical Rule Everyone Violates I cannot emphasize this enough because it is the single most common bug in multi-agent systems. Specialist agents do NOT automatically inherit the coordinator's conversation history. Let me say that more directly. When the coordinator spawns a specialist, the specialist starts with a blank context. It knows nothing. It has not read the conversation history. It has not seen what other specialists produced. It has zero awareness of anything except what you explicitly include in its prompt. Most people assume that because the coordinator knows everything, the specialist must also know everything. It does not. If the coordinator gathered research data and wants the writing specialist to turn it into a report, the coordinator must include all the research data in the writing specialist's prompt. If it just says "write the report based on our research," the writing specialist has no idea what research was done. python # WRONG — specialist has no context writer_prompt = "Write a market analysis report based on the research." # RIGHT — all context passed explicitly writer_prompt = f"""You are a professional report writer. Write a market analysis report using the research findings below. RESEARCH FINDINGS: {research_data} KEY STATISTICS: {statistics} COMPETITOR ANALYSIS: {competitor_data} FORMAT: Executive summary (3 sentences), then 5 sections with headers, each 2-3 paragraphs. Professional tone. Cite specific numbers from the research. AUDIENCE: C-level executives who will read this in under 10 minutes. """ The second version is longer. It is also the only version that works. Every piece of context the specialist needs must be explicitly included. No exceptions. Building Your First Multi-Agent Team: The Research and Report System Let me walk you through building a complete multi-agent team. This system takes a research question and produces a comprehensive, well-written, fact-checked report. The team: Agent 1: Research Specialist - searches for information, extracts key facts, and compiles raw research data. Agent 2: Analyst Specialist - takes raw research data, identifies patterns, draws conclusions, and spots contradictions between sources. Agent 3: Writer Specialist - takes analyzed data and produces a polished, structured report in a defined format and voice. Agent 4: Reviewer Specialist - reads the finished report, checks for accuracy against the raw research, identifies weak claims, and suggests improvements. Agent 0: Coordinator - manages the entire workflow. The coordinator's workflow: markdown Step 1: Receive the research question from the user. Step 2: Decompose the question into 3-5 sub-questions that together fully cover the topic. Step 3: Send each sub-question to the Research Specialist. Step 4: Compile all research findings. Step 5: Send compiled findings to the Analyst Specialist. Step 6: Send analysis + research to the Writer Specialist. Step 7: Send the draft report + original research to the Reviewer Specialist. Step 8: If the Reviewer flags issues: send the flagged sections back to the Writer for revision. Step 9: Deliver the final report to the user. Each specialist has a focused system prompt: Research Specialist: markdown You are a research specialist. Your only job is to find accurate, current information on the topic you are given. For each piece of information: - Note the source - Rate your confidence (high/medium/low) - Flag if the information might be outdated Return your findings as a structured list of facts with sources and confidence ratings. Do not analyze. Do not write prose. Just find and organize facts. Analyst Specialist: markdown You are a data analyst. Your only job is to analyze research findings and extract insights. Given raw research data: - Identify the 3-5 most important patterns - Note contradictions between sources - Flag claims that lack sufficient evidence - Draw conclusions supported by the data Do not write a final report. Return structured analysis that a writer can turn into polished prose. Writer Specialist: markdown You are a professional report writer. Your only job is to turn analyzed data into a polished, readable report. Given analysis and supporting data: - Write in clear, professional prose - Structure with an executive summary followed by detailed sections - Cite specific numbers and sources throughout - Make the report scannable — a reader should grasp key points in under 3 minutes Do not perform new research. Do not change the conclusions from the analysis. Only write. Reviewer Specialist: markdown You are a quality reviewer. Your only job is to check the finished report against the original research. Check for: - Claims in the report not supported by the research data - Important findings from the research that the report omits - Logical inconsistencies or weak reasoning - Accuracy of all numbers and statistics - Clarity and readability issues For each issue found: quote the problem, explain what is wrong, and suggest a specific fix. If the report is solid, say so. Why this team produces better output than a single agent: The research agent goes deep on finding information - it is not distracted by having to write a report at the same time. The analyst focuses purely on patterns - not on finding information or writing prose. The writer focuses purely on quality prose - not on doing research or analysis. The reviewer catches mistakes that the writer missed because reviewing is its entire job. Each agent does one thing well. The coordinator ensures the pieces fit together. The result is consistently higher quality than asking one agent to do everything. Designing Your Own Multi-Agent Teams The research and report team is just one configuration. You can build multi-agent teams for any complex workflow. The Content Team: Researcher → Outline Architect → Draft Writer → Editor → Formatter Takes a topic and produces polished, multi-format content. The Customer Support Team: Classifier → Knowledge Base Searcher → Response Drafter → Quality Checker Handles support tickets with multiple verification layers. The Business Analysis Team: Data Collector → Trend Analyzer → Risk Assessor → Recommendation Writer Takes raw business data and produces actionable strategic recommendations. The design principles are always the same: Each agent has ONE clear responsibility. Each agent has a focused set of tools (3 to 5 maximum). All communication flows through the coordinator. Context is passed explicitly between agents - never assumed. The coordinator validates output at each stage before passing to the next agent. The Three Failure Modes (And How to Prevent Them) Failure 1: Narrow decomposition. The coordinator decomposes "impact of AI on industries" into only software and healthcare subtopics, missing finance, education, manufacturing, media, and legal entirely. Prevention: Instruct the coordinator to enumerate the full scope before decomposing. Add a self-check step: "Review your decomposition. Have you covered all major aspects of this topic? If any significant area is missing, add it." Failure 2: Lost context. Information discovered by the research agent never reaches the writing agent because the coordinator did not pass it along. Prevention: The coordinator must include all prior agent outputs in each subsequent agent's prompt. Build explicit context-passing into the coordinator's workflow. Failure 3: Quality degradation through telephone effect. Each agent subtly changes or loses nuance from the previous agent's output. By the time information passes through four agents, important details have been diluted. Prevention: Include the original source data at every stage - not just the previous agent's output. The writer should receive the raw research AND the analysis, not just the analysis alone. The Bottom Line Single agents are useful. Multi-agent teams are powerful. The architecture is straightforward: a coordinator manages specialists, each specialist does one thing well, all context is passed explicitly, and the coordinator assembles the final output. Build your first team this week. Start with the research and report configuration. Test it with a real research question. Observe how the quality compares to asking a single agent to do everything. Once you experience the quality difference, you will never go back to single-agent workflows for complex tasks. The future of AI is not one agent doing everything. It is teams of agents doing everything well. Follow me @eng_khairallah1 for more agent architecture guides, orchestration patterns, and building systems. hope this was useful for you, Khairallah ❤️

AIFCC — AI Fluent CxO Club

読み書きそろばん、AI。経営者が AI を自分で動かせるようになるコミュニティ。

マルチエージェント設計の完全ガイド | AIFCC