Skip to content

工作流与自动化命令

TIP

工作流定义"怎么做"——一系列步骤的编排。自动化定义"什么时候做"——触发工作流运行的条件和规则。

工作流管理

workflow:list

列出所有工作流。

参数:

参数类型必填说明
pagenumber页码,默认 1
pageSizenumber每页条数,默认 20
keywordstring搜索关键词

请求示例:

bash
workova workflow:list --input '{"page": 1, "keyword": "deploy"}'

返回示例:

json
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "wf_abc",
        "name": "deploy-pipeline",
        "version": 3,
        "description": "Production deploy workflow"
      },
      {
        "id": "wf_def",
        "name": "deploy-staging",
        "version": 1,
        "description": "Staging deploy"
      }
    ],
    "page": { "total": 2, "hasMore": false }
  }
}

workflow:get

获取工作流详情。

参数:

参数类型必填说明
workflowIdstring工作流 ID

请求示例:

bash
workova workflow:get --input '{"workflowId": "wf_abc"}'

返回示例:

json
{
  "success": true,
  "data": {
    "workflow": {
      "id": "wf_abc",
      "name": "deploy-pipeline",
      "nodes": [
        { "id": "n1", "type": "action", "label": "Build" },
        { "id": "n2", "type": "action", "label": "Test" }
      ],
      "edges": [{ "source": "n1", "target": "n2" }],
      "variables": { "env": "production" }
    }
  }
}

workflow:create

创建工作流。

参数:

参数类型必填说明
namestring工作流名称
descriptionstring工作流描述
versionstring版本号,默认 1.0.0
workflowDataobject工作流定义数据(节点、边等)

请求示例:

bash
workova workflow:create --input '{"name": "deploy-pipeline", "description": "Production deploy workflow"}'

返回示例:

json
{
  "success": true,
  "data": {
    "workflow": {
      "id": "wf_abc",
      "name": "deploy-pipeline",
      "version": 1,
      "description": "Production deploy workflow"
    }
  }
}

workflow:update

更新工作流。

参数:

参数类型必填说明
workflowIdstring工作流 ID
namestring工作流名称
descriptionstring工作流描述
versionstring版本号
workflowDataobject工作流定义数据

请求示例:

bash
workova workflow:update --input '{"workflowId": "wf_abc", "name": "deploy-pipeline-v2"}'

返回示例:

json
{
  "success": true,
  "data": {
    "workflow": {
      "id": "wf_abc",
      "name": "deploy-pipeline-v2",
      "version": 4,
      "description": "Production deploy workflow"
    }
  }
}

workflow:delete

删除工作流。

参数:

参数类型必填说明
workflowIdstring工作流 ID

请求示例:

bash
workova workflow:delete --input '{"workflowId": "wf_abc"}'

返回示例:

json
{
  "success": true,
  "data": {
    "workflowId": "wf_abc",
    "deleted": true
  }
}

workflow:export

导出工作流完整定义。

参数:

参数类型必填说明
workflowIdstring工作流 ID

请求示例:

bash
workova workflow:export --input '{"workflowId": "wf_abc"}'

返回示例:

json
{
  "success": true,
  "data": {
    "workflow": {
      "id": "wf_abc",
      "name": "deploy-pipeline",
      "version": 3,
      "nodes": [],
      "edges": [],
      "variables": {}
    }
  }
}

工作流运行

workflow-run:start

启动工作流运行。

参数:

参数类型必填说明
workflowIdstring工作流 ID
inputsobject运行时输入参数
inputFilestring从文件读取输入参数

请求示例:

bash
workova workflow-run:start --input '{"workflowId": "wf_abc", "inputs": {"url": "https://example.com"}}'

返回示例:

json
{
  "success": true,
  "data": {
    "runId": "wfr_123",
    "status": "running"
  }
}

workflow-run:events

获取运行事件流。

参数:

参数类型必填说明
runIdstring运行 ID
cursorstring分页游标

请求示例:

bash
workova workflow-run:events --input '{"runId": "wfr_123"}'

返回示例:

json
{
  "success": true,
  "data": {
    "events": [
      {
        "eventType": "node_started",
        "nodeId": "n1",
        "message": "Executing Build step"
      },
      {
        "eventType": "node_completed",
        "nodeId": "n1",
        "message": "Build succeeded"
      }
    ]
  }
}

workflow-run:snapshot

获取运行快照(当前状态)。

参数:

参数类型必填说明
runIdstring运行 ID

请求示例:

bash
workova workflow-run:snapshot --input '{"runId": "wfr_123"}'

返回示例:

json
{
  "success": true,
  "data": {
    "runId": "wfr_123",
    "status": "running",
    "currentNodeIndex": 1,
    "totalNodes": 4
  }
}

workflow-run:pause

暂停运行。

参数:

参数类型必填说明
runIdstring运行 ID

请求示例:

bash
workova workflow-run:pause --input '{"runId": "wfr_123"}'

返回示例:

json
{
  "success": true,
  "data": {
    "runId": "wfr_123",
    "status": "paused"
  }
}

workflow-run:resume

恢复运行。

参数:

参数类型必填说明
runIdstring运行 ID

请求示例:

bash
workova workflow-run:resume --input '{"runId": "wfr_123"}'

返回示例:

json
{
  "success": true,
  "data": {
    "runId": "wfr_123",
    "status": "running"
  }
}

workflow-run:cancel

取消运行(不可恢复)。

参数:

参数类型必填说明
runIdstring运行 ID

请求示例:

bash
workova workflow-run:cancel --input '{"runId": "wfr_123"}'

返回示例:

json
{
  "success": true,
  "data": {
    "runId": "wfr_123",
    "status": "cancelled"
  }
}

