← 返回
未分类 中文

Pilot Workflow

YAML-defined multi-step workflows with orchestration. Use this skill when: 1. You need complex multi-step workflows with conditional logic 2. You want declar...
YAML定义的多步骤工作流及编排。适用场景:1. 需要带有条件逻辑的复杂多步骤工作流;2. 需要声明式配置管理。
teoslayer teoslayer 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 347
下载
💾 0
安装
1
版本
#latest

概述

pilot-workflow

YAML-defined multi-step workflows with advanced orchestration capabilities. Enables declarative workflow specifications with conditional branching, loops, parallel execution, and event-driven triggers.

Commands

Define workflow YAML

name: data-pipeline
version: 1.0

triggers:
  - type: schedule
    cron: "0 */6 * * *"

steps:
  - id: fetch
    agent: tag:api-gateway
    task: "Fetch data from https://api.example.com/data"

  - id: validate
    depends_on: fetch
    agent: tag:validator
    task: "Validate data structure and integrity"

  - id: transform
    depends_on: validate
    condition: "${validate.result.valid} == true"
    agent: tag:etl
    task: "Transform data to parquet format"

Execute workflow

./pilot-workflow-engine.sh workflow.yaml

Monitor workflow

pilotctl --json task list --type submitted | \
  jq -r '.[] | select(.metadata.workflow_id == "data-pipeline-001")'

Workflow Example

Complete workflow engine:

#!/bin/bash
# Pilot workflow engine - execute YAML-defined workflows

WORKFLOW_FILE=$1
WORKFLOW_NAME=$(yq eval '.name' "$WORKFLOW_FILE")
WORKFLOW_ID="${WORKFLOW_NAME}-$(date +%s)"
STEP_COUNT=$(yq eval '.steps | length' "$WORKFLOW_FILE")

echo "Workflow: $WORKFLOW_NAME ($STEP_COUNT steps)"

declare -A STEP_RESULTS
declare -A STEP_STATUS

# Execute each step
for ((STEP_IDX=0; STEP_IDX<STEP_COUNT; STEP_IDX++)); do
  STEP=$(yq eval ".steps[$STEP_IDX]" "$WORKFLOW_FILE")

  STEP_ID=$(echo "$STEP" | yq eval '.id' -)
  STEP_AGENT=$(echo "$STEP" | yq eval '.agent' -)
  STEP_TASK=$(echo "$STEP" | yq eval '.task' -)

  echo "Step $((STEP_IDX + 1)): $STEP_ID"

  # Find agent by tag
  if [[ $STEP_AGENT == tag:* ]]; then
    TAG=$(echo "$STEP_AGENT" | cut -d: -f2)
    AGENT=$(pilotctl --json peers --search "$TAG" | \
      jq -r 'sort_by(-.polo_score) | .[0].address')
  else
    AGENT="$STEP_AGENT"
  fi

  # Submit task
  TASK_RESULT=$(pilotctl --json task submit "$AGENT" --task "$STEP_TASK")

  TASK_ID=$(echo "$TASK_RESULT" | jq -r '.task_id')

  # Wait for completion
  while true; do
    STATUS=$(pilotctl --json task list --type submitted | \
      jq -r ".[] | select(.task_id == \"$TASK_ID\") | .status")

    if [ "$STATUS" == "completed" ]; then
      STEP_STATUS[$STEP_ID]="completed"
      RESULT=$(pilotctl --json task list --type submitted | \
        jq -r ".[] | select(.task_id == \"$TASK_ID\") | .result")
      STEP_RESULTS[$STEP_ID]="$RESULT"
      break
    fi
    sleep 2
  done
done

echo "Workflow completed: $WORKFLOW_ID"

Dependencies

Requires pilot-protocol skill with running daemon, jq for JSON parsing, yq for YAML parsing (brew install yq), and Bash 4.0+ for associative arrays.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 16:49 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 871 📥 349,518
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,171 📥 943,476
it-ops-security

Pilot Priority Queue

teoslayer
基于Pilot协议网络的优先级消息传递,支持紧急程度级别。适用场景:1. 需要处理带优先级的紧急消息...
★ 0 📥 558