Agent API Reference
Async multi-step research, list-building, enrichment, and structured extraction via POST /agent/runs.
Canonical Docs Links
- Agent API guide:
https://exa.ai/docs/reference/agent-api-guide
- Create a run:
https://exa.ai/docs/reference/agent-api/create-a-run
- Get a run:
https://exa.ai/docs/reference/agent-api/get-a-run
- List runs:
https://exa.ai/docs/reference/agent-api/list-runs
- List run events:
https://exa.ai/docs/reference/agent-api/list-run-events
- Cancel a run:
https://exa.ai/docs/reference/agent-api/cancel-a-run
- Delete a run:
https://exa.ai/docs/reference/agent-api/delete-a-run
- Exa Connect overview:
https://exa.ai/docs/reference/agent-api/connect/overview
- Connect combining providers:
https://exa.ai/docs/reference/agent-api/connect/combining-providers
- Connect providers:
https://exa.ai/docs/reference/agent-api/connect/fiber, https://exa.ai/docs/reference/agent-api/connect/similarweb, https://exa.ai/docs/reference/agent-api/connect/baselayer, https://exa.ai/docs/reference/agent-api/connect/affiliatecom, https://exa.ai/docs/reference/agent-api/connect/particle, https://exa.ai/docs/reference/agent-api/connect/financialdatasets, https://exa.ai/docs/reference/agent-api/connect/jinko, https://exa.ai/docs/reference/agent-api/connect/additional-partners
Overview
Use /agent when a workflow needs more than a single search or extraction call:
- build lists from open-ended criteria, then enrich each result
- research entities across many fields with citations
- run multi-hop tasks such as “find companies, then find decision makers”
- produce structured JSON from a long-running web research task
- continue from a previous run with a follow-up request
For simpler low-latency retrieval, prefer /search.
Request Shape
Core Fields
outputSchema supports JSON Schema. Bound list outputs with maxItems where possible so output size and enrichment cost are predictable.
Always send an explicit effort. Prefer auto unless the task or product needs a fixed cost/latency band (low for cheap/fast, high / xhigh for harder research).
To request contact information, describe the desired contact fields in the schema. Use standard JSON Schema formats such as { "type": "string", "format": "email" }, { "type": "string", "format": "phone" }, and { "type": "string", "format": "uri" }.
The current Agent spec also accepts budget.maxCostDollars for compatibility, but documents it as ignored. Do not treat it as a hard spend cap.
Lifecycle
Create returns a run object immediately; final output is available only after a terminal status. Every integration must complete this cycle; do not stop at create:
- Create a run with
POST /agent/runs.
- Save the returned
id, which has the agent_run_ prefix.
- Wait for the run to reach a terminal status (
completed, failed, or cancelled), either by:
- Polling:
GET /agent/runs/{id} until status is terminal, or
- SSE events:
Accept: text/event-stream on create, or replay from GET /agent/runs/{id}/events with Last-Event-ID.
The two are equivalent; pick one per integration.
- Check how the run ended: on
completed, read output; on failed or cancelled, surface the error to the caller or UI. Only completed carries results — reading output without checking the status makes failures look like empty successes, and a hand-rolled wait loop that exits only on completed never finishes for failed runs.
Completed runs include:
output.text: natural-language answer or summary
output.structured: validated JSON matching outputSchema, when provided
output.grounding: citations for text or structured fields
costDollars: run cost breakdown
Polling
SDK helpers are available:
- Python:
exa.agent.runs.poll_until_finished(run_id, poll_interval=4000)
- TypeScript:
exa.agent.runs.pollUntilFinished(runId, { pollInterval: 4000 })
Streaming and Events
Set Accept: text/event-stream when creating a run to receive lifecycle events until a terminal status.
For stored event replay:
Without SSE, GET /agent/runs/{id}/events returns paginated JSON. Use cursor for JSON pagination and Last-Event-ID for SSE replay.
Follow-up Runs
Use previousRunId to ask follow-up questions over a completed prior run:
The previous run must be completed and belong to the same team. A follow-up is a new create request that returns a new run ID (agent_run_*); previousRunId supplies prior-run context, it does not reuse the prior run’s ID or object.
Connect Data Sources
Use dataSources to attach Exa Connect providers to a run. The agent can call those partner tools alongside Exa web search when the query and outputSchema explicitly ask for the partner-specific data.
Use the Connect docs for provider IDs, pricing, and field-specific examples:
- Overview:
https://exa.ai/docs/reference/agent-api/connect/overview
- Combining providers:
https://exa.ai/docs/reference/agent-api/connect/combining-providers
- Provider pages:
fiber, similarweb, baselayer, affiliatecom, particle, financialdatasets, jinko, and additional-partners under /reference/agent-api/connect/
SDK Naming
Python uses snake_case:
TypeScript uses camelCase:
Critical Pitfalls
- Do not stop at create. Wait for a terminal status via polling or SSE events, then check how the run ended before reading
output; only completed carries results.
- Always set
effort explicitly.
- When building an app, expose
output.grounding (citations) where relevant in a product’s interface.
- Do not use
/agent for simple low-latency search; prefer /search.
- Do not leave unbounded arrays in
outputSchema when enrichment cost or result size matters.
- Use
input.data for known rows to enrich; do not paste huge row sets into query.
- Use
input.exclusion for records that should not be surfaced again.
previousRunId must reference a completed run.
budget.maxCostDollars is compatibility-only in the current spec; do not rely on it for enforcement.
Last modified on August 13, 2026