代理模式
一个完整的代理系统模式语言,按照亚历山大风格的书籍组织,涵盖推理、规划、工具使用、检索、验证、多代理、路由、安全和治理。一个名称,一个形状,一个可辩护的承诺。
本网站的其他指南专注于单一角度(代理循环、多代理协调、RAG、安全),而“代理模式”是整个词汇的总称。当一个模式假设系统本身决定下一步做什么时,它就是代理的;该目录收集了每一个这样的决策形状,并将其整理成一种语言。
该语言按照亚历山大风格的书籍组织 — 每个关注点一本:推理、规划和控制流、工具使用和环境、检索、验证和反思、多代理协调、路由和组合、安全和控制、治理和可观察性。以下选择是每本书中的一个经典模式,因此本页作为语言的地图,而不是代理循环原语的重新列出。打开专门的指南以获取更深入的信息。
每个模式都是GoF分解的:意图、上下文、问题、力量、因此、解决方案、后果(好处 + 负担)、约束(严格禁止)、相关[]。约束槽是代理时代的补充;它是保持模式命名的原因,即使在存在可以绕过任何经验法则的生成器的情况下。
Field-tested patterns to start with
- ReAct — Interleave a single thought, a single tool call, and a single observation per step so the agent reasons over fresh evidence.
- Plan-and-Execute — Plan all the steps once with a strong model, then execute each step with a cheaper model under the plan.
- Tool Use — Let the LLM produce typed calls against an external toolkit instead of producing free-form text the surrounding system has to parse.
- Agentic RAG — Replace static retrieve-then-generate with autonomous agents that plan, choose sources, retrieve iteratively, reflect, and re-query.
- Agent-as-a-Judge — Evaluate an agent's full trajectory (steps, tool calls, intermediate states) by another agent rather than scoring only the final output.
- Supervisor — Place a coordinating agent above a set of specialised agents and route work to them.
- Handoff — Transfer the active conversation from one agent to another, carrying context across the switch.
- Step Budget — Cap the number of tool calls or loop iterations the agent is allowed within a single request.
- Decision Log — Persist the agent's reasoning trace alongside its actions so post-hoc review can explain why.
Recommended reading
- Reasoning — 20 patterns
- Planning & Control Flow — 45 patterns
- Tool Use & Environment — 51 patterns
- Retrieval & RAG — 23 patterns
- Verification & Reflection — 32 patterns
- Multi-Agent — 50 patterns
- Routing & Composition — 26 patterns
- Safety & Control — 72 patterns
- Governance & Observability — 47 patterns
Or open the full contents for all 565 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 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…
- Multi-Agent Patterns — Patterns for coordinating multiple LLM agents: supervisor, orchestrator-workers, handoff, debate, hierarchical agents, swarm, role assignme…
- 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 565 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.