自动化

列出运行

按创建时间倒序筛选租户内运行。

按创建时间倒序筛选租户内运行。支持状态多选、目标、来源、labels[k] 和创建时间下界筛选。q 以 run_ 开头时精确匹配运行 ID,否则按编排名称前缀匹配。大 input/output 在列表中为 null,对应 input_truncated/output_truncated 为 true;详情返回全文。

GET /automation/v1/runs

鉴权

Authorization: Bearer $PRAXIS_API_KEY

请求字段

参数类型说明
query: limitinteger可选;每页条数,整数 1–100,默认 50。 minimum: 1;maximum: 100
query: cursorstring可选;上一页返回的 next_cursor,不透明字符串;保持原查询条件继续翻页。
query: kind"script" / "workflow"[]可选;script 或 workflow;省略返回两者。 多个值以逗号分隔,匹配任一值。 minItems: 1
query: definitionstring[]可选;精确编排名,格式 ns/name。 多个值以逗号分隔,匹配任一值。 minItems: 1
query: versionstring[]可选;规范的精确语义版本,例如 1.2.0 或 1.3.0-beta.1;不能是范围。 多个值以逗号分隔,匹配任一值。 minItems: 1
query: status"pending" / "running" / "waiting" / "suspended" / "cancelled" / "faulted" / "completed"[]可选;逗号分隔的状态,可选 pending、running、waiting、suspended、cancelled、faulted、completed;省略不过滤。 多个值以逗号分隔,匹配任一值。
query: channel"console" / "api" / "internal" / "run" / "trigger"[]可选;来源渠道:run 仅子运行;console、api、internal、trigger 为根运行。多个值以逗号分隔,匹配任一值。 minItems: 1
query: initiator_type"user" / "api_key" / "agent" / "trigger"[]可选;根发起方类型:user、api_key、agent 或 trigger,子运行继承根发起方。run 返回 INPUT_INVALID;按来源筛选用 channel=run 或 parent_run_id。多个值以逗号分隔,匹配任一值。 minItems: 1
query: initiator"me"可选;仅支持 me,匹配当前凭证的主体类型和 ID,包含由我的运行派生出的子运行;省略不限制。
query: adhocboolean可选;true 仅临时运行,false 仅已发布定义的运行;省略返回两者。
query: language"ts" / "yaml"[]可选;源码语言:ts 或 yaml。 多个值以逗号分隔,匹配任一值。 minItems: 1
query: parent_run_idstring[]可选;按直接父运行 ID 精确匹配;用它列出某个运行的子运行(由工作流 run 步骤或脚本 invoke() 启动),每项含 ID、目标、状态与耗时。 多个值以逗号分隔,匹配任一值。 minItems: 1
query: root_run_idstring[]可选;按根运行 ID 精确匹配,读取同一运行树。 多个值以逗号分隔,匹配任一值。 minItems: 1
query: qstring可选;run_ 开头时精确匹配运行 ID,否则按编排名称前缀匹配;% 与 _ 作为普通字符。
query: labelsobject可选;按标签过滤,使用 labels[k]=v;同键逗号多值取任一,不同键同时满足。
query: created_at[gte]string可选;创建时间下界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time"
query: created_at[lte]string可选;创建时间上界,包含边界;使用带时区的 ISO 8601 时间。 format: "date-time"

示例

curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  --get \
  --data-urlencode "labels[name]=sample-run-1791867412840-b05e8a" \
  --data-urlencode "limit=1"
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.list({
  "query": {
    "labels": {
      "name": "sample-run-1791867412840-b05e8a"
    },
    "limit": 1
  }
});
console.log(result);

响应

HTTP 200

Success

application/json

