workflow-orchestrator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorkflow Orchestrator Skill
Workflow Orchestrator Skill
Execute declarative workflow files that orchestrate multiple PopeBot agent jobs. This skill brings OpenProse-style workflow orchestration to PopeBot's job-based architecture.
执行用于编排多个PopeBot Agent任务的声明式工作流文件。该Skill将OpenProse风格的工作流编排引入PopeBot的基于任务的架构中。
When to Activate
激活场景
Activate this skill when the user:
- Wants to run multiple agent jobs in sequence or parallel
- Needs to coordinate tasks with dependencies
- Wants to create reusable automation pipelines
- Asks to run a file
.workflow - Mentions "workflow orchestration" or "multi-agent workflow"
当用户有以下需求时激活该Skill:
- 希望按顺序或并行运行多个Agent任务
- 需要协调存在依赖关系的任务
- 想要创建可复用的自动化流水线
- 请求运行文件
.workflow - 提到“工作流编排”或“多Agent工作流”
Workflow File Format
工作流文件格式
Workflows use YAML-like syntax with clear structure:
yaml
undefined工作流采用类YAML的语法,结构清晰:
yaml
undefinedExample: Code review workflow
Example: Code review workflow
name: "PR Review Pipeline"
description: "Review PR, check for bugs, suggest improvements"
inputs:
- name: pr_number required: true description: "Pull request number to review"
agents:
reviewer:
personality: |
You are a thorough code reviewer focused on security, best practices, and maintainability.
tester:
personality: |
You are a QA engineer focused on edge cases and test coverage.
documenter:
personality: |
You are a technical writer who creates clear documentation.
steps:
Sequential steps run one after another
- name: review_code
agent: reviewer
prompt: |
Review pull request #{{pr_number}} for:
- Security issues
- Code quality
- Best practices output: review_report
Parallel steps run concurrently
- name: parallel_tests
parallel:
-
name: unit_tests agent: tester prompt: "Check test coverage for PR #{{pr_number}}" output: test_report
-
name: integration_tests agent: tester prompt: "Check integration tests for PR #{{pr_number}}" output: integration_report
-
Conditional execution
- name: write_summary
agent: documenter
prompt: |
Write a PR summary based on:
- Review: {{review_report}}
- Tests: {{test_report}}
- Integration: {{integration_report}} if: "all previous steps succeeded" output: final_summary
outputs:
- review_report
- test_report
- integration_report
- final_summary
undefinedname: "PR Review Pipeline"
description: "Review PR, check for bugs, suggest improvements"
inputs:
- name: pr_number required: true description: "Pull request number to review"
agents:
reviewer:
personality: |
You are a thorough code reviewer focused on security, best practices, and maintainability.
tester:
personality: |
You are a QA engineer focused on edge cases and test coverage.
documenter:
personality: |
You are a technical writer who creates clear documentation.
steps:
Sequential steps run one after another
- name: review_code
agent: reviewer
prompt: |
Review pull request #{{pr_number}} for:
- Security issues
- Code quality
- Best practices output: review_report
Parallel steps run concurrently
- name: parallel_tests
parallel:
-
name: unit_tests agent: tester prompt: "Check test coverage for PR #{{pr_number}}" output: test_report
-
name: integration_tests agent: tester prompt: "Check integration tests for PR #{{pr_number}}" output: integration_report
-
Conditional execution
- name: write_summary
agent: documenter
prompt: |
Write a PR summary based on:
- Review: {{review_report}}
- Tests: {{test_report}}
- Integration: {{integration_report}} if: "all previous steps succeeded" output: final_summary
outputs:
- review_report
- test_report
- integration_report
- final_summary
undefinedCommands
命令
Run a Workflow
运行工作流
bash
undefinedbash
undefinedRun a local workflow file
Run a local workflow file
workflow run my-workflow.workflow
workflow run my-workflow.workflow
Run with inputs
Run with inputs
workflow run my-workflow.workflow --input pr_number=123
workflow run my-workflow.workflow --input pr_number=123
Run a remote workflow
Run a remote workflow
workflow run https://example.com/workflow.workflow
undefinedworkflow run https://example.com/workflow.workflow
undefinedCompile/Validate
编译/验证
bash
undefinedbash
undefinedValidate workflow syntax without running
Validate workflow syntax without running
workflow compile my-workflow.workflow
undefinedworkflow compile my-workflow.workflow
undefinedList Available Workflows
列出可用工作流
bash
undefinedbash
undefinedShow workflows in current directory
Show workflows in current directory
workflow list
undefinedworkflow list
undefinedExecution Model
执行模型
The workflow orchestrator:
- Parses the workflow file
- Validates syntax and required inputs
- Creates agent definitions with custom personalities
- Executes steps according to dependencies:
- Sequential steps wait for previous completion
- Parallel steps spawn multiple jobs concurrently
- Conditional steps evaluate AI-determined conditions
- Collects outputs from each step
- Reports final results
工作流编排器的执行流程:
- 解析工作流文件
- 验证语法和必填输入项
- 创建带有自定义个性的Agent定义
- 执行步骤(遵循依赖关系):
- 顺序步骤需等待前序步骤完成后再执行
- 并行步骤会同时启动多个任务
- 条件步骤会评估AI判定的条件
- 收集每个步骤的输出
- 汇报最终结果
Job Management
任务管理
Each workflow step creates a PopeBot job:
- Jobs are created in branches
job/workflow-{workflow_id}-{step_name} - Job results are stored in
/job/tmp/workflows/{workflow_id}/{step_name}/ - Failed steps can be retried individually
- Workflows can be paused for approval gates
每个工作流步骤都会创建一个PopeBot任务:
- 任务会在分支中创建
job/workflow-{workflow_id}-{step_name} - 任务结果存储在目录下
/job/tmp/workflows/{workflow_id}/{step_name}/ - 失败的步骤可单独重试
- 工作流可暂停以等待审批环节
Approval Gates
审批环节
Insert approval checkpoints in workflows:
yaml
steps:
- name: draft_email
agent: assistant
prompt: "Draft a response to the customer complaint"
output: email_draft
- name: approval_gate
type: approval
prompt: "Send this email?"
data: "{{email_draft}}"
on_approve:
- name: send_email
agent: assistant
prompt: "Send the approved email"
on_reject:
- name: revise_email
agent: assistant
prompt: "Revise the email based on feedback"可在工作流中插入审批检查点:
yaml
steps:
- name: draft_email
agent: assistant
prompt: "Draft a response to the customer complaint"
output: email_draft
- name: approval_gate
type: approval
prompt: "Send this email?"
data: "{{email_draft}}"
on_approve:
- name: send_email
agent: assistant
prompt: "Send the approved email"
on_reject:
- name: revise_email
agent: assistant
prompt: "Revise the email based on feedback"Error Handling
错误处理
yaml
steps:
- name: risky_operation
agent: assistant
prompt: "Do something that might fail"
retry:
max_attempts: 3
backoff: exponential
on_error:
- name: handle_error
agent: assistant
prompt: "Handle this error: {{error_message}}"yaml
steps:
- name: risky_operation
agent: assistant
prompt: "Do something that might fail"
retry:
max_attempts: 3
backoff: exponential
on_error:
- name: handle_error
agent: assistant
prompt: "Handle this error: {{error_message}}"Variable Substitution
变量替换
Use to reference:
{{variable_name}}- Workflow inputs:
{{pr_number}} - Step outputs:
{{review_report}} - Previous step data in parallel blocks
使用引用以下内容:
{{variable_name}}- 工作流输入项:
{{pr_number}} - 步骤输出:
{{review_report}} - 并行块中前序步骤的数据
Configuration
配置
yaml
undefinedyaml
undefinedIn config/WORKFLOWS.json (optional)
In config/WORKFLOWS.json (optional)
{
"default_timeout": 600,
"max_parallel_jobs": 5,
"workspace": "/job/tmp/workflows",
"notification_channel": "telegram"
}
undefined{
"default_timeout": 600,
"max_parallel_jobs": 5,
"workspace": "/job/tmp/workflows",
"notification_channel": "telegram"
}
undefinedExamples
示例
Multi-Agent Research
多Agent研究
yaml
name: "Research Deep Dive"
inputs:
- name: topic
required: true
steps:
- name: initial_research
parallel:
- agent: researcher
prompt: "Research {{topic}} from technical perspective"
output: tech_research
- agent: researcher
prompt: "Research {{topic}} market applications"
output: market_research
- name: synthesize
agent: analyst
prompt: |
Synthesize findings:
Technical: {{tech_research}}
Market: {{market_research}}
output: final_reportyaml
name: "Research Deep Dive"
inputs:
- name: topic
required: true
steps:
- name: initial_research
parallel:
- agent: researcher
prompt: "Research {{topic}} from technical perspective"
output: tech_research
- agent: researcher
prompt: "Research {{topic}} market applications"
output: market_research
- name: synthesize
agent: analyst
prompt: |
Synthesize findings:
Technical: {{tech_research}}
Market: {{market_research}}
output: final_reportCI/CD Pipeline
CI/CD流水线
yaml
name: "Release Pipeline"
inputs:
- name: version
required: true
steps:
- name: build
agent: builder
prompt: "Build version {{version}} and run tests"
- name: security_scan
agent: security
prompt: "Scan {{version}} for vulnerabilities"
parallel: true
- name: approval
type: approval
prompt: "Deploy version {{version}}?"
- name: deploy
agent: deployer
prompt: "Deploy {{version}} to production"
if: "**approval granted**"yaml
name: "Release Pipeline"
inputs:
- name: version
required: true
steps:
- name: build
agent: builder
prompt: "Build version {{version}} and run tests"
- name: security_scan
agent: security
prompt: "Scan {{version}} for vulnerabilities"
parallel: true
- name: approval
type: approval
prompt: "Deploy version {{version}}?"
- name: deploy
agent: deployer
prompt: "Deploy {{version}} to production"
if: "**approval granted**"State Management
状态管理
Workflow state persists in:
- - Current execution state
/job/tmp/workflows/{workflow_id}/state.json - - Individual step results
/job/tmp/workflows/{workflow_id}/steps/ - - Execution logs
/job/tmp/workflows/{workflow_id}/logs/
工作流状态持久存储在以下位置:
- - 当前执行状态
/job/tmp/workflows/{workflow_id}/state.json - - 各步骤的单独结果
/job/tmp/workflows/{workflow_id}/steps/ - - 执行日志
/job/tmp/workflows/{workflow_id}/logs/
API Integration
API集成
Workflows can be triggered via:
bash
undefined可通过以下方式触发工作流:
bash
undefinedVia PopeBot chat
Via PopeBot chat
/workflow run my-workflow.workflow
/workflow run my-workflow.workflow
Via API
Via API
curl -X POST /api/create-job
-H "x-api-key: YOUR_KEY"
-d '{"job": "workflow run my-workflow.workflow --input key=value"}'
-H "x-api-key: YOUR_KEY"
-d '{"job": "workflow run my-workflow.workflow --input key=value"}'
undefinedcurl -X POST /api/create-job
-H "x-api-key: YOUR_KEY"
-d '{"job": "workflow run my-workflow.workflow --input key=value"}'
-H "x-api-key: YOUR_KEY"
-d '{"job": "workflow run my-workflow.workflow --input key=value"}'
undefinedWhen NOT to Use
不适用场景
- Single simple tasks (use direct agent jobs)
- Tasks requiring continuous human interaction
- Real-time data processing
- Tasks under 30 seconds (overhead not justified)
- 单个简单任务(直接使用Agent任务即可)
- 需要持续人机交互的任务
- 实时数据处理任务
- 耗时不足30秒的任务(编排开销得不偿失)
File Locations
文件位置
| File | Location | Purpose |
|---|---|---|
| Skill files | Same dir as this SKILL.md | Documentation and executor |
| User workflows | Workspace | User-created workflows |
| State | | Runtime state and results |
| Config | | Global settings |
| 文件 | 位置 | 用途 |
|---|---|---|
| Skill文件 | 与本SKILL.md同目录 | 文档和执行器 |
| 用户工作流 | 工作区中的 | 用户创建的工作流 |
| 状态文件 | | 运行时状态和结果 |
| 配置文件 | | 全局设置 |