← 返回
未分类 中文

Pilot Task Parallel

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 agg...
将任务分发给多个代理并合并结果。适用场景:1. 需要将独立工作分配给多个代理;2. 希望汇总各代理的结果。
teoslayer
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 436
下载
💾 0
安装
1
版本
#latest

概述

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+.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 07:39 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Pilot Verify

teoslayer
在与其他 Pilot 协议节点交互前,先验证代理身份和信誉。使用场景:1. 在信任某代理前需要验证其身份...
★ 0 📥 432

Pilot Api Gateway

teoslayer
将本地 API 暴露到 Pilot 协议网络。适用场景:1. 需要向远程 Pilot 代理暴露本地 API;2. 想提供 API 访问。
★ 0 📥 440

Pilot Network Map

teoslayer
可视化网络拓扑、信任图和延迟。在需要生成网络拓扑图或邻接矩阵,或可视化信任图时使用此技能。
★ 0 📥 448