workflow-run:list

列出运行记录。

参数:

参数类型必填说明
statusstring按状态筛选
limitnumber返回条数,默认 50,最大 100
offsetnumber偏移量

请求示例:

bash
workova workflow-run:list --input '{"status": "running", "limit": 10}'

返回示例:

json
{
  "success": true,
  "data": {
    "items": [
      {
        "runId": "wfr_123",
        "workflowId": "wf_abc",
        "status": "running",
        "startedAt": "2026-03-30T09:00:00Z"
      }
    ],
    "page": { "total": 1, "hasMore": false }
  }
}

自动化管理

automation:list

列出所有自动化。

参数:

参数类型必填说明
userIdstring按用户 ID 筛选

请求示例:

bash
workova automation:list

返回示例:

json
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "auto_abc",
        "name": "daily-report",
        "enabled": true,
        "triggerType": "scheduled",
        "scheduleExpr": "0 9 * * 1-5",
        "actionType": "workflow"
      }
    ]
  }
}

automation:create

创建自动化。

参数:

参数类型必填说明
namestring自动化名称
triggerTypestring触发类型,可选 scheduled / notification
actionTypestring动作类型,可选 workflow / agent_session / multi_agent_session
descriptionstring描述
enabledboolean是否启用,默认 true
scheduleKindstring调度类型
scheduleExprstring调度表达式(cron 格式)
timezonestring时区
notificationSourcesstring[]通知来源列表
matcherJsonobject匹配规则
actionConfigobject动作配置
cooldownSecondsnumber冷却时间(秒),默认 0
dedupWindowSecondsnumber去重窗口(秒),默认 300

请求示例:

bash
workova automation:create --input '{"name": "daily-report", "triggerType": "scheduled", "actionType": "workflow", "scheduleExpr": "0 9 * * 1-5"}'

返回示例:

json
{
  "success": true,
  "data": {
    "trigger": {
      "id": "auto_abc",
      "name": "daily-report",
      "triggerType": "scheduled",
      "actionType": "workflow",
      "scheduleExpr": "0 9 * * 1-5",
      "enabled": true
    }
  }
}

automation:update

更新自动化。

参数:

参数类型必填说明
triggerIdstring自动化触发器 ID
namestring自动化名称
triggerTypestring触发类型
actionTypestring动作类型
descriptionstring描述
enabledboolean是否启用
scheduleKindstring调度类型
scheduleExprstring调度表达式
timezonestring时区
notificationSourcesstring[]通知来源列表
matcherJsonobject匹配规则
actionConfigobject动作配置
cooldownSecondsnumber冷却时间(秒)
dedupWindowSecondsnumber去重窗口(秒)

请求示例:

bash
workova automation:update --input '{"triggerId": "auto_abc", "scheduleExpr": "0 10 * * 1-5"}'

返回示例:

json
{
  "success": true,
  "data": {
    "trigger": {
      "id": "auto_abc",
      "name": "daily-report",
      "scheduleExpr": "0 10 * * 1-5",
      "enabled": true
    }
  }
}

automation:delete

删除自动化。

参数:

参数类型必填说明
triggerIdstring自动化触发器 ID

请求示例:

bash
workova automation:delete --input '{"triggerId": "auto_abc"}'

返回示例:

json
{
  "success": true,
  "data": {
    "triggerId": "auto_abc",
    "deleted": true
  }
}

automation:enable

启用自动化。

参数:

参数类型必填说明
triggerIdstring自动化触发器 ID

请求示例:

bash
workova automation:enable --input '{"triggerId": "auto_abc"}'

返回示例:

json
{
  "success": true,
  "data": {
    "triggerId": "auto_abc",
    "enabled": true
  }
}

automation:disable

禁用自动化。

参数:

参数类型必填说明
triggerIdstring自动化触发器 ID

请求示例:

bash
workova automation:disable --input '{"triggerId": "auto_abc"}'

返回示例:

json
{
  "success": true,
  "data": {
    "triggerId": "auto_abc",
    "enabled": false
  }
}

automation:runs

查看运行记录。

参数:

参数类型必填说明
limitnumber返回条数,默认 100,最大 200
offsetnumber偏移量

请求示例:

bash
workova automation:runs --input '{"limit": 5}'

返回示例:

json
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "arun_001",
        "triggerId": "auto_abc",
        "status": "completed",
        "startAt": "2026-03-30T09:00:00Z",
        "error": null
      },
      {
        "id": "arun_002",
        "triggerId": "auto_abc",
        "status": "failed",
        "startAt": "2026-03-29T09:00:00Z",
        "error": "Workflow timeout"
      }
    ]
  }
}

automation:process

手动触发处理。

参数:

参数类型必填说明
maxDuenumber最大处理数量,默认 20

请求示例:

bash
workova automation:process --input '{"maxDue": 10}'

返回示例:

json
{
  "success": true,
  "data": {
    "processed": 3
  }
}

WARNING

automation:process 会立即触发运行,不受自动化的启用/禁用状态影响。请谨慎使用。

典型场景

CI/CD 中执行工作流

bash
# 启动工作流并等待完成
RUN_ID=$(workova workflow-run:start --input '{"workflowId": "wf_deploy"}' | jq -r '.data.runId')

# 跟踪运行事件直到完成
workova workflow-run:events --input "{\"runId\": \"$RUN_ID\"}"

定时批量处理

创建一个每个工作日早 9 点执行的自动化:

bash
workova automation:create --input-file - << 'EOF'
{
  "name": "daily-report",
  "triggerType": "scheduled",
  "actionType": "workflow",
  "workflowId": "wf_report",
  "scheduleExpr": "0 9 * * 1-5"
}
EOF

Workova 官方文档