AutomationRun
Operations
Every route this entity exposes. Each route links to its own reference on this page.
| Method | Route | SDK operation | Returns |
|---|---|---|---|
POST |
/api/v1/organizations/{organization_id}/agents/{id}/spark/automations/{automation_key}/runs |
create |
The manually requested run, using the reviewed version |
Examples
One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.
Golang
Construct client as shown in the Golang setup, then call the operations:
created, err := client.AutomationRun(nil).Create(map[string]any{"agent_id": "example", "automation_id": "example", "organization_id": "example", "input": map[string]any{}, "request_id": "example", "version_id": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(created)
Lua
Construct client as shown in the Lua setup, then call the operations:
local created, err = client:AutomationRun():create({ agent_id = "example", automation_id = "example", organization_id = "example", input = {}, request_id = "example", version_id = "example" })
PHP
Construct client as shown in the PHP setup, then call the operations:
$created = $client->AutomationRun()->create(["agent_id" => "example", "automation_id" => "example", "organization_id" => "example", "input" => [], "request_id" => "example", "version_id" => "example"]);
Python
Construct client as shown in the Python setup, then call the operations:
created = client.AutomationRun().create({ "agent_id": "example", "automation_id": "example", "organization_id": "example", "input": {}, "request_id": "example", "version_id": "example" })
Ruby
Construct client as shown in the Ruby setup, then call the operations:
created = client.AutomationRun.create({ "agent_id" => "example", "automation_id" => "example", "organization_id" => "example", "input" => {}, "request_id" => "example", "version_id" => "example" })
TypeScript
Construct client as shown in the TypeScript setup, then call the operations:
const created = await client.AutomationRun().create({ agent_id: "example", automation_id: "example", organization_id: "example", input: {}, request_id: "example", version_id: "example" })
Fields
| Field | Type | Required | Description |
|---|---|---|---|
action |
string |
Yes | Action |
automation |
one,object,null |
No | Saved native automation identity. |
budget_seconds |
one,integer,null |
Yes | The run stops once it has been running this long |
budget_usd |
one,number,null |
Yes | The run stops before a step once it has spent this much |
can_answer |
boolean |
Yes | Whether this viewer can answer the step that stopped the run; the answer runs that step again |
can_approve |
boolean |
Yes | Whether this viewer can approve or decline the checkpoint the run waits at; only a person can approve one |
can_dismiss |
boolean |
Yes | Whether this viewer can dismiss the run waiting for them, which ends it unanswered |
checkpoint |
one,object,null |
Yes | The question a run waiting at a checkpoint is asking |
conversation_id |
one,string,null |
Yes | The thread the run works in, which the person opens to follow it |
decision_history |
object |
No | Decision History |
error |
one,string,null |
Yes | Error |
finished_at |
one,string,null |
Yes | Finished At |
flow_steps |
one,array,null |
Yes | How the run went at each step of its workflow file, in the order it reached them; null when steps were recorded without their step of the file |
id |
string |
Yes | Id |
input |
object |
Yes | Input |
needs_you |
boolean |
Yes | Whether a step stopped the run for the person, who can answer it |
note |
one,string,null |
Yes | One sentence a workflow step left for the person, which the run's card leads with |
nothing_to_do_reason |
one,string,null |
Yes | Why a run that succeeded did no work, as the step that found nothing to do said; null otherwise. |
request_id |
string |
Yes | Request Id |
resume_count |
integer |
Yes | How many times the run went on from a checkpoint; it tells one pause from the next, even at the same checkpoint |
retry_step_id |
one,string,null |
Yes | Retry Step Id |
running_seconds |
integer |
Yes | How long the run has been running, not counting time waiting at a checkpoint or for a retry |
source |
string |
Yes | Source |
spent_tokens |
integer |
Yes | The tokens the run's agent steps have used so far |
spent_usd |
number |
Yes | What the run's agent steps have cost so far, as the agent reported it |
stalled |
boolean |
Yes | Whether a running run has had no sign of its worker for five minutes; it continues if the worker comes back |
started_at |
string |
Yes | Started At |
started_by |
one,object,null |
Yes | The event that started the run |
status |
string |
Yes | Status |
step_count |
integer |
Yes | Step Count |
steps |
array |
Yes | Steps |
trigger_id |
one,string,null |
Yes | The run settings that started it, for a run an event or schedule started |
version_id |
string |
Yes | Version Id |
wake_at |
one,string,null |
Yes | When a sleeping run's step looks again |
workflow_digest |
one,string,null |
Yes | SHA-256 of the immutable definition this run uses |
workflow_path |
one,string,null |
Yes | Workflow Path |
create
POST /api/v1/organizations/{organization_id}/agents/{id}/spark/automations/{automation_key}/runs
Operation ID: post_api_v1_organizations_organization_id_agents_id_spark_automations_automation_key_runs.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
organization_id |
path |
string |
Yes | |
id |
path |
string |
Yes | |
automation_key |
path |
string |
Yes |
Request body
application/json
| Property | Type | Required | Description |
|---|---|---|---|
input |
object |
Yes | |
request_id |
string (uuid) |
Yes | |
version_id |
string |
Yes |
Responses
200: The manually requested run, using the reviewed version
application/json
| Property | Type | Required | Description |
|---|---|---|---|
action |
enum: run, resume |
Yes | |
automation |
object |
No | Saved native automation identity. Name is its current catalog name; version identifies the immutable definition this run uses. Null for legacy runs. |
automation.id |
string |
Yes | |
automation.key |
string |
Yes | |
automation.name |
string |
Yes | |
automation.version |
integer |
Yes | |
automation.version_id |
string |
Yes | |
budget_seconds |
integer |
Yes | The run stops once it has been running this long |
budget_usd |
number |
Yes | The run stops before a step once it has spent this much |
can_answer |
boolean |
Yes | Whether this viewer can answer the step that stopped the run; the answer runs that step again |
can_approve |
boolean |
Yes | Whether this viewer can approve or decline the checkpoint the run waits at; only a person can approve one |
can_dismiss |
boolean |
Yes | Whether this viewer can dismiss the run waiting for them, which ends it unanswered |
checkpoint |
object |
Yes | The question a run waiting at a checkpoint is asking |
checkpoint.kind |
enum: approval, input |
Yes | |
checkpoint.preview |
string |
No | The checkpoint evidence shown to the person, bounded to 16 KiB. |
checkpoint.prompt |
string |
Yes | |
checkpoint.step_id |
string |
No | The id of the workflow file's step the run waits at, when the worker could tell |
conversation_id |
string,null |
Yes | The thread the run works in, which the person opens to follow it |
decision_history |
object |
No | |
decision_history.items |
array of object |
Yes | |
decision_history.items[].attempt |
integer |
Yes | |
decision_history.items[].attempted_at |
string (date-time) |
Yes | |
decision_history.items[].finished_at |
string (date-time) |
Yes | |
decision_history.items[].position |
integer |
Yes | |
decision_history.items[].questions |
array of object |
Yes | |
decision_history.items[].questions[].name |
string |
Yes | |
decision_history.items[].questions[].prompt |
string |
Yes | |
decision_history.items[].questions[].result |
object |
Yes | |
decision_history.items[].questions[].result.choice |
string |
No | |
decision_history.items[].questions[].result.confidence |
number |
No | |
decision_history.items[].questions[].result.decision |
string |
Yes | |
decision_history.items[].questions[].result.model |
string |
No | |
decision_history.items[].questions[].result.pass_at |
integer |
No | |
decision_history.items[].questions[].result.probabilities |
object |
No | |
decision_history.items[].questions[].result.probability |
number |
No | |
decision_history.items[].questions[].result.reason |
string |
No | |
decision_history.items[].questions[].result.score |
number |
No | |
decision_history.items[].questions[].result.source |
enum: jev, fallback |
Yes | |
decision_history.items[].questions[].result.threshold |
number |
No | |
decision_history.items[].questions[].result.type |
enum: noul, choice, score |
No | |
decision_history.items[].status |
enum: pending, running, completed, interrupted, not_started |
Yes | |
decision_history.items[].step_id |
string |
Yes | |
decision_history.items[].usage_confirmed |
boolean |
Yes | |
decision_history.pagination |
object |
Yes | |
decision_history.pagination.limit |
integer |
Yes | |
decision_history.pagination.next |
string |
No | |
error |
string |
Yes | |
finished_at |
string |
Yes | |
flow_steps |
array of object |
Yes | How the run went at each step of its workflow file, in the order it reached them; null when steps were recorded without their step of the file |
flow_steps[].definition_step_id |
string |
Yes | |
flow_steps[].status |
enum: succeeded, running, waiting, sleeping, failed |
Yes | |
id |
string |
Yes | |
needs_you |
boolean |
Yes | Whether a step stopped the run for the person, who can answer it |
note |
string |
Yes | One sentence a workflow step left for the person, which the run's card leads with |
nothing_to_do_reason |
string |
Yes | Why a run that succeeded did no work, as the step that found nothing to do said; null otherwise. |
resume_count |
integer |
Yes | How many times the run went on from a checkpoint; it tells one pause from the next, even at the same checkpoint |
retry_step_id |
string |
Yes | |
running_seconds |
integer |
Yes | How long the run has been running, not counting time waiting at a checkpoint or for a retry |
source |
enum: chat, event, schedule, manual |
Yes | |
spent_tokens |
integer |
Yes | The tokens the run's agent steps have used so far |
spent_usd |
number |
Yes | What the run's agent steps have cost so far, as the agent reported it |
stalled |
boolean |
Yes | Whether a running run has had no sign of its worker for five minutes; it continues if the worker comes back |
started_at |
string |
Yes | |
started_by |
object |
Yes | The event that started the run |
started_by.kind |
string |
Yes | |
started_by.reference |
string |
Yes | |
started_by.source |
string |
Yes | |
started_by.title |
string |
Yes | |
status |
enum: running, succeeded, blocked, sleeping, step_failed, failed, ... |
Yes | |
step_count |
integer |
Yes | |
steps |
array of object |
Yes | |
steps[].attempt |
integer |
Yes | |
steps[].command |
string |
Yes | |
steps[].conversation_id |
string |
Yes | The conversation an agent step ran in, readable with the agent's conversation endpoint; null for command steps |
steps[].definition_step_id |
string |
Yes | The id of the workflow file's step this attempt ran for; null for steps recorded before workers reported it |
steps[].error |
string |
Yes | |
steps[].exit_code |
integer |
Yes | |
steps[].finished_at |
string |
Yes | |
steps[].id |
string |
Yes | |
steps[].kind |
enum: agent, command, message, gate |
Yes | |
steps[].model |
string |
Yes | |
steps[].output_bytes |
integer |
Yes | |
steps[].output_preview |
string |
Yes | |
steps[].output_preview_complete |
boolean |
Yes | |
steps[].output_truncated |
boolean |
Yes | |
steps[].risk |
object |
Yes | What an agent step asked for its risk said about its change |
steps[].risk.level |
enum: obvious, not_obvious |
Yes | |
steps[].risk.reason |
string |
Yes | |
steps[].sequence |
integer |
Yes | |
steps[].started_at |
string |
Yes | |
steps[].status |
enum: running, succeeded, failed, interrupted |
Yes | |
steps[].stopped |
object |
Yes | Why an agent step that answered blocked stopped for the person, and the note it left them |
steps[].stopped.note |
string |
Yes | |
steps[].stopped.reason |
string |
Yes | |
steps[].summary |
string |
Yes | |
steps[].waited |
object |
Yes | What an agent step that answered waiting is waiting for; the run sleeps and the step looks again later |
steps[].waited.reason |
string |
Yes | |
trigger_id |
string |
Yes | The run settings that started it, for a run an event or schedule started |
wake_at |
string |
Yes | When a sleeping run's step looks again |
workflow_digest |
string |
Yes | SHA-256 of the immutable definition this run uses |
workflow_path |
string |
Yes |