run_skill, inspects them with get_run, polls for new events with subscribe_run, and cancels them with cancel_run.
The run state machine
Every durable run moves through a fixed state machine:succeeded, failed, and cancelled are terminal states. A run in a terminal state cannot be restarted — you must create a new run.run_skill
Create a durable run for a skill. Returns a run_id immediately; the skill executes asynchronously. Poll with get_run or stream with subscribe_run for progress and results.
Arguments
Return value
Example call
Example response
get_run
Fetch the full run record — status, jobs, artifacts, and events. This is the polling endpoint. For long-running skills, call get_run periodically until status is terminal.
Arguments
Return value
Example call
Example response
subscribe_run
Poll for new events since a cursor. This is the efficient alternative to re-fetching the full run record on every poll. Pass the cursor returned by the previous subscribe_run call to get only events that arrived after that point.
Arguments
Return value
Example call
Example response
cancel_run
Cancel a queued or running run. The run transitions to cancelled and the worker stops processing. Already-produced artifacts are retained.
Arguments
Return value
Example call
Example response
A run in a terminal state (
succeeded, failed, cancelled) cannot be cancelled. Calling cancel_run on a terminal run returns a run_already_terminal error.Polling pattern
1
Create the run
Call
run_skill with the skill_id and input. Get back a run_id.2
Subscribe for events
Call
subscribe_run with the run_id (no cursor). Process the initial events and save the cursor.3
Poll until done
Call
subscribe_run with the saved cursor on an interval (e.g. every 1–2 seconds). Stop when done is true.4
Fetch the final output
Call
get_run to read the output, artifacts, and full event log.Related
- Data tools —
search_skillsanddescribe_skillfor discovery - Artifact tools — fetching artifacts produced by runs
- Trace observability — how runs appear in the web UI