Skip to main content
POST
Run an agent

Authorizations

Authorization
string
header
required

Workspace API key issued from the web app. Pass as Authorization: Bearer YOUR_API_KEY.

Path Parameters

agent_id
string<uuid>
required

UUID of the agent.

Query Parameters

async
boolean
default:true

false holds the request open until the run finishes and returns the result on this call. A non-boolean value is rejected with 400 rather than treated as the default — a typo must not silently behave differently from what you asked for.

When the synchronous path is unavailable the request behaves exactly as async=true and answers 201, with X-Sync-Budget-Seconds: 0 so you can tell that case apart. That happens when the feature is off for the environment or the agent, when the run was queued behind the agent's concurrency limit, or when this instance is already holding its maximum number of requests.

result
string

Which payload async=false returns. Required when async=false, unless the agent carries a settings.sync_result default. There is no implicit default: the only sensible one to pick would be the largest payload and the only one that can exceed the response limit.

An explicit result=structured on an agent with no output schema is rejected with 400 before the run is created, since nothing could ever produce one. An agent whose STORED settings.sync_result is structured degrades to the transcript instead, so one bad setting cannot fail every synchronous run for that agent.

Body

query
string

Prompt text. Optional when one or more files are attached.

files
file[]

One or more file attachments (PDF, image, Word, Excel, etc.). Repeat the files field per attachment. The legacy field name file is also accepted for a single upload.

output_config
string

JSON-encoded TaskOutputConfig — submitted as a string field in multipart bodies. Supports output_schema and instructions. See the RunAgentRequest schema for the structured equivalent.

version
integer

Optional. Run a specific published version. See the RunAgentRequest schema.

source
string

Optional. production (default) or test. See the RunAgentRequest schema.

Response

The run reached a terminal state within the wait budget. A run that failed or was stopped is still a 200: the HTTP call did what it was asked, and a 5xx would invite retries of a run that failed for a legitimate reason.

The async=false reply: RunAgentResponse's fields plus the run's result and the budget that was applied.

task_id
string<uuid>
required
agent_id
string<uuid>
required
status
enum<string>
required

Lifecycle status of a task.

  • pending — created, not yet picked up
  • queued — held back by admission control (agent at concurrent-task limit)
  • running — being processed by the worker
  • waiting_for_input — agent called ask_user; reply with POST /tasks/{id}/message
  • awaiting_review — agent is paused for human approval of a sensitive step
  • completed — terminal: finished successfully
  • failed — terminal: errored out
  • stopped — terminal: cancelled by a user or system
Available options:
pending,
queued,
running,
waiting_for_input,
awaiting_review,
completed,
failed,
stopped
outcome
enum<string>
required

Why this reply was produced, in a form you can branch on. Three situations answer 202 and they call for different handling.

Treat an unrecognised value as budget_expired: the run is still collectable by task_id, and new members may be added.

Available options:
terminal,
budget_expired,
draining,
result_unavailable
message
string
required

Human-readable hint. Branch on outcome and result_status, not on this.

created_at
string<date-time>
required
wait_budget_seconds
integer
required
result_selector
string

Which payload was actually applied, after request then agent-setting precedence.

result_status
enum<string>

Why result is what it is. not_found means the run genuinely produced no such payload; unavailable means it could not be read. New members may be added — treat an unrecognised value as unavailable, never as "the agent produced nothing".

Available options:
completed,
not_found,
processing,
failed,
cancelled,
unreadable,
unavailable,
too_large
result
any

The selected payload in its own shape, or absent. Never a substitute object explaining its own absence; result_status and result_bytes carry that.

result_bytes
integer

The payload's real size, set when it was omitted for exceeding the response limit.

result_metadata
any

Sibling metadata for tool:<name> on extraction tools, currently resolved applied_memories.

output_files
object[]