Core principles
Treatquery as a task specification. Name what Agent should find, the scope of the work, the evidence required, and what a complete result looks like.
outputSchema, Agent returns prose in output.text and citations in output.grounding. Add another field only when it has a clear job:
Keep rows, exclusions, and response shape in their dedicated fields rather than embedding them in
query.
Writing list-building and enrichment queries
For list building, define the entity, target count, qualification criteria, exclusions, and evidence bar. For enrichment, put the existing records ininput.data and describe only the research Agent should add.
Ask for a rationale when qualification requires judgment. Give examples only when a criterion has multiple plausible interpretations.
Handle asynchronous runs
Agent runs can take seconds to minutes while they search, read, and reason. Build around the lifecycle instead of holding an application request open.1
Create and persist
Create the run and save its returned
id with your request metadata. The create response is not the final result.2
Wait for a terminal state
Use an SDK polling helper, poll
GET /agent/runs/{id}, or consume the SSE stream. Continue while the run is queued or running.3
Store the result
Stop waiting at
completed, failed, or cancelled, then persist the terminal response and grounding.minimal or low when speed matters more than completeness.
For batches, benchmark representative tasks before estimating concurrency or putting Agent on a synchronous UI path. Runtime varies with item count, schema complexity, source availability, and effort.
For Zero Data Retention teams, consume the live stream or poll within the retention window. previousRunId and Connect dataSources are not available. See Zero Data Retention.
Write custom JSON schemas for structured output
UseoutputSchema when downstream code needs machine-readable fields, normalized values, table rows, or enrichment records. If a prose answer is enough, omit it and read output.text; structured output adds formatting work and can increase latency.
Keep research instructions in query and response shape in outputSchema. Use clear property names and descriptions, choose the narrowest useful types, and bound arrays with maxItems.
null when evidence does not support a field, even if the submitted schema marks it as required or non-nullable. stopReason: schema_satisfied means Agent considers the expected shape complete with those nulls allowed; it does not guarantee strict validation against the submitted schema.
Do not duplicate Exa’s built-in citations or confidence in your schema. Add a rationale field only when each item should explain why it qualifies, and persist output.grounding with the structured result. Verify important claims against their sources and test schema changes on representative inputs before shipping.
Browse the structured Agent examples to compare schemas for list building, KYB, job postings, exclusions, and continued runs.
Agent vs Search
Use Agent when the work requires several retrieval steps, per-entity verification, or enrichment over known records. Use Search when you need pages quickly and your application will perform the remaining reasoning.
Tips for common use cases
Next steps
Agent quickstart
Create a run, stream events, set effort, and read structured output.
Agent examples
Copy complete list-building, enrichment, KYB, exclusion, and follow-up requests.
Exa Connect
Add premium company, people, traffic, compliance, finance, and other provider data.
Search best practices
Retrieval quality, latency, and synthesis when Search is enough.