runs

Starts a run of a saved agent (agent_id, its current revision and settings) or an ad hoc run (task, with the model, output schema, limits, recording and telemetry given here). A phone_id target must be one of your organization's dedicated phones. While your organization is at its concurrency limit, a run that starts now is refused with 409. Booked with start_at, the run is scheduled instead.

post/runs

Request

Request body

$schemastring uri

A URL to the JSON Schema for this object.

agent_idstring uuid

The agent to run, with its current revision and settings.

keep_alive_secondsinteger

How long an agent-mode run holds its phone after a turn ends, so a message in that time continues it on the same phone (default 120 on POST /runs, 0 in a batch). 0 releases the phone at once.

max_cost_microdollarsinteger

Most an ad hoc run's model steps may cost, in microdollars (default 10000000).

max_stepsinteger

Most model steps an ad hoc run may take (default 500).

modelstring

An ad hoc run's model, one of GET /models (default the platform default). A saved agent's run uses the agent's.

network'restricted' | 'internet'

The sandbox's network for an instructions run: restricted (default) reaches the phone only; internet adds the public internet. Code runs always have internet.

output_schemaobject

The JSON Schema an ad hoc run's result must satisfy. A saved agent's run uses the agent's.

pause_timeout_secondsinteger

Longest an ad hoc run waits paused for an answer, in seconds (default 600).

recording_enabledboolean

Record the screen of an ad hoc run (default false). A saved agent's run uses the agent's.

start_atstring date-time

Start the run at this time, from a minute to 30 days ahead. Leave out to start now.

start_timeout_secondsinteger

How long the run may wait for a phone before it is cancelled (default 300).

taskstring

An ad hoc task for an agent to work through a model, with nothing saved.

telemetry_enabledboolean

Emit telemetry for an ad hoc run (default true). A saved agent's run uses the agent's.

timeout_secondsinteger

Longest an ad hoc run may take, in seconds (default 3600).

variablesobject

The run's inputs, bound as variables in the kernel.

Example request

{
  "$schema": "/api/v1/AgentRunCreateRequest.json"
}

Response

Created

$schemastring uri

A URL to the JSON Schema for this object.

agent_idstring uuid

The agent the run is of; absent on an ad hoc run.

agent_namestring

The agent's name, on the run lists; absent on an ad hoc run.

cancelled_atstring date-time

Timestamp when the run was cancelled.

completed_atstring date-time

Timestamp when the run finished.

created_atstring date-time required

Timestamp when the run record was created.

errorstring

Why the run failed.

idstring uuid required

Run identifier.

keep_alive_expires_atstring date-time

Until when an ended agent-mode run holds its phone: :sendMessage before then continues the run there; after it, start a new run.

max_cost_microdollarsinteger

Most the run's model steps may cost, in microdollars.

max_stepsinteger

Most model steps the run may take.

mode'agent' | 'code' required

agent: an agent works the task through a model. code: the agent's script runs.

modelstring

The model the run's steps call, one of GET /models.

network'restricted' | 'internet'

The sandbox's network: restricted reaches the phone only; internet adds the public internet.

outputunknown
output_schemaunknown
pause_timeout_secondsinteger

Longest the run waits paused for an answer, in seconds.

phone_idstring

Phone executing the run.

recording_enabledboolean

An ad hoc run's own recording choice; absent takes the default (off), and a saved agent's run takes the agent's.

result_textstring

A short account of the run's result.

revision_idstring uuid

The agent's revision the run was pinned to when it was made.

run_metadataobject

Arbitrary metadata attached to the run.

schedule_idstring uuid

The schedule that started the run, if one did.

session_idstring uuid

Session associated with this run.

start_atstring date-time

When the run was booked to start; absent for a run started on request.

start_timeout_secondsinteger

How long the queued run may wait for a phone before auto-cancel.

started_atstring date-time

Timestamp when the run began executing.

status'scheduled' | 'queued' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' required

Current lifecycle state of the run. paused: the run waits on a person; see input_request.

stream_urlstring

The run's live event stream (Server-Sent Events), with a short-lived read-only token. Server clients can send the API key header instead.

successboolean

Whether the run completed without error.

taskstring

An agent-mode run's task: the ad hoc task, or the agent's instructions.

telemetry_enabledboolean

An ad hoc run's own telemetry choice; absent takes the default (on), and a saved agent's run takes the agent's.

timeout_secondsinteger

Longest the run may take, in seconds.

trace_expired_atstring date-time

When the trace recording was deleted.

trigger'manual' | 'scheduled' | 'api' required

Trigger identifies how the run was initiated.

turninteger

An agent-mode run's current turn, from 1.

updated_atstring date-time required

Timestamp of the last update to the run record.

user_idstring uuid required

User who initiated the run.

variablesobject

The run's inputs. Deleted once the finished run is older than the plan's run data retention window (30 days by default).

video_urlstring

URL for the run recording video.

Example response

{
  "$schema": "/api/v1/RunResponse.json"
}

Changes