自动化 API
(待译)
Praxis Automation saves TypeScript scripts and YAML workflows, runs them on demand or from schedule and webhook triggers, and records each run with its calls, logs and result. A script has three module-scope bindings, not globals and needing no import: praxis, the same SDK as codemode, where praxis.<domain>.<resource>.<method>(…) is one public API call (recorded as platform_api); call(actionId, input), where the Action ID is a string — bare names such as ocr for built-in Actions, namespace/name for your own — and never a praxis method (recorded as action); and invoke(“namespace/name”, input), which starts a child script or workflow run (recorded as script or workflow). Workflows reach capabilities only through call: (an Action) and run: (a saved script or workflow), and Actions have no praxis: built-in Actions operate platform capabilities directly, and your own code Actions can call only built-in Actions. Actions time out after 5 min (run-sandbox after 6 h), scripts after 30 min of wall-clock time, and workflows default to 24 h and allow up to 30 days; for long-running, background or batch work, create the run with wait: 0 and poll it with praxis.automation.runs.retrieve, or split work into child runs or a workflow. Differences: choose your own namespace without registration, while the praxis namespace is reserved for built-in Actions; Actions run at their current revision, while published scripts and workflows use namespace/name@version or @tag; drafts can run directly as source without publishing; schedule and webhook triggers require a published target. A workflow step written call: praxis/approval opens a human task (an approval) and waits for an assignee to respond through praxis.automation.humanTasks.respond; listing human tasks gives the caller their approval inbox. Start with praxis.automation.runs.create to test source or execute a published target.
管理动作、发布脚本与工作流、查看运行并接收入站 webhook。
https://api.deepraxis.com/automation/v1
鉴权
使用 Authorization: Bearer $PRAXIS_API_KEY。入站 webhook 使用创建或轮换时返回的 secret URL,无需 API Key。
TypeScript SDK
SDK 尚未发布到 npm。从本地源码安装,再用 Bun 运行示例;将命令中的路径替换为本地 SDK 目录。
bun add /absolute/path/to/packages/sdk/typescript
bun example.ts
示例使用 develop。curl 请求体带变量时需安装 jq。资源示例名称以 sample- 开头;创建前换成尚未占用的名称。动作、脚本和工作流使用 docs-samples 命名空间,完成后归档;触发器完成后删除。