POST /v1/task-runs runs a task. By default it waits and answers with the finished run. With background: true it queues the run and answers 202 at once; POST /v1/task-runs/batch queues up to 1000 runs of one task in one request. Every run is a record you can read, list, cancel and delete. Both need the editor role.
This page is about standalone runs. A task entered by an agent mid-conversation creates no run record and is recorded in that call’s transcript instead; see agent tasks.
What runs
The resolved config — base, override and pinned tool versions — is stored on the run as
config, so you can always see exactly what ran. A config that does not hold together after the override is a 422 listing each problem.
Inputs, labels and idempotency
A request body over 50 MB is a
413. Inputs that do not match the task — an undeclared name, a missing required input, a file sent under vars — are a 400 before anything is stored.
Background runs and batches
- A batch names the task once (
task_id,task_version,task,task_override) and takes 1–1000runs, each with its ownvars,files,metadataandidempotency_key. Results come back in input order. - All or nothing. One invalid item refuses the whole batch with a
400naming it (runs[3]: 'cv' is required and has no default); nothing is queued. - Your workspace runs up to 3 background runs at a time and queues the rest, oldest first, across every batch and single background run. A submission is never refused for load, only when 100,000 runs are already queued (
429). - Files are not fetched at submission. A URL is downloaded when the run starts.
task_run.completed, sent once per run as it reaches completed, failed or canceled, or by polling GET /v1/task-runs.
Retries
A background run is tried again, up to 3 tries in all, when:- the worker running it stopped — a deploy or a crash — whatever it had done; or
- the model provider failed with an error it marks as transient, or the platform failed, before any tool ran. A worker stop retries from the start even after tools acted, so make side-effecting tools safe to repeat.
tries on the run says how many there were, and usage and provider_cost add up across them. Inline runs are never retried.
Response
A failed run is still a
200 with status: "failed"; its trace, usage and cost are on the response.
steps_used and attempts
- A step is one model → tools → model round, not one tool call. Four tools called in one reply are one step. A successful run’s last step is the
submit_resultcall, so a task with no other tools reportssteps_used: 1. - A run that ends without calling
submit_resultis re-prompted, up to twice, and each re-prompt gets a fresh step budget.steps_usedreports the busiest attempt, the numbermax_stepsgoverns. - So
attempts: 3withmax_steps: 25can mean up to 75 rounds;timeout_secondsis the real bound.
The trace
kind: "tool":nameis the tool as the model called it (namespaced for MCP tools);argsandresultare parsed JSON when possible, else text;msis the call’s duration.kind: "message": text the model wrote, inresult;nameisassistantandmsis null.- Workspace secret values are masked before storage.
- Fields over 4,000 characters are cut and the entry’s
truncatedistrue. At most 200 entries are kept. - Provider tools such as
web_searchrun inside the provider and do not appear.
Listing runs
GET /v1/task-runs lists runs newest first, without config, inputs or trace. Filter with task_id, status, created_after, created_before and metadata, repeated as key:value pairs that must all match (limit default 50, max 200; see pagination). GET /v1/task-runs/{run_id} returns one run in full. GET /v1/tasks carries each task’s last_run in the same list shape.
Canceling
POST /v1/task-runs/{run_id}/cancel cancels a queued run at once and returns it canceled. A running background run is returned still running with cancel_requested_at set, and stops within a few seconds as canceled with the message canceled while running. An inline run cannot be canceled (409); it ends at its timeout. Canceling a finished run is a 409.
Deleting
DELETE /v1/task-runs/{run_id} answers 202 and deletes the run’s vars, files (with their stored page images), output, trace and config, and the message on its error, usually within seconds. The run itself stays with its status, error type, metadata, idempotency_key, timings, usage and cost, and content_deleted_at is set. A queued run is canceled first; a running one is asked to stop and deleted once it has.
POST /v1/task-runs/delete with {"metadata": {"candidate_id": "c_41"}} (and optionally task_id) does the same for every matching run and answers 202 {"count": n}. metadata must name at least one pair.
A workspace retention policy deletes task-run content the same way, the set number of days after each run ends.
Next
Errors and limits
Every
error.type and its fix.Inputs and output
Text, untrusted and PDF inputs; nested output.