name: agentica-spawn description: 生成 Agentica 多智能体模式 user-invocable: false
Agentica 生成技能
在用户选择 Agentica 模式后使用此技能。
何时使用
- 在 agentica-orchestrator 提示用户选择模式后
- 当用户明确请求多智能体模式时(如群集、分层等)
- 当实施复杂任务,受益于并行智能体执行时
- 对于需要多个视角的研究任务(使用群集)
- 对于需要协调的实施任务(使用分层)
- 对于迭代优化(使用生成器/批评者)
- 对于高风险的验证(使用陪审团)
模式选择到生成方法
群集(研究/探索)
swarm = Swarm(
perspectives=[
"安全专家分析漏洞",
"性能专家优化速度",
"架构专家审查设计"
],
aggregate_mode=AggregateMode.MERGE,
)
result = await swarm.execute(task_description)
分层(构建/实施)
hierarchical = Hierarchical(
coordinator_premise="你负责将任务分解为子任务",
specialist_premises={
"planner": "你创建实施计划",
"implementer": "你编写代码",
"reviewer": "你审查代码以发现问题"
},
)
result = await hierarchical.execute(task_description)
生成器/批评者(迭代/优化)
gc = GeneratorCritic(
generator_premise="你生成解决方案",
critic_premise="你批判并提出改进建议",
max_rounds=3,
)
result = await gc.run(task_description)
陪审团(验证/核实)
jury = Jury(
num_jurors=5,
consensus_mode=ConsensusMode.MAJORITY,
premise="你评估解决方案"
)
verdict = await jury.decide(bool, question)
环境变量
所有生成的智能体接收:
SWARM_ID: 此群集运行的唯一标识符AGENT_ROLE: 模式内的角色(协调者、专家等)PATTERN_TYPE: 运行的模式类型