AI agents
Search and Retrieval Tools for Agents
Design search, retrieval, ranking, source selection, and evidence handling for agentic tasks.
By the end you can
- Define agent search and retrieval as an operational contract rather than a capability label
- Contrast Open-web search with Controlled corpus in “A research agent cited the first five pages returned by a search engine”
- Trace “Retrieval can amplify one source into the appearance of consensus” through a concrete execution path
- Produce “Design an evidence-seeking run” with evidence for “Every material claim maps to a retrievable evidence item”
Two shipped legal research tools were misgrounded 17 to 33 percent of the time
Search tools discover candidates. Retrieval tools fetch content. Ranking chooses what enters context. None of these stages proves that a claim is current, independent, authoritative, or supported by the selected passage.
That gap has been measured on products that were sold as having closed it. Two commercial legal research tools were run through over 200 preregistered legal queries, the first preregistered evaluation of retrieval-augmented legal research. LexisNexis's Lexis+ AI answered 65 percent of the queries accurately. Thomson Reuters's Westlaw AI-Assisted Research answered 42 percent. Both hallucinated between 17 and 33 percent of the time. The study appeared in the Journal of Empirical Legal Studies in 2025.
The number is only usable because of the definition sitting behind it. A response counted as hallucinated if it was incorrect, or if it was misgrounded. Misgrounding is the retrieval failure this lesson is about, and Magesh and colleagues put it in one sentence: “A response is misgrounded if key factual propositions are cited but misinterpret the source or reference an inapplicable source.” The citation is present. The source exists and is real. It does not say what the sentence says. Nothing in the rank order tells that case apart from a correct one.
Agents should retain query, source, retrieval time, passage boundaries, and citation links so later checks can reproduce how evidence entered the run.
Rank order records what looked relevant to a query, and a passage can sit at the top of that list without containing the claim it is cited for.
Example
Twenty retrieved documents scored below retrieving none at all
The reflex when an answer looks thin is to retrieve more documents. Someone measured what more actually buys. Hold the information constant. Hide one relevant document inside a retrieved stack, then move it around. Multi-document QA accuracy traces a U-shaped curve: highest when the relevant passage sits near the beginning or the end of the input, lowest when it sits in the middle. The result was published in 2024, under a title that says it — Lost in the Middle.
The two ends of the scale are the useful part. Given only the single relevant document, the oracle setting, GPT-3.5-Turbo reached 88.3 percent. Given nothing at all, it scored 56.1 percent closed-book. Retrieval is supposed to live between those two numbers. It did not always: “GPT-3.5-Turbo’s multi-document QA performance can drop by more than 20%—in the worst case, performance in 20- and 30-document settings is lower than performance without any input documents (i.e., closed-book performance; 56.1%).”
A pipeline that retrieved twenty documents, one of them correct, and placed the correct one in the middle would have been better off retrieving nothing. Retrieval count was the metric that looked like progress. Passage position was the variable that decided the answer.
- Decision at stake: Design search, retrieval, ranking, source selection, and evidence handling for agentic tasks.
- Hidden assumption: More retrieved documents always improve answer reliability — refuted at 20 and 30 documents, where accuracy fell below the 56.1 percent closed-book score with no documents at all.
- Primary control question: Does the run know where in the context each retrieved passage landed, and is that position ever varied as a test rather than left to the ranker?
- Evidence to collect: Every material claim maps to a retrievable evidence item, and the same question is re-run with the supporting passage moved, so a swing in the answer is attributed to placement rather than to evidence.
Case
GAIA: 92 percent human, 15 percent GPT-4 with plugins; BrowseComp: 0.6 to 1.9 with browsing
GAIA poses 466 questions that need browsing, tool use and multimodal reading while staying conceptually simple for a person. Human respondents scored 92 percent. GPT-4 with plugins scored 15 percent. The answers to 300 of the questions are withheld, so the leaderboard cannot be fitted by memorisation.
BrowseComp isolates the tool itself. OpenAI published it on 16 April 2025: 1,266 questions with hard-to-find answers. It measures what a search tool adds when it is bolted onto a model that does not know how to use it. Giving GPT-4o browsing raised accuracy from 0.6 percent to 1.9 percent. OpenAI o1, with no browsing at all, reached 9.9 percent. Deep Research reached 51.5 percent. The questions are genuinely hard rather than obscure trivia: human trainers gave up after two hours on 888 of the 1,255 questions they attempted, 70.8 percent.
The authors draw the conclusion themselves: “Enabling browsing for GPT-4o led to a modest improvement in accuracy (from 0.6% to 1.9%), but performance remained low. This indicates that browsing alone is not sufficient—models must also be capable of reasoning strategically, identifying relevant search paths, and interpreting retrieved content.” Discovery was never the hard part. Deciding what the retrieved text supports is.
Comparison
A decision table for agent search and retrieval, and what "adversarial content" means
Open-web search, a controlled corpus, and a structured system query differ mainly in who decides what counts as a source. On the open web the model decides while it works: high coverage, variable quality, adversarial content. In a curated corpus, whoever built it decided in advance. That buys stronger provenance, at the price of freshness and of somebody having to do the curating. In a structured query the schema decided long before either: precise fields, schema dependent, and it may omit the context that would have changed the reading. Whichever you pick, the test afterwards is the same. Every material claim maps to a retrievable evidence item, and the reader can open that item without asking the agent to explain itself.
"Adversarial content" is the bullet that sounds like a caveat and is not. Text planted in a page can act on the system that later retrieves it. That was demonstrated in 2023 against deployed systems, including Bing's GPT-4-powered Chat and code-completion engines. Greshake and colleagues named the technique Indirect Prompt Injection, and stated the mechanism: “We reveal new attack vectors, using Indirect Prompt Injection, that enable adversaries to remotely (without a direct interface) exploit LLM-integrated applications by strategically injecting prompts into data likely to be retrieved.”
That is the real difference between the three columns. A retrieved passage is not inert text that the agent reads. It is text that can act on the agent. On the open web the attacker gets to choose what is in it. A controlled corpus does not make a source true. It does decide in advance who is allowed to write into the channel the model reads from.
Open-web search
Broad discovery across changing public sources.
- High coverage
- Variable quality
- Adversarial content
Controlled corpus
Retrieval from an approved and versioned collection.
- Stronger provenance
- Limited freshness
- Requires curation
Structured system query
Direct access to databases or authoritative APIs.
- Precise fields
- Schema dependent
- May omit context
Key idea
Five planted texts among millions carried the answer 90 percent of the time
Syndication, copied articles, and circular citations make repeated claims look independent. Agents that count sources without lineage may overstate confidence. The count is also cheap to attack from outside.
Five texts turned out to be the whole price. An attack called PoisonedRAG planted crafted passages in a knowledge database of millions and pulled out the answer its authors had chosen. It was presented at USENIX Security in August 2025. Zou and colleagues report it in the abstract: “Our results show PoisonedRAG could achieve a 90% attack success rate when injecting five malicious texts for each target question into a knowledge database with millions of texts.” Five crafted texts per target question, against a corpus of millions, nine times out of ten. The defences the authors tested were insufficient against it.
The lesson is not only about attackers. A retrieval stage that promotes five near-identical passages behaves the same way whether those copies were planted deliberately or produced by ordinary syndication. Deduplicate by origin, prefer primary evidence, and preserve disagreement instead of forcing a single narrative.
A confidence score built by counting copies of one article is a measurement of syndication, not of truth — and five copies were enough to buy a 90 percent attack success rate.
Visual
Across 18 datasets and 10 systems, BM25 was still the baseline to beat
A query plan produces candidates. Source filtering discards most of them. Passage selection decides what actually enters context. The stages run in that order. Break the information need into claims, entities, dates, and source types. Retrieve candidates with lexical, semantic, structured, or domain-specific search. Filter on authority, recency, independence, rights, and access. Select text that directly supports or contradicts the target claim. Then record source, quote location, retrieval time, and unresolved conflicts in an evidence ledger. Passage selection and the evidence ledger need separate owners and separate tests.
The retrieval step is where teams assume the newest method wins. BEIR is the measurement that says otherwise. It assembled 18 publicly available retrieval datasets across diverse tasks and domains, then evaluated 10 state-of-the-art retrieval systems on them: lexical, sparse, dense, late-interaction and re-ranking. That was in 2021. Thakur and colleagues state the outcome in the abstract: “Our results show BM25 is a robust baseline and re-ranking and late-interaction based models on average achieve the best zero-shot performances, however, at high computational costs.” Dense and sparse retrieval models, though computationally cheaper, often underperformed other approaches out of domain.
Two consequences follow for the map above. First, the choice at candidate retrieval is an empirical question per domain, not a default. A lexical baseline you can debug may beat an embedding model you cannot, on data neither was tuned for. Second, semantic similarity ranks passages by how much they resemble the query. It does not rank them by whether the source is authoritative. It does not rank them by whether the passage contains the claim. That is the job of source filtering and passage selection, and no amount of similarity does it for you.
- 1
Query plan
Break the information need into claims, entities, dates, and source types.
- 2
Candidate retrieval
Use lexical, semantic, structured, or domain-specific search.
- 3
Source filtering
Apply authority, recency, independence, rights, and access rules.
- 4
Passage selection
Choose text that directly supports or contradicts the target claim.
- 5
Evidence ledger
Record source, quote location, retrieval time, and unresolved conflicts.
Steps
Design an evidence-seeking run
Set up a run whose object is evidence rather than an answer. Use a question your team has already researched by hand. Because you already know the answer, you can watch what the retrieval did to reach it. Write claim units: split the task into statements that can be supported independently. Choose source classes — primary records, official documentation, datasets, expert analysis. Diversify queries with dates, alternative terms, and contradiction-seeking searches. Record provenance: source identity, passage, timestamp, access path. Then grade each claim as supported, contradicted, uncertain, or outside scope.
Three checks turn this from a demo into a test. Trace each sentence the agent produced back to the document it came from, and ask the misgrounding question of every one: do the cited words carry the proposition, or do they merely sit near it? Count how many of those documents are independent of one another rather than copies of a common original. Then re-run the same question with the supporting passage moved from the middle of the context to the front. A pipeline whose answer changes when only the position changed has told you it is reading placement, not evidence.
The run has earned its keep the moment two confident citations turn out to lead back to the same place.
- 1
Write claim units
Split the task into statements that can be supported independently.
- 2
Choose source classes
Specify primary records, official documentation, datasets, or expert analysis.
- 3
Diversify queries
Use dates, alternative terms, and contradiction-seeking searches.
- 4
Record provenance
Store source identity, passage, timestamp, and access path.
- 5
Grade support
Label each claim as supported, contradicted, uncertain, or outside scope.
Sourcing, not fluency, was the largest failure in 2,709 audited answers
Search agents need explicit source-quality and conflict policies. Without them a capable model can produce a polished synthesis of poor evidence. A synthesis of many agreeing pages reads exactly like a synthesis of one page quoted by many sites.
The largest audit of that failure was run by people who do sourcing for a living. Journalists from 22 public service media organisations, across 18 countries and 14 languages, evaluated AI assistant answers about the news. Of 2,709 evaluated core responses, 45 percent had at least one significant issue. The dominant cause was not style, reasoning or tone. The report states: “Sourcing was the biggest cause of problems, with 31% of all responses having significant issues with sourcing – this includes information in the response not supported by the cited source, providing no sources at all, or making incorrect or unverifiable sourcing claims.” The European Broadcasting Union and the BBC published it as "News Integrity in AI Assistants" on 21 October 2025.
The spread between systems is the argument for writing the policy down rather than trusting the model. Gemini was an outlier: 72 percent of its responses carried a significant sourcing issue, against 24 percent for ChatGPT and 15 percent for Perplexity and Copilot. Same task, same evaluators, 15 percent at one end and 72 percent at the other. What separates them is not raw capability. It is what each system does when the retrieved evidence is thin, absent or contradictory. That is a rule about sources, not a better model. Count independent origins rather than documents, and make the output say which claim rests on which origin.
Without a written rule for which sources win and what to do when they disagree, the model settles it silently and the answer reads just as fluently either way.
Key takeaways
- Search tools discover candidates; retrieval tools fetch content; ranking chooses what enters context — and on BrowseComp's 1,266 questions, giving GPT-4o browsing moved accuracy from 0.6 percent to 1.9 percent.
- Misgrounding has a measured rate: over 200 preregistered legal queries put Lexis+ AI at 65 percent accurate and Westlaw AI-Assisted Research at 42 percent, hallucinating between 17 and 33 percent of the time.
- More documents is not more reliability: GPT-3.5-Turbo's accuracy in the 20- and 30-document settings fell below its 56.1 percent closed-book score, against 88.3 percent given only the single relevant document.
- The retrieval method is an empirical choice, not a default: across BEIR's 18 datasets and 10 systems, BM25 remained a robust zero-shot baseline while dense and sparse models often underperformed out of domain.
- Count independent origins, not agreeing documents: five crafted texts per question in a database of millions bought PoisonedRAG a 90 percent attack success rate, and indirect prompt injection makes a retrieved passage something that can act rather than merely be read.
- Write the source-quality and conflict policy down: the EBU and BBC found sourcing the single largest failure in 2,709 audited responses at 31 percent, ranging from 72 percent for Gemini to 15 percent for Perplexity and Copilot.