微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🎛️

多代理并行编排快速上手指南

Agent Orchestrate · v1.0.0
效率 安全 B 级 作者 moltenbot000 公开目录收录
1.1k 下载 0 安装 3.2k 收藏 14 浏览

简介

OpenClaw多代理协调快速参考手册,提供并行任务、扇入扇出、基础管道等简单编排模式的实现指南。

原始描述

Multi-agent orchestration patterns for OpenClaw. Quick reference for spawning sub-agents, parallel work, and basic coordination. Use when: simple parallel ta...

通过你的 Agent 添加

安装目录:agent-orchestrate/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/agent-orchestrate/
Codex CLI~/.codex/skills/agent-orchestrate/
DeepSeek Harness~/.agents/skills/agent-orchestrate/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心定位

Agent Orchestrate 是 OpenClaw 平台的多代理协调模式快速参考技能,专注于简单并行任务、扇入/扇出(fan-out/fan-in)和基础管道编排。该技能提供了 sessions_spawn、subagents list、subagents steer 等核心原语的使用指南,并区分了 Spawn(干净状态)与 Fork(继承上下文)两种子代理上下文策略。

显著优点

  1. 模式丰富实用:涵盖并行扇出(Parallel Fan-Out)、顺序管道(Pipeline)、依赖树(Dependency Tree)、人工介入(Human-in-the-Loop)、监督模式(Supervisor)等5种核心编排模式,覆盖从简单到中等复杂度的协调场景
  2. 决策清晰:提供明确的模式选择矩阵,帮助用户根据任务特性快速匹配合适的编排策略
  3. 反模式警示:明确列出轮询过密、过度并行、上下文倾倒等常见陷阱,具备工程实践价值
  4. 轻量快速:定位为"快速参考",相比 cord-trees 更易于上手,适合简单并行任务

潜在局限

  1. 非动态高级编排:明确说明复杂动态编排(代理构建任务树、spawn vs fork 深度管理)需使用 cord-trees 技能
  2. 伪代码实现:示例以概念性伪代码为主,缺乏生产级代码模板
  3. 状态管理简陋:依赖 JSON 文件手动跟踪状态,无内置状态机或持久化机制
  4. 平台绑定:专属于 OpenClaw 生态,工具原语(sessions_spawn、subagents 等)不具备跨平台通用性

适合人群

  • 需要快速实现简单多代理并行任务的 OpenClaw 用户
  • 从单代理向多代理协作过渡的初学者
  • 需要明确上下文隔离 vs 继承策略选择依据的开发者

常规风险

  • 成本失控:过度并行可能导致 token 消耗激增,技能本身提醒"更多代理≠更好"
  • 状态不一致:手动 JSON 状态管理在复杂场景下易出现竞争条件或状态漂移
  • 调试困难:子代理故障需人工设计重试/跳过/升级策略,缺乏自动故障恢复机制
  • 平台锁定风险:深度依赖 OpenClaw 特有 API,迁移成本较高

安全评估说明

安全认证报告明确标注为"系统自动生成占位,仅用于简介提取,未执行安全扫描",无法据此评估实际安全风险。

技能正文


name: agent-orchestrate description: | Multi-agent orchestration patterns for OpenClaw. Quick reference for spawning sub-agents, parallel work, and basic coordination.

Use when: simple parallel tasks, fan-out/fan-in, basic pipelines.

For advanced dynamic orchestration (agent-built task trees, spawn vs fork, human-in-the-loop), see cord-trees skill instead. version: 1.0.0 license: MIT

Agent Orchestration — Quick Reference

Simple patterns for multi-agent coordination. For advanced dynamic orchestration, see cord-trees.

Core Primitives

Tool Purpose
sessions_spawn Create isolated sub-agent with task
subagents list Check status of running agents
subagents steer Send guidance to running agent
subagents kill Terminate an agent
sessions_send Message another session

Spawn vs Fork

Two context strategies for sub-agents:

Spawn (Clean Slate)

Sub-agent gets only its task prompt. No parent context.

Use when:
- Task is self-contained
- You want isolation (no context bleed)
- Subtask doesn't need sibling results
- Cheaper/faster (smaller context)