字段类型说明
dataobject[]必填 / 必有;本页的运行摘要,按 created_at 倒序、id 倒序排列。
data[].idstring必填 / 必有;不透明运行 ID。新建非确定性 ID 为 run_ + 10 位 base36 毫秒时间前缀 + 64 位 hex DO ID,共 78 字符;旧随机 ID 为 46 字符,历史及确定性 ID 仍有效。同毫秒内不保证创建顺序。
data[].kind"script" / "workflow"必填 / 必有;编排类型。script 为 TypeScript 脚本,一次执行;workflow 为 YAML 工作流,由步骤组成,可等待事件、定时器或子运行并可暂停。
data[].numbernull / number必填 / 必有;运行在其脚本或工作流内的递增序号;临时运行为 null。
data[].definitionnull / object必填 / 必有;运行所属的脚本或工作流 {namespace, name};临时运行(直接传 source)为 null。
data[].definition(分支2).namespacestring必填 / 必有;脚本或工作流的命名空间。
data[].definition(分支2).namestring必填 / 必有;脚本或工作流的名字。
data[].targetnull / string必填 / 必有;创建时 target 参数的原文(如 acme/report@latest);临时运行为 null。
data[].resolved_versionnull / string必填 / 必有;target 解析到的精确版本号;临时运行为 null。
data[].source_digestnull / string必填 / 必有;临时运行的源码摘要,可用于读取源码;由已发布定义启动的运行为 null。
data[].language"ts" / "yaml"必填 / 必有;源码语言。ts 表示 TypeScript 脚本;yaml 表示工作流 YAML。
data[].status"running" / "completed" / "faulted" / "cancelled" / "pending" / "waiting" / "suspended"必填 / 必有;运行状态。pending 已创建尚未开始;running 执行中;waiting 工作流在等待事件、定时器或子运行;suspended 工作流被暂停;cancelled 已取消;faulted 失败,error 给出原因;completed 成功完成,output 为结果。后三种是终态。
data[].progressnull / object必填 / 必有;运行报告的最新进度 {label, current, total, updated_at};未报告为 null。
data[].progress(分支2).labelstring必填 / 必有;进度说明文字,例如当前阶段。
data[].progress(分支2).currentnull / number必填 / 必有;已完成的数量;未报告为 null。
data[].progress(分支2).totalnull / number必填 / 必有;总量;未知为 null。
data[].progress(分支2).updated_atstring必填 / 必有;进度最近一次更新的时间(RFC 3339 UTC)。
data[].current_waitnull / object必填 / 必有;运行当前未完成的等待点;不在等待为 null。
data[].current_wait(分支2).idstring必填 / 必有;等待点 ID,前缀 wait_;完成事件等待点时作为路径中的 wait_id。
data[].current_wait(分支2).run_idstring必填 / 必有;所属运行 ID(run_ 前缀)。
data[].current_wait(分支2).kind"event" / "timer" / "child"必填 / 必有;等待类型。event 等待外部事件,可通过 runs.completeWait 提交;timer 等待到达 resume_at;child 等待子运行结束。
data[].current_wait(分支2).state"cancelled" / "open" / "resolved" / "expired"必填 / 必有;等待点状态。open 仍在等待;resolved 已被满足;expired 已超过 expires_at;cancelled 已被取消,不会再被满足。
data[].current_wait(分支2).tasknull / object必填 / 必有;产生该等待的工作流步骤 {reference, name};没有对应步骤为 null。
data[].current_wait(分支2).task(分支2).referencestring必填 / 必有;步骤的 JSON Pointer,例如 /do/2/wait_payment。
data[].current_wait(分支2).task(分支2).namestring必填 / 必有;步骤名,即工作流 YAML 中的键。
data[].current_wait(分支2).resume_atnull / string必填 / 必有;kind=timer 时恢复运行的时刻(RFC 3339 UTC);其它类型为 null。
data[].current_wait(分支2).event_typenull / string必填 / 必有;kind=event 时等待的事件类型;其它类型为 null。
data[].current_wait(分支2).child_run_idnull / string必填 / 必有;kind=child 时被等待的子运行 ID;其它类型为 null。
data[].current_wait(分支2).created_atstring必填 / 必有;等待点创建时间(RFC 3339 UTC)。
data[].current_wait(分支2).expires_atnull / string必填 / 必有;等待点到期时间(RFC 3339 UTC);没有期限为 null。
data[].current_wait(分支2).resolved_atnull / string必填 / 必有;等待点被满足的时间(RFC 3339 UTC);尚未满足为 null。
data[].countersobject必填 / 必有;运行的累计计数。 不接受额外字段。
data[].counters.callsnumber必填 / 必有;脚本发出的调用总数。
data[].counters.action_callsnumber必填 / 必有;其中调用动作的次数。
data[].counters.child_runsnumber必填 / 必有;启动的子运行数。
data[].counters.tasks_completednumber必填 / 必有;工作流已完成的步骤数。
data[].counters.tasks_totalnull / number必填 / 必有;工作流顶层步骤总数;脚本运行为 null。
data[].inputnull / string / number / boolean / object / JSON[]必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。
data[].input(分支5).*null / string / number / boolean / object / JSON[]递归 JSON 值。
data[].input(分支6)[]null / string / number / boolean / object / JSON[]递归 JSON 值。
data[].outputnull / string / number / boolean / object / JSON[]必填 / 必有;任意 JSON 值:null、布尔、数字、字符串、数组或对象。
data[].output(分支5).*null / string / number / boolean / object / JSON[]递归 JSON 值。
data[].output(分支6)[]null / string / number / boolean / object / JSON[]递归 JSON 值。
data[].errornull / object必填 / 必有;运行失败(faulted)时的错误详情;未失败为 null。
data[].error(分支2).typestring必填 / 必有;平台错误类别,或工作流 raise 定义的完整 URI,原样保留。
data[].error(分支2).codenull / string必填 / 必有;稳定错误码,可按码分支处理;没有为 null。
data[].error(分支2).titlestring必填 / 必有;错误的简短标题。
data[].error(分支2).detailnull / string必填 / 必有;错误的详细说明;没有为 null。
data[].error(分支2).sourcenull / object必填 / 必有;错误发生的位置:工作流步骤或脚本调用;未知为 null。
data[].error(分支2).source(分支2).kind"call" / "task"必填 / 必有;位置类型。task 表示工作流步骤;call 表示脚本中的调用。
data[].error(分支2).source(分支2).referencestring可选;task 类型时:出错步骤的 JSON Pointer。
data[].error(分支2).source(分支2).seqnumber可选;call 类型时:出错调用的序号(与 Call.seq 对应)。
data[].error(分支2).source(分支2).actionobject可选;出错的动作 {name, revision};错误来自动作时才有。 不接受额外字段。
data[].error(分支2).source(分支2).action.namestring必填 / 必有;动作全名 ns/name。
data[].error(分支2).source(分支2).action.revisionstring必填 / 必有;执行的动作修订 ID(actr_ 前缀)。
data[].error(分支2).request_idstring / null可选;导致失败的下游响应 X-Request-Id;没有下游响应标识时为 null 或省略。
data[].error(分支2).errorsobject[]可选;逐字段校验错误;pointer 使用 RFC 6901 指向字段,detail 为中文修正说明。
data[].error(分支2).errors[].pointerstring必填 / 必有;RFC 6901 字段指针。TypeScript 源码诊断为 /source(脚本)或 /implementation/source(动作);行列另见 line/column,不拼在指针后。
data[].error(分支2).errors[].detailstring必填 / 必有;中文修正说明,指出该位置出了什么问题以及怎样改。
data[].error(分支2).errors[].hintstring可选;可选的补充提示,给出下一步可执行的动作(例如改用另一个接口)。
data[].error(分支2).errors[].lineinteger可选;行号,从 1 起;仅有源码位置时返回。 minimum: 1
data[].error(分支2).errors[].columninteger可选;列号,从 1 起;仅有源码位置时返回。 minimum: 1
data[].error(分支2).statusnumber可选;工作流 raise 声明的 HTTP 风格状态;可省略,平台错误可能不提供。
data[].initiatorobject必填 / 必有;网关注入的主体 {type, id},表示谁发起或操作;本服务不解析名字,名字由控制台批量解析。 不接受额外字段。
data[].initiator.type"user" / "api_key" / "agent" / "run" / "trigger"必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。
data[].initiator.idstring必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。
data[].channel"run" / "console" / "api" / "internal" / "trigger"必填 / 必有;请求进入平台的渠道。console 为控制台(经 BFF);api 为公开 API 调用;internal 为平台内部服务调用;run 为由另一个运行创建的子运行;trigger 为触发器启动。
data[].ownerstring必填 / 必有;所属租户,由网关注入;按不透明字符串处理。
data[].parentnull / object必填 / 必有;派生本运行的父运行 {id, number, definition};根运行为 null。
data[].parent(分支2).idstring必填 / 必有;父运行 ID(run_ 前缀)。
data[].parent(分支2).numbernull / number必填 / 必有;父运行在其定义内的序号;父运行是临时运行时为 null。
data[].parent(分支2).definitionnull / object必填 / 必有;父运行所属的脚本或工作流 {namespace, name};临时运行为 null。
data[].parent(分支2).definition(分支2).namespacestring必填 / 必有;父运行所属定义的命名空间。
data[].parent(分支2).definition(分支2).namestring必填 / 必有;父运行所属定义的名字。
data[].parent_run_idstring / null必填 / 必有;派生出本运行的父运行 id;根运行为 null
data[].root_run_idstring必填 / 必有;运行树根运行的 ID;根运行自身指向自己。
data[].depthnumber必填 / 必有;运行树中的深度:根运行为 0,每一层子运行加 1,最大 10。
data[].attachnull / "wait" / "detach"必填 / 必有;子运行与父运行的关系。wait 表示父运行等待子运行结束,且子运行的截止时间不晚于父运行;detach 表示父运行不等待,也不会因父运行取消而被取消;根运行为 null。
data[].deadline_atstring必填 / 必有;运行的截止时间(RFC 3339 UTC):创建时间加 deadline_seconds(脚本默认且最多 300 秒,工作流默认 86400 秒、最多 604800 秒),等待型子运行不晚于父运行截止前 1 秒。
data[].created_atstring必填 / 必有;运行创建时间(RFC 3339 UTC)。
data[].started_atnull / string必填 / 必有;开始执行的时间(RFC 3339 UTC);仍在排队为 null。
data[].ended_atnull / string必填 / 必有;进入终态的时间(RFC 3339 UTC);尚未结束为 null。
data[].updated_atstring必填 / 必有;运行记录最近一次更新的时间(RFC 3339 UTC)。
data[].heartbeat_atnull / string必填 / 必有;执行器最近一次存活信号的时间(RFC 3339 UTC);尚未开始为 null。
data[].cancel_requested_atnull / string必填 / 必有;收到取消请求的时间(RFC 3339 UTC);未取消为 null。
data[].cancelled_bynull / object必填 / 必有;请求取消的主体;未取消或非人为取消为 null。
data[].cancelled_by(分支2).type"user" / "api_key" / "agent" / "run" / "trigger"必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。
data[].cancelled_by(分支2).idstring必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。
data[].cancel_reasonnull / "user" / "parent_cancelled" / "deadline" / "executor_lost"必填 / 必有;取消原因。user 为用户取消;parent_cancelled 为父运行被取消而级联取消;deadline 为超过截止时间;executor_lost 为执行器丢失;未取消为 null。
data[].suspend_requested_atnull / string必填 / 必有;请求暂停工作流的时间(RFC 3339 UTC);未暂停为 null。
data[].suspended_bynull / object必填 / 必有;请求暂停的主体;未暂停为 null。
data[].suspended_by(分支2).type"user" / "api_key" / "agent" / "run" / "trigger"必填 / 必有;主体类型。user 为登录用户;api_key 为平台 API Key;agent 为智能体;run 为由运行本身(例如父运行)执行的操作;trigger 为触发器。
data[].suspended_by(分支2).idstring必填 / 必有;主体标识,含义随 type 而定:用户 ID、API Key ID、智能体 ID、运行 ID 或触发器 ID;按不透明字符串处理。
data[].queued_msnull / number必填 / 必有;从创建到开始执行的排队毫秒数;尚未开始为 null。
data[].run_msnull / number必填 / 必有;实际执行毫秒数,不含等待点上的等待时间;结束后固定。
data[].wait_msnull / number必填 / 必有;在等待点上累计等待的毫秒数;尚无等待为 null。
data[].usageobject / null必填 / 必有;仅单个运行详情(含 expand)返回;列表为 null。运行本身不收费;这里是运行中调用模型、搜索等能力产生的实扣,按调用归因;未评级的用量稍后计入。汇总超时(1.5 秒)或失败时为 null,详情仍返回 200。
data[].usage(分支1).currency"USD"必填 / 必有;金额币种,固定为 USD。
data[].usage(分支1).coststring必填 / 必有;仅本运行自身的已评级实扣(不含子运行),美元十进制字符串,精确到 6 位小数;没有用量时为 0.000000。 pattern: "^[0-9]+\.[0-9]{6}$"
data[].usage(分支1).pending_eventsinteger必填 / 必有;本运行自身尚未评级的用量事件数,金额稍后才计入。 minimum: 0
data[].usage(分支1).by_serviceobject[]必填 / 必有;本运行按服务拆分的实扣,每项为 service 与 cost(6 位小数美元字符串);没有用量时为空数组。
data[].usage(分支1).by_service[].servicestring必填 / 必有;产生用量的服务名,例如 router 或 search。
data[].usage(分支1).by_service[].coststring必填 / 必有;该服务已评级实扣的美元十进制字符串,精确到 6 位小数。 pattern: "^[0-9]+\.[0-9]{6}$"
data[].usage(分支1).tree_coststring / null必填 / 必有;仅根运行返回整棵运行树的已评级实扣(含自身),6 位小数美元字符串;子运行为 null。
data[].rerun_ofnull / string必填 / 必有;重跑来源:本运行是对哪个运行(run_ ID)的重跑;否则为 null。
data[].labelsobject必填 / 必有;用户标签与系统标签;触发器运行支持 64 个用户标签,系统标签不占用名额。
data[].triggerobject / null必填 / 必有;启动本运行的触发器 {id, name};不是触发器启动时为 null。
data[].trigger(分支1).idstring必填 / 必有;启动本运行的触发器 ID(trg_ 前缀)。
data[].trigger(分支1).namestring必填 / 必有;启动本运行的触发器名称。
data[].cancel_messagestring / null必填 / 必有;用户提供的取消备注(1–500 字符);未提供时为 null,cancel_reason 枚举不变。
data[].input_truncatedboolean可选;列表省略外置 input 时为 true,此时 input 为 null;内联值不变,运行详情返回完整值。
data[].output_truncatedboolean可选;列表省略外置 output 时为 true,此时 output 为 null;内联值不变,运行详情返回完整值。
next_cursornull / string必填 / 必有;下一页游标,原样传给 cursor 参数并保持原查询条件;没有更多页为 null。接口不返回总数。

