Concepts
Scripts and workflows define the work. A run records one execution, a trigger determines when it starts, and an action provides a reusable capability during execution.
When to use it
Saves work as a versioned script or workflow that reruns on triggers, with a record of every run.
Use it when
- Work that repeats, runs on a schedule or webhook, or outlasts a codemode program.
Not for, use instead
- A one-off task: use your computer →
agent - Keeping a run’s results →
file
How it behaves
- Scripts call the SDK; workflows reach the platform only through Actions; HTTP success is not run success.
Combines with
- Explore on the computer first, then save.
Entry: praxis.automation.* · docs developers/automation/concepts · recipes cookbook/ops-hub/daily-report
Calling Automation from codemode
The program an agent writes in codemode uses the same SDK as your own code: praxis.<domain>.<resource>.<method>(…) is one public API call. Automation is one of those domains, called as praxis.automation.*.
Entry: the agent's codemode program (or your own code) │ praxis.<domain>.<resource>.<method>(…) SDK method = one public API call ▼The public API domains model · file · search · sandbox · database · agent · automation · … │ praxis.automation.runs.create({ … }) │ ▼Automation: each execution is a run ├─ Script (TypeScript, reusable once saved) │ praxis.<domain>… → the same SDK, back to the public API recorded as platform_api │ call("ocr", input) → runs an Action recorded as action │ invoke("namespace/name", input) → child run: script or workflow recorded as script / workflow ├─ Workflow (YAML) │ call: ocr → runs an Action │ run: script / workflow → child run │ no praxis; it does not call the SDK directly └─ Action Built-in: ocr, chat, embed, image, read-file, write-file, run-sandbox, web-search Your own (namespace/name): no praxis, and it can call only built-in Actions| Form | What it is | Call record |
|---|---|---|
praxis.model.ocr.create({ … }) | SDK method, one public API call | platform_api |
call("ocr", { … }) | Runs an Action by its Action ID (a string) | action |
invoke("ops/report", { … }) | Starts a saved script or workflow as a child run | script / workflow |
- In codemode,
praxisis a global object; in a script it is a module-scope preset binding, not onglobalThis, and needs no import. The methods are identical in both. - An Action ID is a string, not a method on
praxis.praxis.ocr(…)does not exist; at runtime it fails and gives you thecall("ocr", input)form. - Only scripts can use the SDK directly. Workflows and Actions reach platform capabilities only through Actions. A workflow calls an Action directly with
call: namespace/name(bare name for built-ins) and starts a saved script or child workflow withrun:; see Write a workflow. - A codemode program ends when it finishes and is not saved. When work must be saved and reused, triggered by a schedule or webhook, or run longer than the codemode timeout, save it as a script or workflow and run it with
praxis.automation.runs.create; for long tasks, create the run withwait: 0and poll. See limits and errors.
Definitions, versions and tags
Scripts and workflows share namespace/name; a name belongs to only one kind. Drafts are editable. Published versions are immutable and version numbers cannot be reused. Publishing identical content under the same version returns that version. Deprecation preserves history rather than deleting it.
References follow npm version and dist-tag conventions: docs-samples/hello@1.0.0 pins a version; @^1.2.0, @~1.2 and @1.x select ranges; @latest follows a tag. Omitting @ means @latest. Each run records the version it actually resolved.
Stable releases update latest according to version selection rules; publishing an older release does not automatically move it backwards. A prerelease requires an explicit tag such as beta. Tags such as stable and beta can move. A tag cannot be a version or range, and latest cannot be deleted. Moving a tag affects subsequent resolution without modifying published content.
Publish a version to preserve content and set a tag to point to an existing version. Tag writes need no concurrency token. Draft updates require the latest draft.revision in the body, and publishing a draft sends the same draft.revision.
Actions have revisions rather than semantic versions. Compatible changes take effect immediately; call records identify the revision used. Use a new action name for an incompatible schema. Published workflows lock script and child-workflow dependencies to exact versions; actions are not locked.
Run lifecycle
| Status | Meaning |
|---|---|
pending | Accepted and waiting to start. |
running | Executing. |
waiting | A workflow is waiting for an event, timer or child run. |
suspended | A workflow has been suspended. |
completed | Succeeded; read output. |
faulted | Failed; read error. |
cancelled | Cancellation completed. |
Scripts do not enter waiting or suspended. A listen step leaves the run in waiting until you complete the wait. During cancellation, a run may remain running with cancel_requested_at set. A timeout is faulted with error type timeout, not a separate status. Terminal runs cannot resume. Rerun creates a new root run whose rerun_of points to the original.
HTTP success means the request was handled, not that execution succeeded. Check status, output and error. Inspect script calls and logs, or workflow tasks and waits.
Child runs and origin
A script can start a child through praxis.automation.runs.create. The child’s initiator remains the original human, API Key or trigger. parent_run_id expresses the parent relationship. Filter by channel=run for runs started by another run, or by parent_run_id for a particular parent’s children. Public run details expose a parent summary and root_run_id.
Cancellation cascades to children; normal parent completion allows children to continue. A child’s deadline cannot exceed the parent’s remaining time. Repeating a target in the call chain is rejected as a cycle. See limits for depth and fan-out bounds.
Idempotency and retries
Create a run accepts Idempotency-Key, scoped to the owner, HTTP method, path and key for 24 hours. The request fingerprint excludes wait. Reuse the key and body when retrying a network request. A replay returns the current run with Idempotent-Replayed: true. Use a fresh key when deliberately starting another execution.
A different request with the same key returns IDEMPOTENCY_KEY_MISMATCH; a request still in progress returns IDEMPOTENCY_IN_FLIGHT. See the create-run error table. Idempotency does not roll back effects from calls completed before a failure.
Recovery and replay
While a script run is running, the executor running it can be lost: a platform deploy resets executors, and a run’s result can fail to be saved. The platform then executes the script again from the start, with the same source, input and deadline. A run is recovered at most 3 times; after that it fails with EXECUTOR_LOST.
Every call a script makes (an action call, an invoke, a platform API request, a child run) is recorded together with its result before the script receives that result. When the script executes again, a call that matches a record returns the recorded result and is not sent again.
What matches. A call is identified by what it is: its kind, its target, its input, and which occurrence it is among identical calls. The order calls are sent in does not matter, so calls started together (Promise.all, a concurrency pool) replay whatever order their results come back in.
What the script must do. The code between calls runs again, and it must make the same calls with the same inputs. Date.now(), new Date(), Math.random() and crypto.randomUUID() are not recorded: in a new execution they return new values. Keep them out of call inputs. Take a time or an id you need from the run input or from the result of a call.
When they do not match. Read calls (GET and HEAD requests) are sent as usual. A write that was not recorded, made while a recorded write has not yet been made again, is refused and not sent. A recorded call that has still not been made again when the script returns is also a mismatch. In both cases the run fails with REPLAY_DIVERGED, and detail names the call by its number and target. Catching the error of that call does not let the run succeed: every later call is refused as well.
Calls cut off midway. A recorded call with no result: read calls and actions declared idempotent are sent again under their original invocation key; any other write is not sent again and returns EFFECT_OUTCOME_UNKNOWN, for the script to reconcile.
Cost attribution
Runs do not carry a separate execution charge. Model, search and other capabilities called during a run are charged at their regular prices and attributed to the run and trigger. A calculation that calls no such capability incurs no model or search charge.