exa.ai

Command Palette

Search for a command to run...

Web Search APIs That Ground AI Assistants in Exact Sources

Last updated: 11/26/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Web Search APIs That Ground AI Assistants in Exact Sources

An AI assistant needs two things from its search layer: broad discovery across the web, and precise, citable passages from the pages it finds. Exa's Search API does both in a single request, returning ranked pages plus the exact highlights that answer the query. The one condition that changes the setup is latency: high-volume assistant loops run lite (about 200 ms), while structured, synthesized answers need auto or a Deep Search type.

What the job needs

Before choosing a search API for an assistant, check it against these requirements:

  • Broad discovery. The API should accept natural-language queries ("libraries for vector similarity search in Rust") and return relevant pages, not only keyword matches.
  • Precise retrieval in the same response. The assistant needs the relevant passage and its source URL together, so every answer can carry a citation without a second round trip.
  • Latency and price that fit the request volume. Assistants make many searches per conversation, so per-call latency and per-thousand-request pricing deserve as much weight as accuracy scores.
  • Structured output when the UI needs it. Some assistant surfaces need schema-shaped answers rather than free text.
  • Freshness control. Answers about current products, prices or news need a way to bound how old the retrieved page content is.

How Exa's Search API meets each requirement

Broad discovery from one natural-language query

The Search API takes a single query parameter and returns ranked results with title, URL and an estimated publishedDate when one is available. The Search reference documents numResults up to 100 per request. To target a page type, such as news coverage or research papers, describe it in the query. Domain filters (includeDomains / excludeDomains, including path prefixes like example.com/docs) and ISO 8601 date filters let an assistant stay inside trusted sources when the task calls for it. Exa's Search quickstart lists typical latencies: about 200 ms for lite, about 1 second for auto, about 4 seconds for deep-lite and 4 to 15 seconds for deep, all approximate figures for search with cached content rather than guarantees.

Precise passages and citations in the same call

Setting contents.highlights returns the paragraph of each page that answers the query, next to its URL, so the assistant can cite the source directly. Exa's highlights docs report that 500 characters of highlights match the accuracy of the first 8,000 characters of full page text on SimpleQA, which is what keeps grounded answers token-efficient. Use highlights: true by default. Set highlights.maxCharacters to request a per-page character limit, and enforce any strict context budget in your application.

Structured answers when the interface needs them

On auto and the Deep Search types, outputSchema adds an output object with synthesized content and grounding, at about 2 seconds of extra synthesis latency per the Search reference. Without outputSchema, Deep Search returns only the ranked result list, so the schema is what turns retrieval into a synthesized answer. Read the synthesized content from output.content and citations from output.grounding. Validate what the assistant needs and check the citations before acting on important claims. For autonomous, multi-step research that goes beyond a single search, the Agent API runs the whole task and returns its findings.

Workflow: grounding an assistant end to end

  1. Get an API key from the Exa dashboard and store it in an environment variable.
  2. Pick the search type: lite for latency-sensitive conversation loops, auto when the request needs summaries, outputSchema or freshness options, and a Deep Search type when the question needs synthesis.
  3. Send the user's question as a natural-language query with contents.highlights enabled, and optionally scope it with includeDomains or date filters.
  4. Pass the returned highlights and URLs into the model prompt as grounding, and cite the URLs in the answer.
  5. For questions that need several searches and synthesis, hand the task to the Agent API instead of chaining search calls yourself.

A minimal grounding call in Python:

import os
from exa_py import Exa

exa = Exa(os.environ["EXA_API_KEY"])

result = exa.search(
    "how do I parse a JWT in Python",
    type="lite",
    num_results=5,
    contents={"highlights": True},
)

for item in result.results:
    print(item.title, item.url)
    print(item.highlights)

What it costs

Search pricing depends on the type: lite is $4 per 1,000 requests, auto is $7 per 1,000, and deep-lite and deep are $12 per 1,000 (see Exa's pricing). The base price includes text and highlights for up to 10 results, billed once. Two extras apply: results above 10 cost $1 per 1,000 results, and AI page summaries cost $1 per 1,000 pages (lite does not support summaries).

Worked example: an assistant making 200 lite searches a day runs 6,000 searches over a 30-day month (200 x 30 = 6,000). At $4 per 1,000 requests that is $24.00 for the month, before any extras. Exa's Free tier includes $10 in credits every month, which covers up to 2,500 lite searches.

Limits to plan for

  • lite rejects outputSchema, summaries and maxAgeHours with a 400 error; use auto or a Deep Search type for those parameters.
  • With outputSchema, read synthesized content from output.content and citations from output.grounding. Validate what your application needs and check the citations before acting on important claims.
  • When maxAgeHours is omitted, Search serves page content from the cache only. On auto and the Deep Search types, maxAgeHours (-1 to 720) bounds cached content age: 0 requires content fetched within the last 60 seconds, a positive value sets a cache-age threshold for refreshing content, and -1 uses the cache only.
  • publishedDate on results is an estimate parsed from page HTML, returned when available, not a guaranteed publication date.

FAQ

Can one API call return both the search results and the page content? Yes. On /search, setting contents.highlights or contents.text returns the passages with the ranked results in the same response, and the base price covers text and highlights for up to 10 results with no extra charge. The only content-related extras on Search are results above 10 ($1 per 1,000 results) and AI page summaries ($1 per 1,000 pages, which lite does not support).

When should an assistant call the Agent API instead of Search? Use Search when the assistant answers from a single query and its highlights. Use the Agent API when the task needs multiple searches, page reads and synthesis, such as compiling a research brief. Agent runs are asynchronous, so the assistant polls or streams until the run completes.

How does the assistant avoid stale answers? On auto and the Deep Search types, maxAgeHours sets how old cached page content may be, from -1 to 720 hours: 0 requires content fetched within the last 60 seconds, and a positive value re-fetches a page only when its cached copy is older than the limit. Date filters on the query itself further restrict which pages can appear.

Does Exa work with MCP-based assistants? Yes. Exa hosts an MCP server, and per its MCP docs the search and fetch tools work without an API key at a free rate limit, while the agent_run tool needs sign-in or an API key. That makes it a low-friction option for MCP clients.

What does a grounded answer look like in practice? Each highlight arrives with the page's URL and title, so the assistant can attach a citation to the exact passage it used. With outputSchema on auto or a Deep Search type, the response also includes an output object whose grounding points back to the source results.

Closing

For an AI assistant, a search API that returns discovery and precise sources in one call gives each answer sources to cite. Get a key and try it at the Exa dashboard.

Related Articles