awesome-agentic-patterns-catalog
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAwesome Agentic Patterns Catalog
优秀智能体AI模式目录
Skill by ara.so — AI Agent Skills collection.
This skill provides comprehensive knowledge of agentic AI patterns — production-ready architectural patterns, workflows, and techniques for building autonomous and semi-autonomous AI agents. The Awesome Agentic Patterns catalog curates real-world patterns with traceability to implementations, papers, and production use cases.
由ara.so提供的技能 — AI Agent技能合集。
本技能提供关于智能体AI模式的全面知识——用于构建自主和半自主AI Agent的可落地架构模式、工作流及技术。优秀智能体AI模式目录收录了真实场景下的模式,并附带实现方案、论文及生产用例的溯源链接。
What is Awesome Agentic Patterns?
什么是优秀智能体AI模式?
A curated catalogue of repeatable patterns that help AI agents sense, reason, and act effectively in production environments. Each pattern is:
- Repeatable — proven by multiple teams
- Agent-centric — improves agent capabilities
- Traceable — backed by public references (blogs, papers, repos)
Website: https://agentic-patterns.com
Repository: https://github.com/nibzard/awesome-agentic-patterns
Repository: https://github.com/nibzard/awesome-agentic-patterns
这是一个经过筛选的可复用模式合集,帮助AI Agent在生产环境中高效感知、推理和行动。每个模式具备以下特点:
- 可复用 — 已被多个团队验证
- 以Agent为中心 — 提升Agent能力
- 可溯源 — 有公开参考资料支撑(博客、论文、代码仓库)
Pattern Categories
模式分类
The catalog organizes patterns into 8 core categories:
- Context & Memory — Managing agent state, memory, and context windows
- Feedback Loops — Self-improvement, reflection, and iterative refinement
- Learning & Adaptation — Skill evolution and reinforcement learning
- Orchestration & Control — Task decomposition, multi-agent coordination
- Reliability & Eval — Testing, monitoring, and fault tolerance
- Security & Safety — Sandboxing, PII protection, guardrails
- Tool Use & Environment — Interacting with shells, browsers, databases
- UX & Collaboration — Human-agent interaction patterns
目录将模式分为8个核心类别:
- 上下文与记忆 — 管理Agent状态、记忆和上下文窗口
- 反馈循环 — 自我改进、反思和迭代优化
- 学习与适配 — 技能演进和强化学习
- 编排与控制 — 任务分解、多Agent协作
- 可靠性与评估 — 测试、监控和容错
- 安全与防护 — 沙箱隔离、PII保护、防护机制
- 工具使用与环境交互 — 与Shell、浏览器、数据库交互
- 用户体验与协作 — 人机交互模式
Installation & Access
安装与访问
Browse Online
在线浏览
The primary way to explore patterns is via the website:
bash
undefined探索模式的主要方式是通过官网:
bash
undefinedVisit the interactive pattern explorer
访问交互式模式探索器
Features available on the website:
- **Pattern Explorer**: Filter by category, complexity, status
- **Compare Tool**: Side-by-side pattern comparison
- **Decision Explorer**: Interactive pattern selection guide
- **Graph Visualization**: Pattern relationship mapping
- **Pattern Packs**: Curated collections for common architectures
官网提供的功能:
- **模式探索器**:按类别、复杂度、状态筛选
- **对比工具**:模式并排对比
- **决策探索器**:交互式模式选择指南
- **图形可视化**:模式关系映射
- **模式包**:针对常见架构的精选合集Clone Repository
克隆代码仓库
bash
git clone https://github.com/nibzard/awesome-agentic-patterns.git
cd awesome-agentic-patternsbash
git clone https://github.com/nibzard/awesome-agentic-patterns.git
cd awesome-agentic-patternsRepository Structure
仓库结构
awesome-agentic-patterns/
├── patterns/ # Individual pattern markdown files
│ ├── context-window-auto-compaction.md
│ ├── reflection.md
│ ├── plan-then-execute-pattern.md
│ └── ...
├── apps/
│ └── web/ # Astro-based website source
├── README.md # Main catalog listing
└── LICENSEawesome-agentic-patterns/
├── patterns/ # 单个模式的Markdown文件
│ ├── context-window-auto-compaction.md
│ ├── reflection.md
│ ├── plan-then-execute-pattern.md
│ └── ...
├── apps/
│ └── web/ # 基于Astro的官网源码
├── README.md # 主目录列表
└── LICENSEKey Patterns Overview
核心模式概述
Context & Memory Patterns
上下文与记忆模式
Curated Code Context Window
- Dynamically select relevant code files for LLM context
- Use semantic search or dependency analysis
- Example: Pass only modified files + their direct dependencies
Prompt Caching via Exact Prefix Preservation
- Structure prompts so static context (system, docs) comes first
- Cache LLM processing of unchanged prefix
- Reduces latency and cost for iterative workflows
Episodic Memory Retrieval & Injection
- Store past interactions in vector DB
- Retrieve relevant episodes based on current task
- Inject as context to maintain coherence across sessions
Working Memory via TodoWrite
- Agents maintain explicit TODO lists in files
- Track progress, next steps, and blockers
- Provides persistence across crashes/restarts
精选代码上下文窗口
- 为LLM动态选择相关代码文件作为上下文
- 使用语义搜索或依赖分析
- 示例:仅传递修改后的文件及其直接依赖
通过精确前缀保留实现提示词缓存
- 结构化提示词,让静态上下文(系统提示、文档)放在最前面
- 缓存未修改前缀的LLM处理结果
- 减少迭代工作流的延迟和成本
情景记忆检索与注入
- 将过往交互存储在向量数据库中
- 根据当前任务检索相关情景
- 注入上下文以保持会话间的连贯性
基于TodoWrite的工作记忆
- Agent在文件中维护明确的待办事项列表
- 跟踪进度、下一步计划和障碍
- 在崩溃/重启后仍能保持状态
Feedback Loop Patterns
反馈循环模式
Reflection Loop
- Agent reviews its own output before finalizing
- Self-critique → revise → validate cycle
- Example workflow:
1. Generate initial solution 2. Critique: "Does this handle edge case X?" 3. Revise based on critique 4. Validate against requirements
Coding Agent CI Feedback Loop
- Agent commits code → CI runs → agent reads failures → agent fixes
- Automated self-healing for test failures
- Example integration:
python
while not tests_pass: run_tests() if failures: agent.analyze_failures(test_output) agent.generate_fix() commit_and_retry()
Self-Critique Evaluator Loop
- Separate evaluator agent assesses worker agent output
- Worker iterates based on evaluator feedback
- Prevents over-fitting to single perspective
反思循环
- Agent在最终输出前自我审查
- 自我批判 → 修改 → 验证的循环
- 示例工作流:
1. 生成初始解决方案 2. 批判:“是否处理了边缘情况X?” 3. 根据批判修改方案 4. 对照需求验证
编码Agent CI反馈循环
- Agent提交代码 → CI运行 → Agent读取失败信息 → Agent修复问题
- 针对测试失败的自动自愈
- 示例集成:
python
while not tests_pass: run_tests() if failures: agent.analyze_failures(test_output) agent.generate_fix() commit_and_retry()
自我批判评估器循环
- 独立的评估器Agent评估工作Agent的输出
- 工作Agent根据评估器反馈迭代优化
- 避免单一视角导致的过拟合
Orchestration & Control Patterns
编排与控制模式
Plan-Then-Execute Pattern
- Decompose complex task into explicit plan
- Execute steps sequentially with validation
- Update plan based on execution results
python
undefined先规划后执行模式
- 将复杂任务分解为明确的计划
- 按顺序执行步骤并验证
- 根据执行结果更新计划
python
undefinedConceptual implementation
概念性实现
def plan_then_execute(task):
plan = planner_llm.generate_plan(task)
results = []
for step in plan.steps:
result = executor.execute(step)
if result.needs_replanning:
plan = planner_llm.replan(task, results, step)
results.append(result)
return synthesize(results)
**Sub-Agent Spawning**
- Main agent delegates subtasks to specialized sub-agents
- Each sub-agent has focused tools and context
- Results aggregated by parent agent
**Dual LLM Pattern**
- Use different models for different tasks
- Fast/cheap model for simple decisions
- Powerful model for complex reasoning
- Example: GPT-4o-mini for routing, GPT-4 for generationdef plan_then_execute(task):
plan = planner_llm.generate_plan(task)
results = []
for step in plan.steps:
result = executor.execute(step)
if result.needs_replanning:
plan = planner_llm.replan(task, results, step)
results.append(result)
return synthesize(results)
**子Agent生成**
- 主Agent将子任务委托给专业的子Agent
- 每个子Agent拥有专属工具和上下文
- 结果由父Agent汇总
**双LLM模式**
- 针对不同任务使用不同模型
- 快速/低成本模型用于简单决策
- 高性能模型用于复杂推理
- 示例:GPT-4o-mini用于路由,GPT-4用于生成Tool Use Patterns
工具使用模式
Tool Selection Guide
- Provide LLM with explicit decision tree for tool selection
- Include when to use each tool, expected inputs/outputs
- Reduces tool misuse and hallucination
markdown
Tool Selection Guide:
- search_code(query): When user asks "where is X defined"
- run_tests(path): After code changes, before commit
- read_file(path): When context about specific file needed
- edit_file(path, instructions): To modify existing codeConditional Parallel Tool Execution
- Execute independent tools concurrently
- Reduce latency for multi-step operations
- Example: Search docs + search code + check tests in parallel
工具选择指南
- 为LLM提供明确的工具选择决策树
- 包含每个工具的使用场景、预期输入/输出
- 减少工具误用和幻觉
markdown
工具选择指南:
- search_code(query): 当用户询问“X定义在哪里”时使用
- run_tests(path): 代码修改后、提交前使用
- read_file(path): 需要特定文件上下文时使用
- edit_file(path, instructions): 修改现有代码时使用条件并行工具执行
- 并行执行独立工具
- 减少多步骤操作的延迟
- 示例:并行搜索文档、搜索代码、检查测试
Reliability Patterns
可靠性模式
Agent Circuit Breaker
- Track failure rate of agent actions
- Open circuit (disable agent) after threshold
- Fallback to human or simpler system
python
class AgentCircuitBreaker:
def __init__(self, failure_threshold=5):
self.failures = 0
self.threshold = failure_threshold
self.state = "closed" # closed, open, half-open
def call(self, agent_fn, *args):
if self.state == "open":
raise CircuitOpenError("Too many failures")
try:
result = agent_fn(*args)
self.on_success()
return result
except Exception as e:
self.on_failure()
raise
def on_failure(self):
self.failures += 1
if self.failures >= self.threshold:
self.state = "open"LLM Observability
- Log all prompts, completions, tool calls
- Track latency, token usage, costs
- Essential for debugging and optimization
Agent断路器
- 跟踪Agent操作的失败率
- 达到阈值后断开电路(禁用Agent)
- 回退到人工或更简单的系统
python
class AgentCircuitBreaker:
def __init__(self, failure_threshold=5):
self.failures = 0
self.threshold = failure_threshold
self.state = "closed" # closed, open, half-open
def call(self, agent_fn, *args):
if self.state == "open":
raise CircuitOpenError("Too many failures")
try:
result = agent_fn(*args)
self.on_success()
return result
except Exception as e:
self.on_failure()
raise
def on_failure(self):
self.failures += 1
if self.failures >= self.threshold:
self.state = "open"LLM可观测性
- 记录所有提示词、补全内容、工具调用
- 跟踪延迟、令牌使用量、成本
- 对调试和优化至关重要
Using Patterns in Agent Development
在Agent开发中使用模式
Pattern Selection Process
模式选择流程
-
Identify your agent's core challenge
- Memory/context limits → Context & Memory patterns
- Quality issues → Feedback Loop patterns
- Complex multi-step tasks → Orchestration patterns
- Reliability concerns → Reliability & Eval patterns
-
Review pattern prerequisites
- Check if pattern requires specific infrastructure
- Assess complexity vs. benefit trade-off
-
Start simple, iterate
- Implement minimal version first
- Add sophistication based on real failures
-
识别Agent的核心挑战
- 记忆/上下文限制 → 上下文与记忆模式
- 质量问题 → 反馈循环模式
- 复杂多步骤任务 → 编排模式
- 可靠性问题 → 可靠性与评估模式
-
检查模式先决条件
- 确认模式是否需要特定基础设施
- 评估复杂度与收益的权衡
-
从简单开始,逐步迭代
- 先实现最小版本
- 根据实际失败情况增加复杂度
Example: Building a Code Review Agent
示例:构建代码审查Agent
python
undefinedpython
undefinedCombining multiple patterns
组合多种模式
from typing import List, Dict
class CodeReviewAgent:
"""
Combines:
- Curated Code Context Window (Context & Memory)
- Reflection Loop (Feedback)
- Tool Selection Guide (Tool Use)
"""
def __init__(self, llm, code_retriever):
self.llm = llm
self.retriever = code_retriever
self.tool_guide = self._load_tool_guide()
def review_pr(self, pr_diff: str) -> Dict:
# 1. Curated Context: Fetch relevant files
context_files = self.retriever.get_relevant_context(
pr_diff,
max_files=10
)
# 2. Initial review with tool guide
initial_review = self.llm.generate(
prompt=f"""
{self.tool_guide}
Review this PR diff:
{pr_diff}
Context files:
{context_files}
Use available tools to verify claims.
""",
tools=["run_tests", "search_similar_code", "check_style"]
)
# 3. Reflection loop: Self-critique
critique = self.llm.generate(
prompt=f"""
Review this code review for:
- Are all concerns valid?
- Any false positives?
- Missing critical issues?
Review: {initial_review}
"""
)
# 4. Final review incorporating critique
final_review = self.llm.generate(
prompt=f"""
Original review: {initial_review}
Self-critique: {critique}
Produce final review addressing critique points.
"""
)
return {
"review": final_review,
"context_used": context_files,
"critique": critique
}
def _load_tool_guide(self) -> str:
return """
Tool Selection for Code Review:
- run_tests(test_path): If PR touches test files or claims fix
- search_similar_code(pattern): To find similar patterns/bugs
- check_style(file_path): For style/lint violations
- get_git_history(file): For understanding change context
"""undefinedfrom typing import List, Dict
class CodeReviewAgent:
"""
组合以下模式:
- 精选代码上下文窗口(上下文与记忆)
- 反思循环(反馈)
- 工具选择指南(工具使用)
"""
def __init__(self, llm, code_retriever):
self.llm = llm
self.retriever = code_retriever
self.tool_guide = self._load_tool_guide()
def review_pr(self, pr_diff: str) -> Dict:
# 1. 精选上下文:获取相关文件
context_files = self.retriever.get_relevant_context(
pr_diff,
max_files=10
)
# 2. 结合工具指南进行初始审查
initial_review = self.llm.generate(
prompt=f"""
{self.tool_guide}
审查此PR差异:
{pr_diff}
上下文文件:
{context_files}
使用可用工具验证相关声明。
""",
tools=["run_tests", "search_similar_code", "check_style"]
)
# 3. 反思循环:自我批判
critique = self.llm.generate(
prompt=f"""
审查此代码审查内容,检查:
- 所有问题是否有效?
- 是否存在误报?
- 是否遗漏了关键问题?
审查内容:{initial_review}
"""
)
# 4. 结合批判结果生成最终审查
final_review = self.llm.generate(
prompt=f"""
原始审查:{initial_review}
自我批判:{critique}
生成解决批判要点的最终审查。
"""
)
return {
"review": final_review,
"context_used": context_files,
"critique": critique
}
def _load_tool_guide(self) -> str:
return """
代码审查工具选择指南:
- run_tests(test_path): 如果PR涉及测试文件或声明修复了问题
- search_similar_code(pattern): 查找相似模式/漏洞
- check_style(file_path): 检查风格/语法违规
- get_git_history(file): 理解变更上下文
"""undefinedExample: Multi-Agent Research Assistant
示例:多Agent研究助手
python
undefinedpython
undefinedImplementing Planner-Worker Separation + Sub-Agent Spawning
实现规划者-工作者分离 + 子Agent生成
class ResearchOrchestrator:
"""
Patterns:
- Planner-Worker Separation
- Sub-Agent Spawning
- Plan-Then-Execute
"""
def __init__(self, planner_llm, worker_llm):
self.planner = planner_llm
self.worker = worker_llm
async def research(self, query: str) -> Dict:
# 1. Planner creates research plan
plan = self.planner.generate(
prompt=f"""
Create research plan for: {query}
Output as JSON with steps:
[
{{"type": "search", "query": "...", "sources": [...]}},
{{"type": "analyze", "focus": "..."}},
{{"type": "synthesize", "format": "..."}}
]
"""
)
# 2. Spawn sub-agents for parallel search
search_tasks = [
step for step in plan if step["type"] == "search"
]
search_results = await asyncio.gather(*[
self._spawn_search_agent(task)
for task in search_tasks
])
# 3. Worker agent analyzes results
analysis = self.worker.generate(
prompt=f"""
Analyze these search results for: {query}
Results: {search_results}
Focus: {[s['focus'] for s in plan if s['type'] == 'analyze']}
"""
)
# 4. Synthesize final report
report = self.worker.generate(
prompt=f"""
Synthesize research report:
Query: {query}
Analysis: {analysis}
Format: {plan[-1]['format']}
"""
)
return {
"report": report,
"sources": search_results,
"plan_used": plan
}
async def _spawn_search_agent(self, task: Dict):
"""Dedicated sub-agent for single search task"""
agent = SearchAgent(self.worker, sources=task["sources"])
return await agent.search(task["query"])undefinedclass ResearchOrchestrator:
"""
使用的模式:
- 规划者-工作者分离
- 子Agent生成
- 先规划后执行
"""
def __init__(self, planner_llm, worker_llm):
self.planner = planner_llm
self.worker = worker_llm
async def research(self, query: str) -> Dict:
# 1. 规划者创建研究计划
plan = self.planner.generate(
prompt=f"""
为以下查询创建研究计划:{query}
以JSON格式输出步骤:
[
{{"type": "search", "query": "...", "sources": [...]}},
{{"type": "analyze", "focus": "..."}},
{{"type": "synthesize", "format": "..."}}
]
"""
)
# 2. 生成子Agent并行执行搜索任务
search_tasks = [
step for step in plan if step["type"] == "search"
]
search_results = await asyncio.gather(*[
self._spawn_search_agent(task)
for task in search_tasks
])
# 3. 工作者Agent分析结果
analysis = self.worker.generate(
prompt=f"""
针对以下查询分析这些搜索结果:{query}
结果:{search_results}
重点:{[s['focus'] for s in plan if s['type'] == 'analyze']}
"""
)
# 4. 合成最终报告
report = self.worker.generate(
prompt=f"""
合成研究报告:
查询:{query}
分析:{analysis}
格式:{plan[-1]['format']}
"""
)
return {
"report": report,
"sources": search_results,
"plan_used": plan
}
async def _spawn_search_agent(self, task: Dict):
"""用于单个搜索任务的专用子Agent"""
agent = SearchAgent(self.worker, sources=task["sources"])
return await agent.search(task["query"])undefinedCommon Pattern Combinations
常见模式组合
Autonomous Coding Agent Stack
自主编码Agent栈
1. Curated Code Context Window (manage context size)
2. Plan-Then-Execute (break down complex changes)
3. Coding Agent CI Feedback Loop (validate changes)
4. Reflection Loop (self-review before commit)
5. Agent Circuit Breaker (prevent infinite loops)1. 精选代码上下文窗口(管理上下文大小)
2. 先规划后执行(分解复杂变更)
3. 编码Agent CI反馈循环(验证变更)
4. 反思循环(提交前自我审查)
5. Agent断路器(防止无限循环)Long-Running Agent Architecture
长期运行Agent架构
1. Filesystem-Based Agent State (persist state)
2. Working Memory via TodoWrite (track progress)
3. Planner-Worker Separation (long-term planning)
4. Signal-Driven Agent Activation (efficient wake-up)
5. LLM Observability (monitor over time)1. 基于文件系统的Agent状态(持久化状态)
2. 基于TodoWrite的工作记忆(跟踪进度)
3. 规划者-工作者分离(长期规划)
4. 信号驱动的Agent激活(高效唤醒)
5. LLM可观测性(长期监控)Multi-Agent System
多Agent系统
1. Declarative Multi-Agent Topology (define structure)
2. Economic Value Signaling (coordinate via incentives)
3. Sub-Agent Spawning (dynamic creation)
4. Opponent Processor (debate for quality)
5. Cross-Cycle Consensus Relay (agreement protocol)1. 声明式多Agent拓扑(定义结构)
2. 经济价值信号(通过激励协作)
3. 子Agent生成(动态创建)
4. 对手处理器(通过辩论提升质量)
5. 跨周期共识中继(协议达成一致)Troubleshooting & Best Practices
故障排查与最佳实践
Context Window Issues
上下文窗口问题
Problem: Agent loses track of earlier conversation
Solutions:
- Apply Context Window Auto-Compaction: Summarize old context
- Use Episodic Memory Retrieval: Store + retrieve relevant history
- Implement Progressive Disclosure: Only show needed details
- Try Prompt Caching: Preserve expensive prefix computation
问题:Agent丢失对话早期内容
解决方案:
- 应用上下文窗口自动压缩:总结旧上下文
- 使用情景记忆检索:存储并检索相关历史
- 实现渐进式披露:仅展示必要细节
- 尝试提示词缓存:保留昂贵的前缀计算结果
Reliability Issues
可靠性问题
Problem: Agent produces inconsistent results
Solutions:
- Add Reflection Loop: Self-review catches errors
- Implement Agent Circuit Breaker: Prevent cascading failures
- Use LLM Observability: Log everything to debug
- Apply Failover-Aware Model Fallback: Backup models
问题:Agent输出结果不一致
解决方案:
- 添加反思循环:自我审查发现错误
- 实现Agent断路器:防止级联故障
- 使用LLM可观测性:记录所有内容用于调试
- 应用故障感知模型回退:备用模型
Tool Misuse
工具误用
Problem: Agent uses wrong tools or hallucinates tool calls
Solutions:
- Provide Tool Selection Guide: Explicit decision rules
- Use Tool Capability Compartmentalization: Limit tool access per task
- Implement Tool Use Incentivization: Reward correct usage
- Apply Conditional Parallel Tool Execution: Validate before executing
问题:Agent使用错误工具或幻觉工具调用
解决方案:
- 提供工具选择指南:明确决策规则
- 使用工具能力划分:按任务限制工具访问权限
- 实现工具使用激励:奖励正确使用
- 应用条件并行工具执行:执行前验证
Planning Failures
规划失败
Problem: Agent creates poor plans or gets stuck
Solutions:
- Apply Plan-Then-Execute Pattern: Separate planning from execution
- Use Tree-of-Thought Reasoning: Explore multiple plans
- Implement Explicit Posterior-Sampling Planner: Probabilistic planning
- Try Language Agent Tree Search (LATS): Search plan space
问题:Agent制定的计划质量差或陷入停滞
解决方案:
- 应用先规划后执行模式:将规划与执行分离
- 使用思维链推理:探索多个计划
- 实现显式后验采样规划器:概率性规划
- 尝试语言Agent树搜索(LATS):搜索计划空间
Contributing Patterns
贡献模式
To add a new pattern to the catalog:
- Validate it's repeatable: Used by 2+ teams/projects
- Document traceability: Link to blog, paper, or repo
- Create pattern file:
patterns/your-pattern-name.md - Follow template structure:
markdown
# Pattern Name ## Problem What challenge does this solve? ## Solution How does the pattern work? ## Implementation Code examples, architecture diagrams ## References - [Source 1](url) - [Source 2](url) - Submit PR: https://github.com/nibzard/awesome-agentic-patterns
要向目录添加新模式:
- 验证可复用性:已被2个及以上团队/项目使用
- 记录溯源信息:链接到博客、论文或代码仓库
- 创建模式文件:
patterns/your-pattern-name.md - 遵循模板结构:
markdown
# 模式名称 ## 问题 解决什么挑战? ## 解决方案 模式如何工作? ## 实现 代码示例、架构图 ## 参考资料 - [来源1](url) - [来源2](url) - 提交PR:https://github.com/nibzard/awesome-agentic-patterns
Resources
资源
- Website: https://agentic-patterns.com
- GitHub: https://github.com/nibzard/awesome-agentic-patterns
- License: Apache-2.0
- Pattern Explorer: Filter 50+ patterns by category, complexity
- Decision Tool: Interactive guide for pattern selection
- Graph View: Visual pattern relationships
- 官网: https://agentic-patterns.com
- GitHub: https://github.com/nibzard/awesome-agentic-patterns
- 许可证: Apache-2.0
- 模式探索器: 按类别、复杂度筛选50+种模式
- 决策工具: 交互式模式选择指南
- 图形视图: 可视化模式关系
Advanced Usage
高级用法
Pattern Selection Matrix
模式选择矩阵
| Your Challenge | Primary Pattern | Supporting Patterns |
|---|---|---|
| Exceeding context limits | Curated Code Context Window | Prompt Caching, Progressive Disclosure |
| Low quality outputs | Reflection Loop | Self-Critique Evaluator, CriticGPT |
| Complex multi-step tasks | Plan-Then-Execute | Sub-Agent Spawning, Tree-of-Thought |
| Unreliable behavior | Agent Circuit Breaker | LLM Observability, Failover Fallback |
| Tool confusion | Tool Selection Guide | Tool Compartmentalization |
| Multi-agent coordination | Declarative Topology | Economic Value Signaling |
| 你的挑战 | 核心模式 | 辅助模式 |
|---|---|---|
| 超出上下文限制 | 精选代码上下文窗口 | 提示词缓存、渐进式披露 |
| 输出质量低 | 反思循环 | 自我批判评估器、CriticGPT |
| 复杂多步骤任务 | 先规划后执行 | 子Agent生成、思维链 |
| 行为不可靠 | Agent断路器 | LLM可观测性、故障回退 |
| 工具混淆 | 工具选择指南 | 工具能力划分 |
| 多Agent协作 | 声明式拓扑 | 经济价值信号 |
Pattern Anti-Patterns
模式反模式
Don't:
- Stack too many patterns initially (start simple)
- Use orchestration patterns for simple tasks (overhead)
- Skip observability (you'll regret it)
- Ignore context window limits (use memory patterns)
- Over-engineer before proving need (iterate)
Do:
- Measure before optimizing (observability first)
- Start with single-agent patterns (orchestrate later)
- Document why you chose each pattern (maintainability)
- Test patterns in isolation (debug complexity)
- Review catalog regularly (patterns evolve)
This skill provides comprehensive knowledge of production-ready agentic patterns. Use the website's interactive tools for pattern discovery and the repository examples for implementation guidance.
不要:
- 初始阶段堆叠过多模式(从简单开始)
- 对简单任务使用编排模式(增加开销)
- 跳过可观测性(事后会后悔)
- 忽略上下文窗口限制(使用记忆模式)
- 在证明需求前过度设计(逐步迭代)
要:
- 优化前先测量(先做可观测性)
- 从单Agent模式开始(后续再编排)
- 记录选择每个模式的原因(便于维护)
- 单独测试模式(降低调试复杂度)
- 定期查看目录(模式会演进)
本技能提供全面的可落地智能体AI模式知识。使用官网的交互式工具发现模式,参考仓库中的示例进行实现。