Task Orchestra
Coordinate multiple agents and tasks for complex workflows.
When to Use
- - Multi-step operations requiring coordination
- Parallel execution of independent tasks
- Complex workflows with dependencies
- Orchestrating subagents for large projects
Core Capabilities
1. Task Coordination
- - Break down complex tasks into manageable steps
- Manage dependencies between tasks
- Coordinate parallel execution
- Handle task sequencing and scheduling
2. Agent Orchestration
- - Spawn and manage multiple subagents
- Route tasks to appropriate agents
- Monitor progress and handle failures
- Aggregate results from multiple sources
3. Workflow Management
- - Define workflow patterns and templates
- Implement error handling and recovery
- Manage state and progress tracking
- Coordinate handoffs between agents
4. Dependency Resolution
- - Analyze task dependencies
- Create execution order
- Handle conditional execution
- Manage resource conflicts
Orchestration Patterns
1. Sequential Execution
CODEBLOCK0
2. Parallel Execution
CODEBLOCK1
3. Pipeline Processing
CODEBLOCK2
4. Supervisor Pattern
CODEBLOCK3
5. Event-Driven Processing
CODEBLOCK4
Quick Actions
- -
orchestrate [workflow] - Execute complex workflow - INLINECODE1 - Run tasks in parallel
- INLINECODE2 - Chain tasks in sequence
- INLINECODE3 - Manage multiple agents
- INLINECODE4 - Analyze and resolve dependencies
Usage Examples
CODEBLOCK5
Workflow Templates
Research Project
CODEBLOCK6
Content Creation
CODEBLOCK7
Software Development
CODEBLOCK8
Agent Management
Spawning Agents
CODEBLOCK9
Monitoring Progress
CODEBLOCK10
Handling Failures
CODEBLOCK11
Dependency Resolution
Types of Dependencies
- - Data Dependencies: Task B needs output from Task A
- Resource Dependencies: Tasks sharing same resources
- Order Dependencies: Tasks must run in specific order
- Conditional Dependencies: Task runs only if condition met
Resolution Process
CODEBLOCK12
Error Handling
Common Failure Scenarios
- - Agent Failure: Subagent crashes or times out
- Dependency Failure: Required task fails
- Resource Conflict: Multiple agents need same resource
- Network Issues: API calls fail or timeout
Recovery Strategies
- - Retry: Attempt failed task again
- Alternative: Use different approach or agent
- Skip: Continue without failed task
- Rollback: Undo previous steps
State Management
Progress Tracking
- - Track completed tasks
- Monitor current execution
- Record task results
- Maintain workflow state
Checkpointing
- - Save progress at key points
- Enable restart from checkpoints
- Maintain consistency across failures
Communication Patterns
Parent → Child
CODEBLOCK13
Child → Parent
CODEBLOCK14
Agent → Agent
CODEBLOCK15
Performance Optimization
Parallel Execution
- - Identify independent tasks
- Run in parallel when possible
- Aggregate results efficiently
Resource Management
- - Monitor agent resource usage
- Balance load across agents
- Avoid resource conflicts
Efficiency Metrics
- - Task completion time
- Resource utilization
- Error rates
- Success rates
Safety Considerations
Agent Limits
- - Max 10 concurrent subagents
- Max 2 levels of nesting
- 10-minute timeout per agent
- Automatic cleanup
Data Integrity
- - Validate task inputs/outputs
- Maintain consistency
- Handle partial failures
- Ensure atomic operations
Advanced Patterns
1. Hierarchical Orchestration
CODEBLOCK16
2. Dynamic Work Allocation
CODEBLOCK17
3. Event-Driven Workflows
CODEBLOCK18
4. Adaptive Planning
CODEBLOCK19
Integration with Other Skills
Self-Evolution
- - Use for complex self-improvement tasks
- Coordinate multiple evolution agents
- Manage long-term capability building
Analysis Skills
- - Orchestrate research projects
- Coordinate data analysis
- Manage multi-step investigations
Content Creation
- - Coordinate content production pipelines
- Manage multi-agent content creation
- Orchestrate publication workflows
Quick Reference
Common Commands
CODEBLOCK20
Workflow Examples
CODEBLOCK21
Best Practices
- 1. Start Simple: Begin with sequential execution
- Add Parallelism: Identify independent tasks
- Handle Failures: Implement robust error handling
- Monitor Progress: Track execution and results
- Optimize Performance: Balance load and resources
Success Metrics
- - Task completion rate
- Execution time efficiency
- Resource utilization
- Error recovery effectiveness
- Overall workflow success
Remember: Good orchestration makes complex tasks manageable and reliable.
任务编排系统
协调多个智能体和任务以完成复杂工作流程。
适用场景
- - 需要协调的多步骤操作
- 独立任务的并行执行
- 存在依赖关系的复杂工作流
- 为大型项目编排子智能体
核心能力
1. 任务协调
- - 将复杂任务分解为可管理的步骤
- 管理任务间的依赖关系
- 协调并行执行
- 处理任务排序和调度
2. 智能体编排
- - 生成并管理多个子智能体
- 将任务路由到合适的智能体
- 监控进度并处理故障
- 汇总多个来源的结果
3. 工作流管理
- - 定义工作流模式和模板
- 实现错误处理和恢复
- 管理状态和进度跟踪
- 协调智能体间的交接
4. 依赖解析
- - 分析任务依赖关系
- 创建执行顺序
- 处理条件执行
- 管理资源冲突
编排模式
1. 顺序执行
任务A → 任务B → 任务C
2. 并行执行
任务A, 任务B, 任务C → 汇总
3. 流水线处理
输入 → 任务A → 任务B → 任务C → 输出
4. 监督模式
协调器 → 多个子智能体 → 结果
5. 事件驱动处理
事件 → 触发 → 响应 → 下一个事件
快速操作
- - orchestrate [工作流] - 执行复杂工作流
- parallel [任务] - 并行运行任务
- pipeline [步骤] - 按顺序串联任务
- supervise [智能体] - 管理多个智能体
- dependencies [任务] - 分析和解决依赖关系
使用示例
使用多个智能体编排一个完整的研究项目
并行运行这些任务并合并结果
创建从研究到发布的内容创作流水线
监督处理不同方面的智能体团队
分析依赖关系并创建执行顺序
工作流模板
研究项目
- 1. 研究主题 → 研究智能体
- 数据收集 → 数据智能体
- 分析 → 分析智能体
- 报告生成 → 写作智能体
- 审核 → 质量保证智能体
内容创作
- 1. 主题研究 → 研究智能体
- 大纲创建 → 写作智能体
- 草稿写作 → 写作智能体
- 编辑 → 编辑智能体
- 发布 → 发布智能体
软件开发
- 1. 需求 → 分析智能体
- 设计 → 设计智能体
- 实现 → 编码智能体
- 测试 → 质量保证智能体
- 部署 → 部署智能体
智能体管理
生成智能体
sessions_spawn({ task: 具体任务, label: 智能体名称, mode: run })
监控进度
subagents list
处理故障
subagents kill [智能体ID]
subagents steer [智能体ID] 新指令
依赖解析
依赖类型
- - 数据依赖:任务B需要任务A的输出
- 资源依赖:任务共享相同资源
- 顺序依赖:任务必须按特定顺序运行
- 条件依赖:仅在满足条件时运行任务
解析过程
- 1. 识别所有依赖关系
- 创建依赖关系图
- 查找拓扑排序
- 按依赖顺序执行
- 处理冲突和循环
错误处理
常见故障场景
- - 智能体故障:子智能体崩溃或超时
- 依赖故障:必需任务失败
- 资源冲突:多个智能体需要相同资源
- 网络问题:API调用失败或超时
恢复策略
- - 重试:再次尝试失败的任务
- 替代:使用不同的方法或智能体
- 跳过:继续执行而不处理失败任务
- 回滚:撤销之前的步骤
状态管理
进度跟踪
- - 跟踪已完成的任务
- 监控当前执行情况
- 记录任务结果
- 维护工作流状态
检查点
- - 在关键点保存进度
- 支持从检查点重新启动
- 在故障时保持一致性
通信模式
父级 → 子级
/sessions_send [智能体ID] 指令
子级 → 父级
自动宣布结果
回复发现
报告错误和状态
智能体 → 智能体
通过文件共享数据
通过共享状态协调
触发其他智能体
性能优化
并行执行
资源管理
- - 监控智能体资源使用情况
- 平衡各智能体的负载
- 避免资源冲突
效率指标
安全考虑
智能体限制
- - 最多10个并发子智能体
- 最多2层嵌套
- 每个智能体10分钟超时
- 自动清理
数据完整性
- - 验证任务输入/输出
- 保持一致性
- 处理部分故障
- 确保原子操作
高级模式
1. 分层编排
主协调器 → 团队协调器 → 单个智能体
2. 动态工作分配
根据智能体能力分配任务
智能体失败时重新分配
动态平衡负载
3. 事件驱动工作流
事件 → 触发 → 智能体 → 结果 → 下一个事件
4. 自适应规划
规划 → 执行 → 监控 → 调整 → 重复
与其他技能的集成
自我进化
- - 用于复杂的自我改进任务
- 协调多个进化智能体
- 管理长期能力建设
分析技能
内容创作
- - 协调内容生产流水线
- 管理多智能体内容创作
- 编排发布工作流
快速参考
常用命令
bash
列出运行中的智能体
subagents list
终止失败的智能体
subagents kill [ID]
发送指令
sessions_send [智能体ID] 消息
生成新智能体
sessions_spawn({ task: 任务, label: 名称, mode: run })
工作流示例
bash
研究项目
orchestrate 研究项目 with agents: research, analysis, writing
内容流水线
pipeline 内容创作 with steps: research, outline, draft, edit, publish
软件开发
supervise 开发团队 with agents: analysis, design, coding, testing, deployment
最佳实践
- 1. 从简单开始:从顺序执行开始
- 增加并行:识别独立任务
- 处理故障:实现健壮的错误处理
- 监控进度:跟踪执行和结果
- 优化性能:平衡负载和资源
成功指标
- - 任务完成率
- 执行时间效率
- 资源利用率
- 错误恢复效果
- 整体工作流成功率
记住:良好的编排使复杂任务变得可管理和可靠。