Skip to main content
Runs execute in the background. Your HTTP connection has no effect on them. Two ways to get the result: Sync mode. Add "sync": true to the run request. StefanBrain holds the connection until the run ends or the sync window closes: about 90 seconds, counted from when StefanBrain receives the request, upload time included. A run that ends inside the window returns 200 with its final status, including output and structured_output. Check status, because failed and cancelled runs also return 200. Otherwise the response is the normal 202 envelope - no work is lost; finish by polling. A retry that reuses an Idempotency-Key answers at once without waiting. Set your HTTP client’s timeout to 120 seconds for sync requests. The gateway in front of the API closes a connection that receives no response for 120 seconds. A closed connection, timeout, or 504 does not stop the run. It keeps running and is billed. If the start request carried an Idempotency-Key, retry the same request with that key within 24 hours after acceptance or while the run remains active. This returns the original run, including across UTC midnight. After that window and completion, read the original run by its run_id; resubmitting can start another billed run. Polling. The 202 envelope carries the run id and URLs. Poll GET /api/developers/v1/runs/{run_id} one time each 3–10 seconds until status is completed, failed, or cancelled. Polling does not count against rate limits. Calls that start work, file uploads, and transcript requests count. Use sync mode for interactive requests and short tasks. Use polling for long work, batch pipelines, and environments where a held connection is fragile.

Choose what happens when a chat is busy

A chat runs one turn at a time. REST run starts steer by default on 2026-11-01 and reject on 2026-10-20. Pass on_busy: "reject" to request HTTP 409 when busy. A steered input returns steered_into_run_id, identifying the shared run; it does not start a separate billed turn. Poll the blocking run and retry after it finishes. Use separate chats or session labels for independent parallel work. For MCP ask_stefanbrain, omitting chat on a busy session starts an independent ask in a fresh chat with session_chat_busy. Explicit busy chats steer on 2026-11-01, unless you pass on_busy: "reject". Legacy explicit busy chats and overlapping same-key retries return a typed busy conflict. See Parallel sessions for follow-ups and retries.