---
title: "How to Choose a Web Search API for AI Agents (7-Step Guide)"
description: "Match search to your agent type, test answer quality on your own queries with a small Python harness, measure p95 latency under concurrency, compare return formats and token cost, price it at your real volume, and check limits, ZDR and integration."
category: "guides"
url: https://keirolabs.cloud/blog/how-to-choose-web-search-api
published: 2026-11-24
updated: 2026-11-24
---

# How to choose a web search API for your AI agent: a 7-step evaluation

## The 60-second version

**Choose a web search API for your AI agent by testing it on your own queries, not by reading benchmark tables.** The things that decide whether it works in production are:

| Criterion | What to check | Why it matters for agents |
|---|---|---|
| **Answer quality** | Is the answer in the top 5 results for *your* questions? | The model can only be as right as what it reads |
| **Latency** | p95, not average, under realistic concurrency | Agents search several times per answer; slow tails add up |
| **What it returns** | Snippets, full page text, markdown, embeddings | Decides your token bill and whether you need a second API |
| **Price at your volume** | Cost per 1,000 searches *including* content calls | Content and research calls often cost 10–50x a basic search |
| **Rate limits** | Requests per minute and concurrency | Agents burst: one question can fan out into 5–10 searches |
| **Freshness** | Can it find last week's news? Date filters? | Agents are used for exactly what the model doesn't know |
| **Data retention** | Zero data retention available? On which plan? | Queries reveal what your users are working on |
| **Integration** | REST, SDKs, MCP server, output format | How fast you ship, and whether it fits your framework |
| **Free tier** | Enough to run a real evaluation | You should test before you pay |

**The process:** write 30 to 50 of your real questions, run each candidate through the harness below, compare the numbers, then check price and limits at your expected volume.

## Step 1: Decide what your agent needs from search

**Different agents need different things from search.** Start by matching your agent to a pattern:

| Agent type | Needs most | Typical setup |
|---|---|---|
| Chat assistant answering live questions | Speed, good snippets | Fast search returning snippets; fetch a page only when needed |
| Research agent writing reports | Depth, full page text, many queries | Search plus content or a deep research endpoint |
| RAG over the live web | Clean text, chunks, embeddings | Search that returns content, ideally pre-chunked |
| Enrichment at volume (leads, products) | Low price per query, high limits, batch | Cheapest lite search plus batch processing |
| Coding agent | Docs and changelogs, freshness | Search with domain filters, plus page extraction |

**This narrows the field before you test.** An API that only returns snippets is fine for a chat assistant and painful for a RAG pipeline.

## Step 2: Test answer quality on your own queries

**Public benchmarks are a starting point, not a decision.** SimpleQA, FinanceBench and similar tests ([benchmarks that matter](/blog/search-api-benchmarks-that-matter-2026-financebench-simpleqa)) measure general accuracy. Your agent's questions are narrower: your industry, your users' phrasing, your freshness needs.

**A minimal evaluation harness:** each case is a real question plus a string the correct answer must contain. It measures how often that string appears in the top 5 results, and the latency:

```python
import os, statistics, time, requests

# Your real questions, each with a string the right answer must contain.
CASES = [
    ("latest stable python version", "3.15"),
    ("postgres 18 release date", "2025"),
    ("capital of australia", "canberra"),
    # ... 30 to 50 of your own
]

def keiro(query: str) -> list[dict]:
    r = requests.post("https://api.keirolabs.cloud/api/v2/search/lite",
                      headers={"Authorization": f"Bearer {os.environ['KEIRO_API_KEY']}"},
                      json={"query": query, "count": 10}, timeout=30)
    r.raise_for_status()
    return r.json()["results"]

def evaluate(search, cases, k: int = 5) -> dict:
    hits, times = 0, []
    for query, expected in cases:
        t = time.perf_counter()
        results = search(query)
        times.append(time.perf_counter() - t)
        text = " ".join(f"{x.get('title', '')} {x.get('snippet', '')}" for x in results[:k]).lower()
        hits += expected.lower() in text
    times.sort()
    return {"answer_in_top_k": hits / len(cases),
            "p50_s": round(statistics.median(times), 2),
            "p95_s": round(times[min(len(times) - 1, int(len(times) * 0.95))], 2)}

print(evaluate(keiro, CASES))
```

**To compare providers, write one small function per provider** that returns a list of `{title, url, snippet}`, and run `evaluate` on each. Keep the cases identical.

**Make the cases hard in the ways your agent's are:**

