Guide

多智能体模式

协调多个 LLM 智能体的模式:监督者、协调者-工作者、交接、辩论、层次智能体、群体、角色分配、基于投票的合作、智能体间通信。

多智能体系统是两个或更多 LLM 智能体协调以完成单独无法完成的任务。这里的模式描述了协调所采取的重复形态:一个单一的监督者路由工作,一个协调者将任务分配给工作者,两个智能体辩论以得出更好的答案,一个群体对共享输出进行投票,一个专家层次通过已知协议进行交接。

多智能体并不自动意味着更好。几个模式命名了失败模式(无限辩论、英雄智能体、无限子智能体生成),以便你能够识别它们并选择放弃。经过实地测试的多智能体形态 — 监督者 + 协调者-工作者,监督者控制孤立的子智能体 — 正是因为这些失败模式很常见而存在。

Field-tested patterns to start with

  • SupervisorPlace a coordinating agent above a set of specialised agents and route work to them.
  • Orchestrator-WorkersAn orchestrator dynamically breaks a task into subtasks at runtime and delegates each to a worker LLM, then synthesises results.
  • HandoffTransfer the active conversation from one agent to another, carrying context across the switch.
  • DebateHave multiple agents argue different positions on a question and converge through structured exchange.
  • Hierarchical AgentsOrganise agents in a tree where higher-level agents decompose tasks for lower-level agents, recursively.
  • SwarmRun many peer agents that interact directly without a central supervisor, achieving emergent coordination.
  • Role AssignmentAssign each agent a named role (researcher, writer, critic, planner) with a role-specific prompt, tool palette, and acceptance criteria.
  • Voting-Based CooperationFinalise 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 CommunicationDefine a protocol for agents to exchange tasks, capabilities, and results across process or vendor boundaries.
  • Conversational Multi-AgentHave agents converse turn by turn until a completion criterion fires; agent roles drive the conversation forward.
  • Subagent IsolationRun subagents in isolated workspaces so their writes do not collide and parallelism is safe.
  • Agent-as-Tool EmbeddingWrap 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

Or open the full contents for all 562 patterns in 14 books.

Related guides

  • AI Agents PatternsAI agents patterns: named, reusable shapes for building AI agents that reason, use tools, coordinate, and stay safe — single-agent loops an…
  • AI Agents Patterns CatalogThe AI agents patterns catalog: a complete, GoF-formal pattern language for AI agents across reasoning, planning, tool use, retrieval, memo…
  • LLM Agent Design PatternsA GoF-formal catalog of LLM agent design patterns: ReAct, tool use, plan-and-execute, reflection, step budget, and more. Each pattern decom…
  • Agentic Design PatternsA GoF-formal catalog of agentic design patterns — named, reusable shapes for building autonomous AI agents: agent loops, tool use, planning…
  • Agentic AI Design PatternsAgentic 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 PatternsHow to build an AI agent: the named shapes you reach for during design and implementation — reasoning (ReAct, plan-and-execute, reflection)…
  • Agent Design PatternsAgent design patterns treat the agent loop as a software-engineering primitive: an observe→reason→act cycle wrapped in tools, memory, super…
  • Agentic PatternsA complete pattern language for agentic systems, organised in Alexander-style books across reasoning, planning, tool use, retrieval, verifi…
  • Agentic AI ArchitectureHow to structure agentic AI: the architectural patterns that hold an LLM-powered system together. Supervisor, orchestrator-workers, augment…
  • RAG Agent PatternsPatterns for building retrieval-augmented generation agents: naive RAG, agentic RAG, hybrid search, cross-encoder reranking, contextual ret…
  • AI Agent Safety PatternsSafety 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.

Open the contents