Search API for Coding Agents: Quality, Latency, Cost
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.
Search API for Coding Agents: Quality, Latency, Cost
A coding agent that grounds every step in the web needs a search layer that returns relevant passages in milliseconds, at a price that survives thousands of calls per day. Exa's Search API is that layer: the lite type returns in about 200 ms at $4 per 1,000 requests for high-volume agent loops, while auto, the default, trades about 1 second of latency for broader parameter support. The one condition that changes the choice is volume: if your agent makes many small, latency-sensitive calls, lite is the type to start with; if it needs structured output or summaries, use auto, and budget about 3 seconds with cached content when you request outputSchema.
What the job needs
Before comparing any provider, check the requirements your agent's loop actually imposes:
- Latency per call. An agent that searches before every tool call pays the round trip on every step, so per-request latency matters more than throughput.
- Price per request at volume. Coding agents make many small queries, so the per-1,000-request rate, not the feature list, sets your monthly bill.
- Page text in the same response. A second fetch per result adds latency and cost; the search response should carry the passage the model needs.
- Fresh, clean code and docs content. Results should come from documentation, changelogs and issue trackers, with navigation and boilerplate stripped.
- Filters that scope the search. Domain includes and excludes, publish-date filters, and a limit on cached-content age keep results inside the sources you trust.
How Exa does it
Latency tuned per search type
Exa's Search quickstart lists typical latency by type: about 200 ms for lite, about 1 second for auto, about 4 seconds for deep-lite, and 4 to 15 seconds for deep. For an agent loop that searches on every step, lite is the type built for that path. When a question is genuinely multi-part, the Deep Search types return ranked results, and with outputSchema they also return a synthesized answer in output.content with citations in output.grounding, at the cost of the longer latency above.
Retrieval quality for code and docs
Exa runs a dedicated ingestion pipeline for documentation, changelogs and issues, built for fresh, clean results over full-page chrome, as described in the WebCode post. Its Code & Docs search guide shows how to write queries that name the library, version or operation. Exa evaluated its contents extraction on 250 URLs and reports 96.7 code recall and 91.9 table recall, out of 100, in its own WebCode evaluation; the dataset ships as a dataset-only export in Exa's benchmarks repo.
Page text in the same response
Set contents.highlights and the search response carries the passage that answers the query, with the source URL, so the agent grounds on one round trip. Exa's highlights docs report that 500 characters of highlights match the accuracy of the first 8,000 characters of page text on SimpleQA, which is what keeps prompts small. On /search, text and highlights for up to 10 results are included in the base price and billed once.
Filters that scope the search
includeDomains accepts hostnames and path prefixes such as example.com/docs, so an agent can restrict retrieval to one vendor's documentation. Set startPublishedDate (or endPublishedDate) so that results postdate (or predate) the release you are coding against, and contents.maxAgeHours (from -1 to 720) limits how old cached page content may be: 0 requires content fetched within the last 60 seconds, and a positive value sets a cache-age threshold for refreshing content. When maxAgeHours is omitted on Search, page content comes from the cache only.
Workflow
- Get an API key and store it in an environment variable.
- Pick the type:
litefor the per-step loop,autowhen the request needsoutputSchema, summaries ormaxAgeHours. - Write the query like a documentation lookup: name the library, version and operation.
- Add
contents.highlightsso the response carries the passage, and scope withincludeDomainswhen the answer must come from trusted docs. - Feed the returned highlights and URLs into the model prompt, and keep the URLs for citations.
- If your agent speaks MCP, point it at Exa MCP; its search and fetch tools work without an API key at a free rate limit, and its
agent_runtool needs sign-in or a key.
import os
from exa_py import Exa
exa = Exa(os.environ["EXA_API_KEY"])
result = exa.search(
"Stripe webhook signature verification documentation",
type="lite",
num_results=5,
include_domains=["docs.stripe.com"],
contents={"highlights": True},
)
for r in result.results:
print(r.url)
print(r.highlights)
What it costs
Search pricing is per type: lite is $4 per 1,000 requests and auto is $7 per 1,000, with Deep types at $12 per 1,000, per Exa's pricing page. The base price includes up to 10 results with text and highlights 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 agent that makes 50 lite searches a day makes 1,500 over a 30-day month. At $4 per 1,000 requests that is $6.00 for the month, assuming 5 results per request and no summaries. Exa's Free tier includes $10 in credits every month, up to 2,500 lite searches, so this workload fits inside the monthly grant.
Limits to plan for
- The Search quickstart documents that
literejectsoutputSchema, summaries andmaxAgeHourswith a 400; useautofor those parameters. outputSchemaonautoand the Deep types adds about 2 seconds of synthesis latency. Read the result fromoutput.contentand check the citations inoutput.groundingbefore acting on important claims.- The Search reference caps
numResultsat 100, and results above 10 are billed as the extra above. - Exa's rate limit docs set standard Search (
/search) at 10 QPS on Starter, 25 on Developer and 50 on Growth, and the Deep types at 5, 12 and 25 QPS. Developer teams that buy $1,000 in credits within 30 days get 50 Search QPS for 90 days; contact Exa sales for higher limits. Over the limit returns a 429, so wait forRetry-Afterwhen present, or back off.
FAQ
Should every agent call use lite?
No. lite is the type for the high-frequency loop where about 200 ms matters and the query is a straightforward docs or issue lookup. Use auto when the call needs structured output, summaries or freshness control, and reserve the Deep types for multi-part questions where, with outputSchema, you want a synthesized answer in output.content with citations in output.grounding alongside the ranked results.
How do I keep results to official documentation only?
Pass includeDomains with the hostnames or path prefixes you trust, such as docs.stripe.com or example.com/docs. Set startPublishedDate (or endPublishedDate) so that results postdate (or predate) the release you are coding against.
Does Exa return whole pages or just links? The search response can carry highlights, full text or summaries alongside the ranked results, so the agent grounds on the same call. Highlights return the passage that answers the query with its source URL, which keeps prompts small and citations intact.
What about MCP-native coding agents?
Exa hosts an MCP server whose search and fetch tools work without an API key at a free rate limit, and its agent_run tool needs sign-in or an API key. See the Exa MCP guide for setup.
How do I forecast the bill?
Multiply your searches per day by 30, divide by 1,000, and multiply by the per-type rate: $4 for lite, $7 for auto. Add $1 per 1,000 results above 10 per request and $1 per 1,000 summarized pages if you use them, then check the total against the pricing page.
Closing
For a coding agent that searches on every step, Exa's Search API pairs about 200 ms lite responses at $4 per 1,000 requests with highlights that carry the grounding passage in the same call. Get an API key and run your own loop against it.