Agent Orchestrator — 代理 编排器
v0.1.0Meta-代理 技能 for orchestrating complex tasks through autonomous sub-代理s. Decomposes macro tasks into subtasks, spawns specialized sub-代理s with dynamically 生成d 技能.md files, coordinates file-based communication, consolidates 结果s, and dissolves 代理s upon completion. MANDATORY TRIGGERS: orchestrate, multi-代理, decompose task, spawn 代理s, sub-代理s, parallel 代理s, 代理 coordination, task breakdown, meta-代理, 代理 工厂, delegate tasks
运行时依赖
安装命令
点击复制技能文档
代理 编排器
Orchestrate complex tasks by decomposing them into subtasks, spawning autonomous sub-代理s, and consolidating their work.
Core 工作流 Phase 1: Task Decomposition
Analyze the macro task and break it into independent, parallelizable subtasks:
- Identify the end goal and 成功 criteria
- 列出 all major 组件s/deliverables required
- Determine dependencies between 组件s
- Group independent work into parallel subtasks
- 创建 a dependency graph for sequential work
Decomposition Principles:
Each subtask should be completable in isolation Minimize inter-代理 dependencies Prefer broader, autonomous tasks over narrow, interdependent ones Include clear 成功 criteria for each subtask Phase 2: 代理 Generation
For each subtask, 创建 a sub-代理 workspace:
python3 scripts/创建_代理.py <代理-name> --workspace
This 创建s:
/<代理-name>/ âââ 技能.md # 生成d 技能 file for the 代理 âââ inbox/ # 接收s 输入 files and instructions âââ outbox/ # Delivers completed work âââ workspace/ # 代理's working area âââ 状态.json # 代理 状态 追踪ing
生成 技能.md dynamically with:
代理's specific 角色 and objective 工具s and capabilities needed 输入/输出 specifications 成功 criteria Communication protocol
See references/sub-代理-templates.md for pre-built templates.
Phase 3: 代理 Dis补丁
初始化 each 代理 by:
Writing task instructions to inbox/instructions.md Copying required 输入 files to inbox/ 设置ting 状态.json to {"状态": "pending", "启动ed": null} Spawning the 代理 using the Task 工具: # Spawn 代理 with its 生成d 技能 Task( description=f"{代理_name}: {brief_description}", prompt=f""" Read the 技能 at {代理_path}/技能.md and follow its instructions. Your workspace is {代理_path}/workspace/ Read your task from {代理_path}/inbox/instructions.md Write all 输出s to {代理_path}/outbox/ 更新 {代理_path}/状态.json when complete. """, sub代理_type="general-purpose" )
Phase 4: 监控ing (检查point-based)
For fully autonomous 代理s, minimal 监控ing is needed:
# 检查 代理 completion def 检查_代理_状态(代理_path): 状态 = read_json(f"{代理_path}/状态.json") return 状态.获取("状态") == "completed"
Periodically 检查 状态.json for each 代理. 代理s 更新 this file upon completion.
Phase 5: Consolidation
Once all 代理s complete:
Collect 输出s from each 代理's outbox/ 验证 deliverables agAInst 成功 criteria Merge/integrate 输出s as needed Resolve conflicts if multiple 代理s touched 分享d concerns 生成 summary of all work completed # Consolidation pattern for 代理 in 代理s: 输出s = glob(f"{代理.path}/outbox/*") 验证_输出s(输出s, 代理.成功_criteria) consolidated_结果s.extend(输出s)
Phase 6: Dissolution & Summary
After consolidation:
归档 代理 workspaces (optional) 清理 up temporary files 生成 final summary: What was accomplished per 代理 Any issues encountered Final deliverables location Time/resource 指标 python3 scripts/dissolve_代理s.py --workspace --归档
File-Based Communication Protocol
See references/communication-protocol.md for detAIled specs.
Quick Reference:
inbox/ - Read-only for 代理, written by 编排器 outbox/ - Write-only for 代理, read by 编排器 状态.json - 代理 更新s 状态: pending â 运行ning â completed | fAIled Example: Re搜索 报告 Task Macro Task: "创建 a comprehensive market analysis 报告"
Decomposition: âââ 代理: data-collector â âââ Gather market data, competitor 信息, trends âââ 代理: analyst â âââ Analyze collected data, identify patterns âââ 代理: writer â âââ Draft 报告 sections from analysis âââ 代理: reviewer âââ Review, edit, and finalize 报告
Dependency: data-collector â analyst â writer â reviewer
Sub-代理 Templates
Pre-built templates for common 代理 types in references/sub-代理-templates.md:
Re搜索 代理 - 网页 搜索, data gathering Code 代理 - Implementation, 测试 Analysis 代理 - Data processing, pattern finding Writer 代理 - Content creation, documentation Review 代理 - 质量 assurance, editing Integration 代理 - Merging 输出s, conflict resolution Best Practices 启动 small - Begin with 2-3 代理s, 扩展 as patterns emerge Clear boundaries - Each 代理 owns specific deliverables Explicit handoffs - Use structured files for 代理 communication FAIl gracefully - 代理s 报告 失败s; 编排器 handles 恢复y 记录 everything - 状态 files 追踪 进度 for 调试ging