agentica-spawn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agentica Spawn Skill

Agentica Spawn Skill

Use this skill after user selects an Agentica pattern.
使用本技能的前提是用户已选择一种Agentica模式。

When to Use

使用场景

  • After agentica-orchestrator prompts user for pattern selection
  • When user explicitly requests a multi-agent pattern (swarm, hierarchical, etc.)
  • When implementing complex tasks that benefit from parallel agent execution
  • For research tasks requiring multiple perspectives (use Swarm)
  • For implementation tasks requiring coordination (use Hierarchical)
  • For iterative refinement (use Generator/Critic)
  • For high-stakes validation (use Jury)
  • 在agentica-orchestrator提示用户选择模式之后
  • 当用户明确请求多智能体模式时(如swarm、hierarchical等)
  • 处理可从并行智能体执行中获益的复杂任务时
  • 需要多视角的研究任务(使用Swarm模式)
  • 需要协调配合的实现任务(使用Hierarchical模式)
  • 迭代优化任务(使用Generator/Critic模式)
  • 高风险验证任务(使用Jury模式)

Pattern Selection to Spawn Method

模式选择对应生成方法

Swarm (Research/Explore)

Swarm(研究/探索)

python
swarm = Swarm(
    perspectives=[
        "Security expert analyzing for vulnerabilities",
        "Performance expert optimizing for speed",
        "Architecture expert reviewing design"
    ],
    aggregate_mode=AggregateMode.MERGE,
)
result = await swarm.execute(task_description)
python
swarm = Swarm(
    perspectives=[
        "Security expert analyzing for vulnerabilities",
        "Performance expert optimizing for speed",
        "Architecture expert reviewing design"
    ],
    aggregate_mode=AggregateMode.MERGE,
)
result = await swarm.execute(task_description)

Hierarchical (Build/Implement)

Hierarchical(构建/实现)

python
hierarchical = Hierarchical(
    coordinator_premise="You break tasks into subtasks",
    specialist_premises={
        "planner": "You create implementation plans",
        "implementer": "You write code",
        "reviewer": "You review code for issues"
    },
)
result = await hierarchical.execute(task_description)
python
hierarchical = Hierarchical(
    coordinator_premise="You break tasks into subtasks",
    specialist_premises={
        "planner": "You create implementation plans",
        "implementer": "You write code",
        "reviewer": "You review code for issues"
    },
)
result = await hierarchical.execute(task_description)

Generator/Critic (Iterate/Refine)

Generator/Critic(迭代/优化)

python
gc = GeneratorCritic(
    generator_premise="You generate solutions",
    critic_premise="You critique and suggest improvements",
    max_rounds=3,
)
result = await gc.run(task_description)
python
gc = GeneratorCritic(
    generator_premise="You generate solutions",
    critic_premise="You critique and suggest improvements",
    max_rounds=3,
)
result = await gc.run(task_description)

Jury (Validate/Verify)

Jury(验证/核查)

python
jury = Jury(
    num_jurors=5,
    consensus_mode=ConsensusMode.MAJORITY,
    premise="You evaluate the solution"
)
verdict = await jury.decide(bool, question)
python
jury = Jury(
    num_jurors=5,
    consensus_mode=ConsensusMode.MAJORITY,
    premise="You evaluate the solution"
)
verdict = await jury.decide(bool, question)

Environment Variables

环境变量

All spawned agents receive:
  • SWARM_ID
    : Unique identifier for this swarm run
  • AGENT_ROLE
    : Role within the pattern (coordinator, specialist, etc.)
  • PATTERN_TYPE
    : Which pattern is running
所有生成的智能体都会接收以下环境变量:
  • SWARM_ID
    : 本次swarm运行的唯一标识符
  • AGENT_ROLE
    : 智能体在模式中的角色(如协调者、专家等)
  • PATTERN_TYPE
    : 当前运行的模式类型