REST API - Agents
Invoke Agent (Sync)
Execute an agent and wait for completion. Returns the final result.
POST
Invoke Agent (Sync)
Invoke an agent synchronously. The request blocks until the agent finishes (typically 5–30 seconds) and returns the completed task with the result.
For longer-running tasks, use Invoke Agent (Async) or Invoke Agent (Stream).
Extract just the result:
The agent remembers all previous messages in the thread. Always reuse the same
The agent sees the
To hand over the user’s identity provider token instead, send it as
The 9-page Bitcoin whitepaper (above) processes successfully. Its content fits within the model’s context window.
With this flag, the file URL is available to the agent’s tools but the raw content is not prepended to the prompt. Use this when you want the agent’s tools to process the file rather than the LLM reading it directly.
All three fields are optional and independent. Supply only the ones you want to override. Omitted fields fall back to the agent’s configured values.
The response echoes the override in
The per-call schema applies to runs the API starts directly; a turn inside an agent’s conversation uses the agent-level schema.
Path Parameters
Request Body
Onlyinput is required, with the prompt in input.text. input.user is optional. When you send it, input.user.email is required. user_oidc_token is optional and is used by skills that sign in with MCP OAuth.
The user’s own tokens for MCP skills, keyed by the skill’s
id from the agent’s tools[] in Get Agent (not mcp_id). A string is sent to that MCP server as Authorization: Bearer <value>; an object is sent as its request headers. A key that matches no MCP skill on the agent is ignored.The user’s identity provider token, for an agent with identity provider pre-authentication. You can send it as
Authorization: Bearer <token> next to x-api-key instead. On an agent with API callers name the end user turned on, a token in Authorization also decides who the run runs as. See Run as your end user.Thread ID for multi-turn conversations. Pass the
id from a previous task’s response to continue the same conversation. The agent will have full context of all prior messages. If omitted, a new thread is created automatically.When
true, files passed in input.files are not injected into the LLM context window. The file URLs are still available to the agent’s tools, but the raw content won’t be prepended to the prompt.Use this when:- Files are large (would exceed the model’s context limit)
- You want tools to process the files rather than the LLM reading them directly
- You’re passing many files and don’t need them all in context
false): file contents are downloaded, extracted, and injected directly into the LLM prompt as context.Controls the agent’s reasoning depth.
default for standard reasoning, harder for deeper chain-of-thought analysis. Use harder for complex multi-step tasks that benefit from more deliberate planning.Additional instructions appended to the agent’s system prompt for this invocation only. Use this to adjust behavior per-request without changing the agent’s configuration — for example, restricting output format, adding constraints, or changing tone.
Extra context appended to the agent’s system prompt for this invocation only. Unlike
instructions_override (which adds behavioral instructions), this supplies supplementary facts or context the agent should consider for this run — e.g. relevant background data, the current state of an external system, or a user’s recent activity.Natural-language description of the desired output (e.g.,
"A bulleted list of key findings"). Guides the agent’s response style.Per-execution LLM provider override. Use the provider’s internal identifier (e.g.
openai, anthropic, bedrock) from GET /v1/misc/llm_providers. Omit to use the agent’s configured provider.Per-execution model override. Must be a valid model under the chosen provider (
GET /v1/misc/llm_providers/{provider_identifier}/models). Examples: claude-sonnet-4-6, gpt-5, gemini-2.0-flash. Omit to use the agent’s configured model.Per-execution reasoning-effort override for reasoning-capable models (e.g. GPT-5). One of
low, medium, high, xhigh. Omit to use the agent’s configured reasoning effort.Query Parameters
Agent version to invoke. Defaults to the live agent.
"draft" is legacy and also runs the live agent, since edits save straight to live.Response
The response is the full task object. The key fields you’ll use:The agent’s response. If
output_format is json, this is a JSON string — parse it with JSON.parse() or jq.Simplest Possible Invoke
Multi-Turn Conversation
Pass theid from the first response to continue the thread:
id for follow-ups.
With User Identity
Pass the user’s identity so the agent can personalize responses and use identity-aware skills:user object as context. When you send user, email is required and id is optional.
Who the run runs as depends on the key. With the organization’s default API key, it runs as the user you name. With a member’s API key it runs as that member, unless the agent has API callers name the end user turned on: then the named user runs as a separate end user with their own memory and conversations. See Run as your end user.
With MCP OAuth
Pass the user’s own tokens inuser_tokens when the agent uses MCP skills that sign in on behalf of the user. Each key is the skill’s id from the agent’s tools[]:
Authorization: Bearer <token> next to x-api-key. On an agent with API callers name the end user turned on, the token is verified and MCP skills set to Signed-in user (SSO) receive it in the mode each one is set to.
Processing Files
Files passed ininput.files are downloaded and injected directly into the LLM context window by default. This works well for small-to-medium files:
Large Files
A large file is still accepted. This request sends a 185-page PDF, and the agent answers correctly:Disable Context Injection
Setdisable_attachment_injection: true to pass the file URL to the agent’s tools without injecting its content into the LLM prompt:
Per-Request Instruction Override
Append instructions for this specific invocation without changing the agent’s configuration:Per-Execution LLM Override
Override the agent’s configured provider, model, or reasoning effort for a single invocation without mutating the agent. Useful for A/B testing models, routing specific requests to a stronger or cheaper model, or dialing up reasoning effort on complex prompts:llm_model_provider, llm_model_name and llm_reasoning_effort. A field you did not override is null in the response, and the agent’s configured value applies.
Structured JSON Output
Request structured output with a JSON Schema:To configure
output_format and output_schema on the agent itself, use the Update Agent endpoint or configure it in the dashboard under the Output tab.Example Response
See Also
- Invoke Agent (Async) — returns immediately with a task ID for polling
- Invoke Agent (Stream) — real-time SSE stream of agent activity
- Get Thread — retrieve the full conversation history
- Webhook documentation — trigger agents from external systems via the auto-generated
webhook_url
Body
application/json
Response
Successful Response
Task creation response model.
Extends AgentExecution with additional agent_id field.

