自动化

完成等待点

仅完成 event 等待点,payload 上限 32 KiB 且须满足等待条件。

仅完成 event 等待点,payload 上限 32 KiB 且须满足等待条件;timer 与 child 不支持手动完成。相同 id 与相同 payload 重放返回 replayed=true,其他重复提交返回 WAIT_ALREADY_RESOLVED,超时返回 WAIT_EXPIRED。

POST /automation/v1/runs/{id}/waits/{wait_id}/complete

鉴权

Authorization: Bearer $PRAXIS_API_KEY

请求字段

参数类型说明
path: idstring必填;运行 ID(run_)。
path: wait_idstring必填;该运行下的等待点 ID(wait_)。

application/json

不接受额外字段。

字段类型说明
idstring可选;可选事件去重 ID;同一等待点重复提交相同 ID 和 payload 返回 replayed=true。
payloadnull / string / number / boolean / object / null / string / number / boolean / object / JSON[][]必填 / 必有;事件数据,JSON 编码最多 32 KiB;必须满足等待点的过滤条件。
payload(分支5).*(分支5)object递归 JSON 值。
payload(分支5).*(分支6)[]null / string / number / boolean / object / JSON[]递归 JSON 值。
payload(分支6)[](分支5).*null / string / number / boolean / object / JSON[]递归 JSON 值。
payload(分支6)[](分支6)[]null / string / number / boolean / object / JSON[]递归 JSON 值。

示例

先设置以下环境变量,使用你自己的资源:

: "${RUN_ID:?Set RUN_ID}"
: "${WAIT_ID:?Set WAIT_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/waits/${WAIT_ID}/complete" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "payload": {
    "answer": 42
  }
}'
import { createAutomationClient } from '@deepractice-ai/praxis-sdk/automation';

function env(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
}
const automation = createAutomationClient({
  apiKey: env('PRAXIS_API_KEY'),
  baseUrl: 'https://api.deepraxis.ai',
  maxRetries: 0,
  timeoutMs: 90_000,
});
const result = await automation.runs.waits.complete({
  "path": {
    "id": env("RUN_ID"),
    "wait_id": env("WAIT_ID")
  },
  "body": {
    "payload": {
      "answer": 42
    }
  }
});
console.log(result);

响应

HTTP 200

Success

application/json

字段类型说明
idstring必填 / 必有;等待点 ID,前缀 wait_。
run_idstring必填 / 必有;所属运行 ID(run_ 前缀)。
kind"event" / "timer" / "child"必填 / 必有;等待类型。event 等待外部事件;timer 等待到点;child 等待子运行;本接口只对 event 有效。
state"cancelled" / "open" / "resolved" / "expired"必填 / 必有;完成后的等待点状态。open 仍在等待;resolved 已被满足;expired 已到期;cancelled 已取消。成功提交的事件使其变为 resolved。
tasknull / object必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。
task(分支2).referencestring必填 / 必有;步骤的 JSON Pointer。
task(分支2).namestring必填 / 必有;步骤名,即工作流 YAML 中的键。
resume_atnull / string必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。
event_typenull / string必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。
child_run_idnull / string必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。
created_atstring必填 / 必有;等待点创建时间(RFC 3339 UTC)。
expires_atnull / string必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。
resolved_atnull / string必填 / 必有;等待点被满足的时间(RFC 3339 UTC)。
replayedboolean必填 / 必有;true 表示这是对同一 id 且相同 payload 的重复提交,返回的是原结果而不是再次处理。

实测响应

HTTP 200

{
  "id": "wait_wf-eebc9ef34869206fa1bcc1e2ae6375990a7ab34c5ad485ac98a4f189c4b37346",
  "run_id": "run_00mv67mkw52c7fa90cc9649b1053e66fd836b071f289acb667ff8ca853e65bc4608e9a45bd",
  "kind": "event",
  "state": "resolved",
  "task": {
    "reference": "/do/0/ready",
    "name": "ready"
  },
  "resume_at": null,
  "event_type": "ready",
  "child_run_id": null,
  "created_at": "2026-10-13T04:57:56.982Z",
  "expires_at": "2026-10-14T04:57:50.405Z",
  "resolved_at": "2026-10-13T04:58:03.972Z",
  "replayed": false
}

错误码

HTTP错误码与说明
400INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。
404RUN_NOT_FOUND:运行不存在或当前租户不可见。 WAIT_NOT_FOUND:运行中不存在该等待点。
409OPERATION_NOT_SUPPORTED:该资源类型不支持此操作。 WAIT_ALREADY_RESOLVED:等待点已关闭,或重复事件与原提交不同。
410WAIT_EXPIRED:等待点已超过到期时间。
413PAYLOAD_TOO_LARGE:请求内容超过本操作允许的大小。
defaultRFC 9457 automation problem. 429 includes Retry-After.

鉴权错误与通用错误 · 排查时保留响应头 X-Request-Id。

导出

本页内容