Skip to main content

Async Execution

By default, an agent execution runs synchronously: the request blocks until the agent finishes and the response contains the output. For long-running agents, you can instead run the execution asynchronously by adding the execMode query parameter. The execMode parameter accepts two values:
  • sync (default) — the request waits for the agent to finish and returns the output.
  • async — the request returns immediately with an execution record you can poll.
Async execution is useful for long-running or agentic agents, and for starting many executions in parallel without holding open a request for each one.

Step 1: Start the execution

Add ?execMode=async to your execution request. Instead of the agent output, you receive an execution object with an id and a status of IN_PROGRESS.

Example Response

If caching is enabled (useCache=true) and a matching prior execution exists, an async request returns the cached result right away with status already SUCCESS and "cached": true, rather than IN_PROGRESS.

Step 2: Poll for the result

Use the execution id from the response to poll the GET /agent_executions/{id} endpoint. Keep polling until status is SUCCESS or ERROR. When the execution succeeds, the output field contains the agent’s result.
curl
A status of IN_PROGRESS means the agent is still running—wait and poll again. SUCCESS means output is populated; ERROR means the error field explains what went wrong.