实测响应

HTTP 200

{
  "data": [
    {
      "id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
      "kind": "script",
      "number": null,
      "definition": null,
      "target": null,
      "resolved_version": null,
      "source_digest": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d",
      "language": "ts",
      "status": "completed",
      "progress": null,
      "current_wait": null,
      "counters": {
        "calls": 0,
        "action_calls": 0,
        "child_runs": 0,
        "tasks_completed": 0,
        "tasks_total": null
      },
      "input": {
        "n": 41
      },
      "output": {
        "answer": 42
      },
      "error": null,
      "initiator": {
        "type": "api_key",
        "id": "key_3e00b8984967"
      },
      "channel": "api",
      "owner": "tnt_3a9759864ccb4e00",
      "trigger": null,
      "parent": null,
      "parent_run_id": null,
      "root_run_id": "run_00mv67mdlm5d5d707cd031744e8437f67f6acf02afaabd18e76bf8db9d674333de6f1fb2f1",
      "depth": 0,
      "attach": null,
      "deadline_at": "2026-10-13T05:02:40.954Z",
      "created_at": "2026-10-13T04:57:40.954Z",
      "started_at": "2026-10-13T04:57:42.283Z",
      "ended_at": "2026-10-13T04:57:42.367Z",
      "updated_at": "2026-10-13T04:57:42.367Z",
      "heartbeat_at": "2026-10-13T04:57:42.283Z",
      "cancel_requested_at": null,
      "cancelled_by": null,
      "cancel_reason": null,
      "cancel_message": null,
      "suspend_requested_at": null,
      "suspended_by": null,
      "queued_ms": 1329,
      "run_ms": 84,
      "wait_ms": null,
      "usage": null,
      "rerun_of": null,
      "labels": {
        "namespace": "docs-samples",
        "name": "sample-run-1791867412840-b05e8a"
      }
    }
  ],
  "next_cursor": null
}

错误码

HTTP错误码与说明
400INVALID_PARAMS:请求参数、路径、游标或请求体格式无效。 INPUT_INVALID:输入不满足目标契约或业务校验。
defaultRFC 9457 automation problem. 429 includes Retry-After.

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

导出

本页内容