这是一个 智能调度框架,包含:
复杂度路径≤ 3Executor → 直接输出4-5Executor → Reviewer → 输出> 5Planner → Executor → Reviewer → [Heal] → 输出
高复杂度指标(满足任一即提升复杂度):
复杂度等级:
text
用户输入
↓
┌─────────────────┐
│ Planner │ ← 意图识别 + 复杂度评估
│ complexity? │
└────────┬────────┘
│
┌────┴────┐
≤3 >3
│ │
▼ ▼
Executor Planner
│ ↓
│ [任务拆解]
│ ↓
│ Executor
│ (多任务)
│ ↓
│ Reviewer
│ (质量评分)
│ ↓
│ score < 70?
│ │
│ ┌────┴────┐
│ │ │
│ Yes No
│ │ │
│ ▼ ▼
│ Self-Heal 输出
│ ↓
│ 重试 < 3?
│ │
│ ┌─┴────────┐
│ │ │
│ Yes No → degraded_mode
│ │
│ └──────────→ 重试
│
└──────────────→ 输出
自动识别用户意图:
Intent关键词analysis分析、原因、为什么、分析一下generation写、生成、创建、编写coding代码、编程、写程序、开发decision选择、决定、哪个好、比较planning计划、安排、规划
json
{
"success": true,
"content": "执行结果内容",
"plan": {
"intent": "analysis | generation | ...",
"complexity": 1-10,
"tasks": [
{
"task_id": "t1",
"type": "analysis | generate | transform | validate",
"description": "任务描述",
"input": "输入内容",
"expected_output": "预期输出"
}
]
},
"metrics": {
"tokens": 1500,
"truncated": false,
"quality_score": 85,
"heal_triggered": false,
"degraded_mode": false
}
}
score ≥ 70 → 直接输出score < 70 → 触发 Self-Healdegraded_mode(降级模式)满足任一即触发自愈:
score < 70{xxx}重试次数策略说明第1次detailed_reasoning增加思考链长度第2次reverse_reasoning反向推理(从目标倒推)第3次degraded_mode降级,输出简化结果
不允许 出现以下语句:
条件分支:
当信息不足需要推断时,必须标注置信度:
text
[推断结论 · 置信度: 高/中/低 · 待数据验证]
2000 tokens(约4000字符)[已截断]所有 Agent 日志输出 JSON:
json
{
"timestamp": "2026-04-02T11:40:00+08:00",
"level": "INFO | WARNING | ERROR",
"module": "orchestrator | planner | executor | reviewer | self_heal",
"event": "事件名称",
"details": {}
}
INFO:正常流程(开始/完成/切换)WARNING:异常但未失败(占位符已填充/置信度低)ERROR:执行失败/触发自愈每次执行记录:
error_rate - 错误率output_score - 质量评分heal_trigger_count - 自愈触发次数degraded_mode_count - 降级模式次数src/orchestrator.js 包含完整的参考实现,可作为:
用户:"今天天气怎么样"
→ complexity = 3 → Executor → 直接输出
用户:"帮我分析销售下滑的原因"
→ complexity = 6 → Planner → Executor × 3 → Reviewer → [自愈] → 输出
用户:"帮我写一封道歉邮件"
→ complexity = 4 → Executor → Reviewer → 输出
本 Skill 提供工作流指导,实际执行由 AI 基于上下文判断