- **Recent events:** things from the last month.
- **Exact numbers:** prices, versions, dates, financial figures.
- **Long-tail entities:** small companies, niche products, specific people.
- **Your users' wording:** messy, abbreviated, sometimes wrong.

**Also run an end-to-end check.** Feed the results to your actual model and grade the final answers, because "the answer is in the snippets" and "the model got it right" aren't the same thing. Our [grounding guide](/blog/grounding-ai-agents-web-search) covers the prompt and citation checks.

## Step 3: Measure latency the way your agent uses it

- **Use p95, not the average.** An agent waiting on 3 searches in sequence feels the slowest one.
- **Test with concurrency.** Fire 10 to 20 parallel searches, because agents often fan out ([query fan-out](/blog/query-fan-out)). Some APIs slow down or return 429 errors under bursts.
- **Test from your deployment region.** Latency from your laptop isn't latency from your servers.
- **Separate search from content.** Snippet searches and full-page content calls can differ by seconds. Measure the endpoint you'll actually call.

There's a multi-provider latency comparison in [the fastest web search API for AI agents](/blog/fastest-web-search-api-for-ai-agents-2026).

## Step 4: Check what it returns, and what that costs in tokens

**The result format can matter more than the search price.** Every token of results goes into your model's context, and in an agent loop it's re-sent on every step.

| Returns | Size | Best for |
|---|---|---|
| Title, URL, snippet | ~65 tokens per result | Deciding what to read; most chat answers |
| Full page as markdown | Thousands of tokens per page | Answers that need details |
| Main content only | Often 75% to 99% smaller than raw HTML | Reading pages without the boilerplate |
| Chunks with embeddings | Fixed-size pieces you choose | RAG: rank chunks, send only the best |

These numbers come from [our token measurements](/blog/context-engineering-web-search-agents). **Prefer an API that gives you all of these,** so you start with snippets and fetch only what the model needs.

## Step 5: Price it at your real volume

**Model your monthly cost from your traffic, not the headline price:**

```text
monthly cost = questions per month
             × searches per question
             × (search price + share that need content × content price)
```

**Example:** 50,000 questions × 3 searches × (basic search + 20% needing page content). The content calls often cost more than every basic search combined.

**Check also:**

- **Minimum commitments, and what overage costs.**
- **Whether credits expire.**
- **Whether failed or empty searches are billed.**
- **Batch pricing for offline jobs.** On Keirolabs, batch runs at 0.5 credit per query.

Our [pricing calculator](/tools/search-api-pricing-calculator) and [cost per query comparison](/blog/search-api-cost-per-query-latency) help with the arithmetic.

## Step 6: Check limits, retention and terms

- **Rate limits:** requests per minute on your plan, and how 429s are signalled ([rate limits compared](/blog/search-api-rate-limits-2026)).
- **Zero data retention:** if your users' queries are sensitive, check whether ZDR exists and on which plan. Most providers reserve it for enterprise ([web search APIs with ZDR](/blog/web-search-api-zero-data-retention)).
- **Terms of use:** can you store results, show them to end users, or use them to train models? This varies, and matters if you cache.
- **Reliability:** a status page, error semantics, and what happens when an upstream source is down.

## Step 7: Check how it fits your stack

- **A plain REST API** works with every framework and model.
- **An MCP server** lets Claude Code, Cursor and other MCP clients use it with no code ([MCP and web search](/blog/mcp-model-context-protocol-web-search-2026-guide)).
- **Model-agnostic matters.** Built-in search tools from OpenAI, Anthropic and Google work only with their own models, at $10 to $35 per 1,000 searches ([built-in search compared](/blog/llm-web-search-api)). A standalone API works with all of them, including local models ([Ollama web search](/blog/ollama-web-search)).

## Where Keirolabs fits

**We built Keirolabs for agents, so here is how it maps to the checklist.** Test it the same way as any other provider:

- **Return formats:** snippets (`/search/lite`), results with full text and optional embedding chunks (`/search/content`), page extraction (`/extract`), and a deep research endpoint (`/deep`, 96.5% on SimpleQA in [our latest results](/blog/deep-search-update)).
- **Price:** lite search from $0.03 to $0.10 per 1,000 on plans; batch at 0.5 credit per query.
- **Zero data retention:** `"zdr": true` on any paid plan, confirmed per response by an `X-Keiro-ZDR: on` header.
- **Integration:** REST plus an MCP server.
- **Free tier:** up to 2,000 credits with no card, enough to run the harness above on 50 questions many times over.

[Get a key](https://platform.keirolabs.cloud/register) and run your own cases.
