多智能体模式
协调多个 LLM 智能体的模式:监督者、协调者-工作者、交接、辩论、层次智能体、群体、角色分配、基于投票的合作、智能体间通信。
多智能体系统是两个或更多 LLM 智能体协调以完成单独无法完成的任务。这里的模式描述了协调所采取的重复形态:一个单一的监督者路由工作,一个协调者将任务分配给工作者,两个智能体辩论以得出更好的答案,一个群体对共享输出进行投票,一个专家层次通过已知协议进行交接。
多智能体并不自动意味着更好。几个模式命名了失败模式(无限辩论、英雄智能体、无限子智能体生成),以便你能够识别它们并选择放弃。经过实地测试的多智能体形态 — 监督者 + 协调者-工作者,监督者控制孤立的子智能体 — 正是因为这些失败模式很常见而存在。
Field-tested patterns to start with
- Supervisor — Place a coordinating agent above a set of specialised agents and route work to them.
- Orchestrator-Workers — An orchestrator dynamically breaks a task into subtasks at runtime and delegates each to a worker LLM, then synthesises results.
- Handoff — Transfer the active conversation from one agent to another, carrying context across the switch.
- Debate — Have multiple agents argue different positions on a question and converge through structured exchange.
- Hierarchical Agents — Organise agents in a tree where higher-level agents decompose tasks for lower-level agents, recursively.
- Swarm — Run many peer agents that interact directly without a central supervisor, achieving emergent coordination.
- Role Assignment — Assign each agent a named role (researcher, writer, critic, planner) with a role-specific prompt, tool palette, and acceptance criteria.
- Voting-Based Cooperation — Finalise a decision across multiple agents by collecting and tallying their votes on candidate options, so the joint output reflects collective rather than single-agent judgement.
- Inter-Agent Communication — Define a protocol for agents to exchange tasks, capabilities, and results across process or vendor boundaries.
- Conversational Multi-Agent — Have agents converse turn by turn until a completion criterion fires; agent roles drive the conversation forward.
- Subagent Isolation — Run subagents in isolated workspaces so their writes do not collide and parallelism is safe.
- Agent-as-Tool Embedding — Wrap a sub-agent (with its own loop, prompt, and tool palette) behind a single function-shaped tool signature, so the parent agent calls it like any other tool and never sees the sub-agent's internal…
Recommended reading
- Multi-Agent — 50 patterns
- Routing & Composition — 24 patterns
Or open the full contents for all 562 patterns in 14 books.
Related guides
- AI Agents Patterns — AI agents patterns: named, reusable shapes for building AI agents that reason, use tools, coordinate, and stay safe — single-agent loops an…
- AI Agents Patterns Catalog — The AI agents patterns catalog: a complete, GoF-formal pattern language for AI agents across reasoning, planning, tool use, retrieval, memo…
- LLM Agent Design Patterns — A GoF-formal catalog of LLM agent design patterns: ReAct, tool use, plan-and-execute, reflection, step budget, and more. Each pattern decom…
- Agentic Design Patterns — A GoF-formal catalog of agentic design patterns — named, reusable shapes for building autonomous AI agents: agent loops, tool use, planning…
- Agentic AI Design Patterns — Agentic AI design patterns for systems already in production — what to ship, what to observe, what to budget, what to gate. Augmented LLM,…
- AI Agent Design Patterns — How to build an AI agent: the named shapes you reach for during design and implementation — reasoning (ReAct, plan-and-execute, reflection)…
- Agent Design Patterns — Agent design patterns treat the agent loop as a software-engineering primitive: an observe→reason→act cycle wrapped in tools, memory, super…
- Agentic Patterns — A complete pattern language for agentic systems, organised in Alexander-style books across reasoning, planning, tool use, retrieval, verifi…
- Agentic AI Architecture — How to structure agentic AI: the architectural patterns that hold an LLM-powered system together. Supervisor, orchestrator-workers, augment…
- RAG Agent Patterns — Patterns for building retrieval-augmented generation agents: naive RAG, agentic RAG, hybrid search, cross-encoder reranking, contextual ret…
- AI Agent Safety Patterns — Safety patterns for LLM agents: step budget, kill switch, constitutional charter, approval queue, sandbox isolation, input/output guardrail…
About this catalog
The Agent Patterns Catalog is an open, GoF-formal reference of 562 design patterns for building LLM agents. Each pattern is decomposed in the manner of Christopher Alexander (1977) and the Gang of Four (1994). Source of truth at github.com/agentpatternscatalog/patterns — CC BY 4.0.