AGENT SKILL

agent-orchestrate

Multi-agent coordination and parallel execution. Covers supervisor patterns, swarm handoffs, parallel fan-out, and error recovery. Use when: "coordinate agents", "parallel agents", "orchestrate", "supervisor", "agent handoff", or when multiple agents need to work together.

License 许可
MIT
所属仓库
kalash33/kstack
最近更新
2026-05-20
Stars
★ 0
Forks
0

01 前言 Front Matter

name
agent-orchestrate
description
Multi-agent coordination and parallel execution. Covers supervisor patterns, swarm handoffs, parallel fan-out, and error recovery. Use when: "coordinate agents", "parallel agents", "orchestrate", "supervisor", "agent handoff", or when multiple agents need to work together.

03 SKILL.md 正文

/agent-orchestrate — Multi-Agent Coordinator

One agent is useful. Ten agents coordinated is transformative.

When to Use

  • Multiple agents need to work on the same task
  • Parallel execution for speed
  • Complex workflows with branching logic
  • When one agent's output feeds another's input

Orchestration Patterns

Supervisor (Hub & Spoke)

One agent decides who works on what.

Supervisor → Agent A (research)
           → Agent B (code)
           → Agent C (review)

Pipeline (Sequential)

Each agent processes and passes forward.

Input → Agent A → Agent B → Agent C → Output

Fan-out / Fan-in (Parallel)

Split work, do it simultaneously, merge results.

Input → [Agent A, Agent B, Agent C] → Merge → Output

Swarm (Peer Handoff)

Agents hand off to each other based on expertise.

Agent A: "This needs code review" → hands off to Agent B
Agent B: "This has a security issue" → hands off to Agent C

Implementation

Parallel Execution

import asyncio

async def fan_out(task, agents):
    results = await asyncio.gather(*[
        agent.run(task) for agent in agents
    ])
    return merge_results(results)

Supervisor Loop

def supervisor_loop(task):
    while not task.is_complete():
        next_agent = supervisor.decide(task.state)
        result = next_agent.run(task.current_step)
        task.update(result)
        if result.needs_human:
            task.escalate()
            break
    return task.result

Error Recovery

def resilient_orchestrate(task, agents):
    for agent in agents:
        try:
            result = agent.run(task, timeout=30)
            if result.quality_score < 0.7:
                result = fallback_agent.run(task)
            return result
        except AgentError:
            continue  # Try next agent
    raise AllAgentsFailedError(task)

Chaining

  • Before: /agent-design (architecture), /agent-build (individual agents)
  • After: /agent-eval (test the coordinated system)

04 同仓库更多 Skills