agent-orchestration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Orchestration
Agent 编排
Comprehensive patterns for building and coordinating AI agents -- from single-agent reasoning loops to multi-agent systems and framework selection. Each category has individual rule files in loaded on-demand.
rules/构建和协调AI Agent的综合模式——从单Agent推理循环到多Agent系统及框架选择。每个类别在目录下都有独立的规则文件,可按需加载。
rules/Quick Reference
快速参考
| Category | Rules | Impact | When to Use |
|---|---|---|---|
| Agent Loops | 2 | HIGH | ReAct reasoning, plan-and-execute, self-correction |
| Multi-Agent Coordination | 3 | CRITICAL | Supervisor routing, agent debate, result synthesis |
| Alternative Frameworks | 3 | HIGH | CrewAI crews, AutoGen teams, framework comparison |
| Multi-Scenario | 2 | MEDIUM | Parallel scenario orchestration, difficulty routing |
Total: 10 rules across 4 categories
Quick Start
快速开始
python
undefinedpython
undefinedReAct agent loop
ReAct agent loop
async def react_loop(question: str, tools: dict, max_steps: int = 10) -> str:
history = REACT_PROMPT.format(tools=list(tools.keys()), question=question)
for step in range(max_steps):
response = await llm.chat([{"role": "user", "content": history}])
if "Final Answer:" in response.content:
return response.content.split("Final Answer:")[-1].strip()
if "Action:" in response.content:
action = parse_action(response.content)
result = await toolsaction.name
history += f"\nObservation: {result}\n"
return "Max steps reached without answer"
```pythonasync def react_loop(question: str, tools: dict, max_steps: int = 10) -> str:
history = REACT_PROMPT.format(tools=list(tools.keys()), question=question)
for step in range(max_steps):
response = await llm.chat([{"role": "user", "content": history}])
if "Final Answer:" in response.content:
return response.content.split("Final Answer:")[-1].strip()
if "Action:" in response.content:
action = parse_action(response.content)
result = await toolsaction.name
history += f"\nObservation: {result}\n"
return "Max steps reached without answer"
```pythonSupervisor with fan-out/fan-in
Supervisor with fan-out/fan-in
async def multi_agent_analysis(content: str) -> dict:
agents = [("security", security_agent), ("perf", perf_agent)]
tasks = [agent(content) for _, agent in agents]
results = await asyncio.gather(*tasks, return_exceptions=True)
return await synthesize_findings(results)
undefinedasync def multi_agent_analysis(content: str) -> dict:
agents = [("security", security_agent), ("perf", perf_agent)]
tasks = [agent(content) for _, agent in agents]
results = await asyncio.gather(*tasks, return_exceptions=True)
return await synthesize_findings(results)
undefinedAgent Loops
Agent循环
Patterns for autonomous LLM reasoning: ReAct (Reasoning + Acting), Plan-and-Execute with replanning, self-correction loops, and sliding-window memory management.
Key decisions: Max steps 5-15, temperature 0.3-0.7, memory window 10-20 messages.
自主大语言模型推理模式:ReAct(推理+行动)、带重规划的规划执行、自我修正循环,以及滑动窗口内存管理。
关键决策: 最大步骤数5-15,温度值0.3-0.7,内存窗口10-20条消息。
Multi-Agent Coordination
多Agent协作
Fan-out/fan-in parallelism, supervisor routing with dependency ordering, conflict resolution (confidence-based or LLM arbitration), result synthesis, and CC Agent Teams (mesh topology for peer messaging in CC 2.1.33+).
Key decisions: 3-8 specialists, parallelize independent agents, use Task tool (star) for simple work, Agent Teams (mesh) for cross-cutting concerns.
扇出/扇入并行处理、带依赖排序的监督者路由、冲突解决(基于置信度或大语言模型仲裁)、结果合成,以及CC Agent Teams(CC 2.1.33+版本中用于对等消息传递的网状拓扑)。
关键决策: 3-8个专业Agent,并行运行独立Agent,简单任务使用Task工具(星型拓扑),跨领域问题使用Agent Teams(网状拓扑)。
Alternative Frameworks
替代框架
CrewAI hierarchical crews with Flows (1.8+), OpenAI Agents SDK handoffs and guardrails (0.7.0), Microsoft Agent Framework (AutoGen + SK merger), GPT-5.2-Codex for long-horizon coding, and AG2 for open-source flexibility.
Key decisions: Match framework to team expertise + use case. LangGraph for state machines, CrewAI for role-based teams, OpenAI SDK for handoff workflows, MS Agent for enterprise compliance.
带Flows的CrewAI分层团队(1.8+版本)、带交接和防护机制的OpenAI Agents SDK(0.7.0版本)、Microsoft Agent Framework(AutoGen与SK的合并框架)、用于长周期编码的GPT-5.2-Codex,以及具备开源灵活性的AG2。
关键决策: 框架选择需匹配团队技术栈及使用场景。状态机选LangGraph,角色型团队选CrewAI,交接工作流选OpenAI SDK,企业合规场景选MS Agent。
Multi-Scenario
多场景
Orchestrate a single skill across 3 parallel scenarios (simple/medium/complex) with progressive difficulty scaling (1x/3x/8x), milestone synchronization, and cross-scenario result aggregation.
Key decisions: Free-running with checkpoints, always 3 scenarios, 1x/3x/8x exponential scaling, 30s/90s/300s time budgets.
在3个并行场景(简单/中等/复杂)中编排单一技能,采用渐进式难度缩放(1x/3x/8x)、里程碑同步以及跨场景结果聚合。
关键决策: 带检查点的自由运行模式,固定3个场景,1x/3x/8x指数级缩放,时间预算分别为30秒/90秒/300秒。
Key Decisions
关键决策汇总
| Decision | Recommendation |
|---|---|
| Single vs multi-agent | Single for focused tasks, multi for decomposable work |
| Max loop steps | 5-15 (prevent infinite loops) |
| Agent count | 3-8 specialists per workflow |
| Framework | Match to team expertise + use case |
| Topology | Task tool (star) for simple; Agent Teams (mesh) for complex |
| Scenario count | Always 3: simple, medium, complex |
| 决策项 | 推荐方案 |
|---|---|
| 单Agent vs 多Agent | 聚焦型任务用单Agent,可分解工作用多Agent |
| 最大循环步骤数 | 5-15(防止无限循环) |
| Agent数量 | 每个工作流3-8个专业Agent |
| 框架选择 | 匹配团队技术栈及使用场景 |
| 拓扑结构 | 简单任务用Task工具(星型),复杂任务用Agent Teams(网状) |
| 场景数量 | 固定3个:简单、中等、复杂 |
Common Mistakes
常见误区
- No step limit in agent loops (infinite loops)
- No memory management (context overflow)
- No error isolation in multi-agent (one failure crashes all)
- Missing synthesis step (raw agent outputs not useful)
- Mixing frameworks in one project (complexity explosion)
- Using Agent Teams for simple sequential work (use Task tool)
- Sequential instead of parallel scenarios (defeats purpose)
- Agent循环未设置步骤限制(导致无限循环)
- 未进行内存管理(上下文溢出)
- 多Agent系统未做错误隔离(单个Agent故障导致整体崩溃)
- 缺失结果合成步骤(原始Agent输出无实用价值)
- 单个项目混合使用多种框架(复杂度激增)
- 简单顺序任务使用Agent Teams(应使用Task工具)
- 场景串行执行而非并行(失去意义)
Related Skills
相关技能
- - LangGraph workflow patterns (supervisor, routing, state)
langgraph - - Tool definitions and execution
function-calling - - Task management with Agent Teams workflow
task-dependency-patterns
- - LangGraph工作流模式(监督者、路由、状态)
langgraph - - 工具定义与执行
function-calling - - 基于Agent Teams工作流的任务管理
task-dependency-patterns
Capability Details
能力细节
react-loop
react-loop
Keywords: react, reason, act, observe, loop, agent
Solves:
- Implement ReAct pattern
- Create reasoning loops
- Build iterative agents
关键词: react, reason, act, observe, loop, agent
解决问题:
- 实现ReAct模式
- 创建推理循环
- 构建迭代式Agent
plan-execute
plan-execute
Keywords: plan, execute, replan, multi-step, autonomous
Solves:
- Create plan then execute steps
- Implement replanning on failure
- Build goal-oriented agents
关键词: plan, execute, replan, multi-step, autonomous
解决问题:
- 创建规划并执行步骤
- 实现失败时的重规划
- 构建目标导向型Agent
supervisor-coordination
supervisor-coordination
Keywords: supervisor, route, coordinate, fan-out, fan-in, parallel
Solves:
- Route tasks to specialized agents
- Run agents in parallel
- Aggregate multi-agent results
关键词: supervisor, route, coordinate, fan-out, fan-in, parallel
解决问题:
- 将任务路由到专业Agent
- 并行运行Agent
- 聚合多Agent结果
agent-debate
agent-debate
Keywords: debate, conflict, resolution, arbitration, consensus
Solves:
- Resolve agent disagreements
- Implement LLM arbitration
- Handle conflicting outputs
关键词: debate, conflict, resolution, arbitration, consensus
解决问题:
- 解决Agent分歧
- 实现大语言模型仲裁
- 处理冲突输出
result-synthesis
result-synthesis
Keywords: synthesize, combine, aggregate, merge, summary
Solves:
- Combine outputs from multiple agents
- Create executive summaries
- Score confidence across findings
关键词: synthesize, combine, aggregate, merge, summary
解决问题:
- 合并多Agent输出
- 生成执行摘要
- 跨结果置信度评分
crewai-patterns
crewai-patterns
Keywords: crewai, crew, hierarchical, delegation, role-based, flows
Solves:
- Build role-based agent teams
- Implement hierarchical coordination
- Use Flows for event-driven orchestration
关键词: crewai, crew, hierarchical, delegation, role-based, flows
解决问题:
- 构建角色型Agent团队
- 实现分层协作
- 使用Flows进行事件驱动编排
autogen-patterns
autogen-patterns
Keywords: autogen, microsoft, agent framework, teams, enterprise, a2a
Solves:
- Build enterprise agent systems
- Use AutoGen/SK merged framework
- Implement A2A protocol
关键词: autogen, microsoft, agent framework, teams, enterprise, a2a
解决问题:
- 构建企业级Agent系统
- 使用AutoGen/SK合并框架
- 实现A2A协议
framework-selection
framework-selection
Keywords: choose, compare, framework, decision, which, crewai, autogen, openai
Solves:
- Select appropriate framework
- Compare framework capabilities
- Match framework to requirements
关键词: choose, compare, framework, decision, which, crewai, autogen, openai
解决问题:
- 选择合适的框架
- 对比框架能力
- 匹配框架与需求
scenario-orchestrator
scenario-orchestrator
Keywords: scenario, parallel, fan-out, difficulty, progressive, demo
Solves:
- Run skill across multiple difficulty levels
- Implement parallel scenario execution
- Aggregate cross-scenario results
关键词: scenario, parallel, fan-out, difficulty, progressive, demo
解决问题:
- 跨多难度级别运行技能
- 实现并行场景执行
- 聚合跨场景结果
scenario-routing
scenario-routing
Keywords: route, synchronize, milestone, checkpoint, scaling
Solves:
- Route tasks by difficulty level
- Synchronize at milestones
- Scale inputs progressively
关键词: route, synchronize, milestone, checkpoint, scaling
解决问题:
- 按难度级别路由任务
- 里程碑同步
- 渐进式输入缩放