8.3 Harness中的多智能体编排实现
8.3.1 Harness中的状态机驱动编排
状态机中的子智能体创建
# orchestration.yaml
states:
research:
type: agent_invoke
agent: ResearchAgent
config:
system_prompt: "You are a research specialist..."
max_tokens: 4000
tools: [search_web, fetch_document]
timeout: 300
on_success: synthesis
on_failure: retry_research
synthesis:
type: agent_invoke
agent: SynthesisAgent
config:
system_prompt: "You are a synthesis expert..."
input_from: research # 自动将research的结果作为输入
timeout: 200
on_success: implementation
implementation:
type: agent_invoke
agent: ImplementationAgent
config:
system_prompt: "Execute the plan step by step..."
parallel_workers: 3 # 可以并发创建3个子工作者
timeout: 600
on_success: verification
verification:
type: agent_invoke
agent: VerificationAgent
config:
system_prompt: "Verify the implementation results..."
on_success: done
on_failure: request_revision状态机中的消息路由
8.3.2 消息路由与错误传播
8.3.3 状态机中的上下文隔离
8.3.4 多Agent 专化架构与GAN式反馈循环
三角色专化架构模式
GAN式反馈循环的质量保证
专化角色的效果数据
指标
单Agent (20分钟, $9)
多Agent (6小时, $200)
改进
8.3.5 工作流的并发执行与资源管理
8.3.6 本小节小结
最后更新于
