Skip to main content
Background runs let you submit an agent task and receive an immediate acknowledgement, then poll for the result at your own pace. This is the right choice for long-running analyses, batch processing, and workflow steps where you cannot hold an HTTP connection open for the full duration of execution. All requests require a valid bearer token in the Authorization header.

Submit a background run

Queues the agent run for asynchronous execution and returns immediately with a runId and status: "QUEUED". The request accepts the same body as the synchronous run endpoint.

Path parameters

string
required
The unique identifier of the agent to run.

Request body

string
required
The user’s input or query for the agent.
string
UUID of an existing session to continue. Omit to start a new session — the server generates one automatically.
string
Associates the run with a specific user for memory scoping and audit trails.
string
Tenant identifier for multi-tenant deployments.
boolean
default:"false"
When true, the agent generates suggested follow-up questions appended to the output.
object[]
Array of multimodal inputs. Each entry contains type (MIME type) and data (base64 or URL).
object
Optional model overrides (model, temperature, maxTokens).

Response

string
required
Unique identifier for the queued run. Use this to poll for status.
string
required
Always "QUEUED" on successful submission.
Example response

Poll for run status

Returns the current state of a background run as an AgentRun entity. Poll this endpoint until status reaches a terminal state (COMPLETED, FAILED, or CANCELLED).
string
required
The agent that owns the run.
string
required
The run identifier returned when the background run was submitted.
Run status values
string
The run ID.
string
The agent that executed this run.
string
The session this run belongs to.
string
Current execution status.
string
ISO-8601 timestamp when the run was queued.
string
ISO-8601 timestamp when the run reached a terminal status. null while still running.
string
The agent’s response content, available when status is "COMPLETED".
Example response (completed)

Batch status polling

Check the status of up to 100 background runs in a single HTTP request. Run IDs that have no corresponding record are silently omitted from the response.
string
required
The agent that owns the runs.
string
required
Comma-separated list of run IDs to check. Maximum 100 IDs per request.
Example response

Polling loop example

The following TypeScript example submits a background run and polls for completion with exponential backoff:
For batch workloads, use the batch status endpoint (?runIds=...) instead of individual polling calls. Checking 10 runs at once with one request every 3 seconds uses ~20 requests/minute compared to ~200 for individual polls.