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.
A run executes for real: tools call your endpoints with your secrets, MCP servers spend your credits, and the model spends tokens on your provider key. The dashboard’s Run panel does the same.
An inline request lasts up to the task’s timeout_seconds (default 300, max 600). Set your HTTP client’s read timeout above it, or use background: true. A client that gives up loses the response, not the spend.

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–1000 runs, each with its own vars, files, metadata and idempotency_key. Results come back in input order.
  • All or nothing. One invalid item refuses the whole batch with a 400 naming 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.
Find out when runs finish by subscribing a webhook to 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.
Retries back off 30 then 60 seconds. Everything else fails on the first try. 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_result call, so a task with no other tools reports steps_used: 1.
  • A run that ends without calling submit_result is re-prompted, up to twice, and each re-prompt gets a fresh step budget. steps_used reports the busiest attempt, the number max_steps governs.
  • So attempts: 3 with max_steps: 25 can mean up to 75 rounds; timeout_seconds is the real bound.

The trace

  • kind: "tool": name is the tool as the model called it (namespaced for MCP tools); args and result are parsed JSON when possible, else text; ms is the call’s duration.
  • kind: "message": text the model wrote, in result; name is assistant and ms is null.
  • Workspace secret values are masked before storage.
  • Fields over 4,000 characters are cut and the entry’s truncated is true. At most 200 entries are kept.
  • Provider tools such as web_search run 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.
Task runs do not appear in the Observability charts. Their spend shows only in run history and on an email batch page, where each drafted row links to its run.

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.