Skip to main content
POST
Create a run

Authorizations

Authorization
string
header
required

An API key of your organization, starting with trk_, sent as Authorization: Bearer <key>.

Headers

idempotency-key
string

A unique value you choose, up to 255 characters, to retry safely: a request with a key already used in your organization returns the run the first request created, without starting another, whatever its body.

Required string length: 1 - 255

Body

application/json
agent
object
required

The coding agent and the model it uses.

prompt
string
required

What you ask the agent to do first.

Minimum string length: 1
environment
object
required
input_files
string[]

Up to 20 uploaded file ids, staged in the sandbox before setup and referenced in the first prompt.

Maximum array length: 20

Reference returned when requesting a file upload.

labels
object

Labels you attach to the run to find it again, as keys and values, such as { "ticket": "ENG-42" }. We never read them. Keys match ^[A-Za-z0-9_.-]{1,64}$; at most 20 labels with values of up to 256 characters.

budget_usd
number

Maximum the run may spend, in US dollars. Defaults to a standard budget when omitted. The run ends with budget_exceeded once it is reached.

Required range: 0.01 <= x <= 10000
one_shot
boolean

Whether the run ends as soon as its first prompt finishes. Defaults to true. Set it to false to send follow-up prompts while the run is idle.

idle_timeout_seconds
integer

How long the run waits for a follow-up prompt before it ends with idle_timeout, in seconds, from 120 to 900. Defaults to 900. Only allowed when one_shot is false.

Required range: 120 <= x <= 900
time_limit_seconds
integer

Longest the run may last, in seconds from when it starts, from 60 to 43200. Defaults to 7200. Once reached, the run ends with time_limit, even in the middle of a prompt.

Required range: 60 <= x <= 43200

Response

A coding agent working on your prompt in an isolated sandbox.

A coding agent working on your prompt in an isolated sandbox.

id
string
required

Unique identifier of the run.

input_files
object[]
required
labels
object
required

Labels you attach to the run to find it again, as keys and values, such as { "ticket": "ENG-42" }. We never read them. Keys match ^[A-Za-z0-9_.-]{1,64}$; at most 20 labels with values of up to 256 characters.

agent
object
required

The coding agent and the model it uses.

environment
object
required

What the agent works on.

budget_usd
required
one_shot
boolean
required

Whether the run ends as soon as its first prompt finishes.

time_limit_seconds
integer
required

Longest the run may last, in seconds from when it starts.

Required range: -9007199254740991 <= x <= 9007199254740991
started_at
string
required
last_prompt
object
required

One instruction to the agent and the work it did in response.

status
enum<string>
required

preparing while its sandbox gets ready, working while the agent works on a prompt, idle while it waits for a follow-up prompt.

Available options:
preparing,
working,
idle
idle_timeout_seconds
integer

How long the run waits for a follow-up prompt before it ends, in seconds. Absent for a one-shot run.

Required range: -9007199254740991 <= x <= 9007199254740991