Example: "Research competitor X" — doesn't need to know about competitors Y and Z.

Fork (Context-Inheriting)

Sub-agent receives accumulated results from siblings.

Use when:
- Synthesis/analysis across prior work
- Task builds on what others discovered
- Final integration step

Implementation: Include sibling results in the task prompt:

Task: Synthesize findings into recommendation.

Prior research:
- Competitor A: [result from agent 1]
- Competitor B: [result from agent 2]
- Market trends: [result from agent 3]

Patterns

1. Parallel Fan-Out

Spawn N independent agents, wait for all to complete.

# Pseudocode
tasks = ["research A", "research B", "research C"]
for task in tasks:
    sessions_spawn(task=task, label=f"research-{i}")

# Poll until all complete
while not all_complete(subagents list):
    wait(30s)

# Collect results from session histories

See: references/fan-out.md

2. Pipeline (Sequential)

Each agent's output feeds the next.

Agent 1: Research → 
  Agent 2: Analyze (using research) → 
    Agent 3: Write (using analysis)

Implementation: Spawn agent 1, wait for completion, spawn agent 2 with agent 1's result, etc.

See: references/pipeline.md

3. Dependency Tree

Tasks with explicit dependencies. Don't start X until Y completes.

#1 Research API surface
#2 Research GraphQL tradeoffs  
#3 Analysis (blocked-by: #1, #2)
#4 Recommendation (blocked-by: #3)

Implementation: Track state in a JSON file. Poll and spawn when dependencies clear.

See: references/dependency-tree.md

4. Human-in-the-Loop

Pause workflow for human input at checkpoints.

Agent 1: Draft proposal →
  [CHECKPOINT: Human approves/rejects] →
    Agent 2: Implement approved proposal

Implementation: Agent 1 completes, orchestrator messages human via sessions_send or channel message, waits for response before spawning agent 2.

5. Supervisor Pattern

Orchestrator monitors agents and intervenes when stuck.

while agents_running:
    status = subagents list
    for agent in status:
        if stuck_too_long(agent):
            subagents steer(target=agent, message="Try alternative approach...")
        if clearly_failed(agent):
            subagents kill(target=agent)
            # Retry or escalate

State Management

For complex orchestrations, track state in a file:

// orchestration-state.json
{
  "tasks": {
    "research-a": {"status": "complete", "result": "...", "sessionKey": "..."},
    "research-b": {"status": "running", "sessionKey": "..."},
    "synthesis": {"status": "blocked", "blockedBy": ["research-a", "research-b"]}
  }
}

Update after each spawn, completion check, or state change.

Best Practices

  1. Label agents clearly — Use descriptive labels for subagents list readability
  2. Set timeouts — Use runTimeoutSeconds to prevent runaways
  3. Don't over-parallelize — More agents ≠ better. Consider token costs.
  4. Checkpoint expensive work — Write intermediate results to files
  5. Handle failures — Decide: retry, skip, or escalate to human
  6. Keep tasks focused — One clear goal per agent. Easier to debug.

Anti-Patterns

❌ Polling in tight loops — Use reasonable intervals (30s+) ❌ Spawning agents for trivial tasks — Just do it yourself ❌ Giant context dumps — Summarize, don't copy entire histories ❌ No failure handling — Agents fail. Plan for it.

Choosing a Pattern

Situation Pattern
N independent research tasks Fan-out
Step A → Step B → Step C Pipeline
Complex task with prerequisites Dependency tree
Need human approval mid-flow Human-in-the-loop
Long-running with potential issues Supervisor
Simple one-off subtask Just spawn one agent

Quick Reference

# Spawn a sub-agent
sessions_spawn(task="Do X", label="my-task", runTimeoutSeconds=300)

# Check status
subagents(action="list")

# Send guidance
subagents(action="steer", target="my-task", message="Focus on Y instead")

# Kill runaway
subagents(action="kill", target="my-task")

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

multi-agentorchestrationparallel-computingworkflow-automationopenclawsubagentsfan-outpipeline

同类 Skill