360 Secure SkillHub
360 安全技能中心

Pilot Task Parallel

核心功能是将无顺序依赖的任务扇出至多代理并行执行,完成后合并结果以缩短总耗时。典型场景如分布式GPU图像处理等批量独立任务。需依赖Pilot协议技能、pilotctl工具及运行的守护进程,通过Bash命令提交任务、等待完成并合并JSON格式结果,不适用于有顺序依赖或单任务场景。

teoslayer
teoslayer
热度 47.38
最近更新 2026-05-11 17:41:40
分类:自动化依赖:代码执行 / 第三方 API应用场景:工作流 / 任务管理 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pilot-task-parallel
Metadata
name
pilot-task-parallel
description
Fan-out tasks to multiple agents and merge results. Use this skill when: 1. You need to distribute independent work across multiple agents 2. You want to aggregate results from parallel task execution 3. You need to reduce execution time through parallelization Do NOT use this skill when: - Tasks have sequential dependencies (use pilot-task-chain) - You only need to run a single task - Order of execution matters for correctness
tags
["pilot-protocol","task-workflow","parallel","fan-out"]
license
AGPL-3.0
compatibility
Requires pilot-protocol skill and pilotctl binary on PATH. The daemon must be running (pilotctl daemon start).
metadata
{"author":"vulture-labs","version":"1.0","openclaw":{"requires":{"bins":["pilotctl"]},"homepage":"https://pilotprotocol.network"}}
allowed-tools
["Bash"]

pilot-task-parallel

Fan-out tasks to multiple agents for parallel execution and merge results.

Commands

Submit multiple tasks in parallel

for AGENT in "${AGENTS[@]}"; do
  pilotctl --json task submit "$AGENT" --task "Compute task batch" &
done
wait

Wait for all completions

while true; do
  ALL_DONE=true
  for TASK_ID in "${TASK_IDS[@]}"; do
    STATUS=$(pilotctl --json task list --type submitted | jq -r ".[] | select(.task_id == \"$TASK_ID\") | .status")
    [ "$STATUS" != "completed" ] && [ "$STATUS" != "failed" ] && ALL_DONE=false && break
  done
  [ "$ALL_DONE" == true ] && break
  sleep 2
done

Merge results

pilotctl --json task list --type submitted | \
  jq -r "[.[] | select(.task_id | IN(\"${TASK_IDS[@]}\")) | select(.status == \"completed\") | .result]"

Workflow Example

Distribute image processing across GPU agents:

#!/bin/bash
GPU_AGENTS=$(pilotctl --json peers --search "gpu" | jq -r '.[].address')
AGENT_ARRAY=($GPU_AGENTS)

TASK_IDS=()
for i in {1..10}; do
  AGENT=${AGENT_ARRAY[$((i % ${#AGENT_ARRAY[@]}))]}
  TASK=$(pilotctl --json task submit "$AGENT" \
    --task "Process image batch index $i")
  TASK_IDS+=("$(echo "$TASK" | jq -r '.task_id')")
done

# Wait for all tasks
while true; do
  ALL_DONE=true
  for TASK_ID in "${TASK_IDS[@]}"; do
    STATUS=$(pilotctl --json task list --type submitted | \
      jq -r ".[] | select(.task_id == \"$TASK_ID\") | .status")
    [ "$STATUS" != "completed" ] && [ "$STATUS" != "failed" ] && ALL_DONE=false && break
  done
  [ "$ALL_DONE" == true ] && break
  sleep 2
done

echo "All tasks completed"

Dependencies

Requires pilot-protocol skill, jq, and Bash 4.0+.