Índice do artigofaltam 8 min de leitura
We tested a question in the format a customer writes: whether we build AI chatbots and how they protect sensitive data. The single search brought back four passages about data protection among the top five, and the chatbot service page was left out. When we searched the two halves separately, the missing page started appearing among the top three results, and the article on sensitive data held the top two positions.
A regular RAG follows a fixed script: it receives the question, runs one search, hands the passages to the model and asks for the answer. This script works very well for the question the demo uses, which is short, complete and about a single subject.
The real question is almost never like that. It has two parts, depends on what was said before, requires comparing two documents, or needs a number that is not in any document. In these cases, searching once and answering produces a partial answer that looks complete, which is the worst category of error.
Agentic RAG is the architectural answer to this: instead of receiving a ready-made bundle of passages, the model takes control of the search. This article shows where the single search breaks, with measurements, and the five patterns that fix each type of break.
Article summary
- The single search fails in predictable ways: compound questions, follow-up questions, comparisons between documents and data that lives in a system.
- Retrieving more passages does not fix it. Doubling the list from 10 to 20 bought only 3.6 percentage points of accuracy.
- The cheapest pattern with the most direct effect on conversation is rewriting the question with the conversation's context: in our measurement, it took the top 3 from one relevant result to three.
- The price of going agentic is predictability. Cost and time start to vary by question, which requires an iteration cap designed from the start.
The difference, in one sentence
In regular RAG, the program decides how to search and the model only writes. In agentic RAG, the model decides how to search, looks at what came back and decides whether it needs to search again before writing.
It is a small change in description and a big one in consequence. The system no longer has a fixed number of steps; it has a cycle, which ends when the model judges it has enough material.
This improves the answer to hard questions and brings back a problem the simple architecture did not have: a system whose cost and response time vary from one question to the next.
Where the single search breaks
It is worth starting with what does not work, because it is everyone's first attempt: retrieving more passages. In our measurement over 638 questions with a known source document, doubling the list handed to the model from 10 to 20 passages raised accuracy from 74.9% to 78.5%, a gain of 3.6 percentage points.
What this flat curve says is that the missing material is not deeper in the same list. It is outside that search, and no number of passages from the wrong search will bring back the right answer.
The breaks follow patterns, and recognizing them is what lets you choose the right solution instead of adding generic complexity.
- Compound question"Do you do X and how does it handle Y?" The rarer half wins and the other disappears.
- Follow-up"And for the annual plan?" On its own, it points nowhere.
- Comparison"What is the difference between the two policies?" It requires two complete documents, not loose passages.
- System data"What is my contract balance?" The answer is in the ERP, not in text.
- Wrong vocabularyThe user calls it a ticket; the manual calls it an incident.
- Open question"What changed in the policy this year?" There is no single target document; there are several.
Pattern 1: decompose the question before searching
A question with two parts becomes a single search, and in that search the words from both halves compete with each other. The half with rarer terms dominates the score, and the other disappears.
We tested it with the question "do you build AI chatbots and how do they protect sensitive data", which is exactly the format a customer writes.
| Query | What came back |
|---|---|
| Whole question, one search | Four of the five passages about data protection. The chatbot service page did not appear |
| Only "do you build AI chatbots" | The service page appears in third place |
| Only "how to protect sensitive data in a chatbot" | The correct article in first and second place |
Queries to the prototype's index on August 31, 2026. The search is word-based (BM25). Its score has no fixed scale and adds up the contribution of each query term, so it only ranks results within the same query. That is why the table compares positions, not scores.
The effect the table shows is the lost half coming back to life: the service page, absent from the single search, appears when the question is split. With the two searches combined, the model receives material from both sides and can answer the whole question instead of half of it.
In practice, the pattern is a cheap step before the search: a small model reads the question and returns one or more queries, each searched separately, with the results combined afterward.
Simple questions come back with a single query and the added cost is negligible, which makes the pattern safe to apply to every question instead of trying to guess which ones need it.
Pattern 2: rewrite the question with the conversation's context
This is the pattern with the best effort-to-result ratio, and the most forgotten in prototypes, because in manual testing nobody asks the second question.
We took a real follow-up question, the kind that only makes sense after a previous answer, and compared the raw search with the search rewritten with the conversation's subject.
With the raw question, the first result was relevant and the next two had nothing to do with the subject. With the rewritten question, the top three results were relevant.
This matters because the model does not receive just the first result; it receives the whole list. Filling the context with two off-topic passages invites the model to mix subjects, and it is one of the most common sources of confused answers in long conversations.
Pattern 3: search, assess what came back, search again
This is where truly agentic behavior begins. Instead of handing the passages straight to drafting, the system asks the model whether that material answers the question. If it does not, it searches again with different words.
The signature gain of this pattern is solving the vocabulary problem without a vector database. The first search brings back partially right documents, and in them is the word the company actually uses. The second search uses that word and gets it right.
The signature risk is a cycle that does not converge. If no attempt satisfies the evaluator, the system spends several calls only to end without an answer. That is why the attempt cap and the give-up behavior need to be defined in advance, and giving up needs to be an honest refusal, not an improvised answer built from the best bad material available.
Pattern 4: leave the documents and query the system
A good share of the questions reaching a corporate assistant have no answer in any document, because the answer is data that changes: order status, contract balance, stock availability, next invoice date.
Here the system stops being retrieval only and gains tools: queries to an ERP, a CRM or an internal API, which the model calls when the question requires it.
The division of labor is clear and worth writing into the design: the document keeps explaining the rule, and the system supplies the number. Mixing the two roles, trying to keep changing values inside documents, is the fastest path to an outdated knowledge base.
This capability is the one that most expands what the assistant can solve on its own, and also the one that most changes the project's risk profile.
The design rule that reduces this risk is to keep tools narrow. A query that receives the contract identifier and returns three fields is auditable. A tool that accepts a free-form database query is not.
Pattern 5: verify the answer before delivering it
The last pattern is a checking pass: before showing the answer, the system checks whether each claim is backed by one of the retrieved passages, and removes or flags what is not.
It is the most expensive pattern per answer, because it duplicates the drafting work, and it makes the most sense in high-risk contexts such as legal, health, finance and audit responses. In regular customer service, it usually costs more than it is worth.
It is worth noting what it does not do: it checks whether the answer matches the retrieved material, not whether the material is correct. If the retrieved document is outdated, the verification approves it easily. It is a defense against the model extrapolating, not against a wrong knowledge base.
What going agentic costs
The trade-off is always the same: quality on hard questions, paid for with predictability.
| What changes | Simple RAG | Agentic RAG |
|---|---|---|
| Model calls per question | One, plus the scope filter | Variable, one per loop of the cycle |
| Response time | Stable | Varies with the number of loops |
| Cost per question | Predictable | Depends on the question, needs a cap |
| Debugging when it fails | Direct, a single path | Requires logging every decision in the cycle |
| Security surface | Reading documents | Grows a lot when there are tools |
The debugging row is the one that surprises teams most. In a fixed-step system, investigating a bad answer means looking at what was retrieved. In an agentic system, you need to reconstruct the sequence of decisions the model made, and that only exists if logging was built along with the system, not afterward.
Where it pays off and where it is overkill
Pays off
- The typical question has more than one part
- Usage is conversational, with follow-ups
- Some answers live in a system, not in text
- The user's vocabulary differs from the documents'
- The cost of a wrong answer is high
Overkill
- Questions are short, direct and about a single subject
- Usage is one-off lookups, with no conversation
- The knowledge base does not yet answer even simple questions well
- There is no evaluation set to prove the gain
- Response time is a hard product requirement
The third item in the right column is the most important and the most ignored. If the simple RAG still fails for lack of content, and that is the most common cause, the agentic version will search more times for the same nonexistent information, with more cost and more delay. Complexity does not create content.
What needs to be ready first
- A simple RAG working, with measured numbers that serve as a baseline
- A set of real questions that runs on every change, to prove the complexity improved something
- An iteration cap and a spending cap per question, decided before turning on the cycle
- A log of what the system decided in each loop, without which there is no way to investigate a bad answer
- A defined give-up behavior, with refusal text instead of improvisation
The adoption order that works is incremental, and each step can be verified on its own: first rewriting with context, then decomposition, then the search cycle, and only then tools and verification. Jumping straight to the end produces a system that is hard to debug and whose gain nobody can demonstrate.
Sources and method
The measurements come from a retrieval prototype over X-Apps' public content, run on August 31, 2026, with 374 documents and 2,563 passages. The recall evaluation used 638 questions written by the content team with a known source document.
The decomposition and context-rewriting comparisons are direct queries to the index, made on the same date, and are reproduced in the text by the position and relevance of the retrieved passages, not by score, which cannot be compared across queries.
Two scope caveats. First, these measurements evaluate retrieval, and the effect of the patterns on the final quality of the written answer was not measured here. Second, patterns 3, 4 and 5 are described as architectural decisions, based on what the failure measurement justifies, and do not come with their own measurement of production performance.
Frequently asked questions
It is a system in which the model controls the search process instead of receiving a ready-made bundle of passages. It can split the question, search again with different words, query a system in addition to documents and assess whether it already has enough material before answering.
Regular RAG searches once and answers. Agentic RAG decides how many searches to run and which ones, based on what it found. The trade-off is quality on complex questions in exchange for cost, response time and predictability.
For questions with two parts, follow-up questions that depend on the conversation's context, when the answer requires comparing documents, and when part of the answer lives in a system rather than in text.
Because the gain saturates. In our measurement, doubling the list from 10 to 20 passages increased accuracy by only 3.6 percentage points. What is missing is usually not deeper in the list; it is outside that search.
Yes. Each loop of the cycle is a call to the model, and the number of loops varies by question. This makes cost and response time less predictable, which needs to be built into the design with an iteration cap and a spending limit.
With rewriting the question using the conversation's context, which is the cheapest pattern and the one that changes the architecture the least. Only after that is it worth adding decomposition and iterative search.
No, and starting with it usually gets in the way. Without a simple RAG measured first, there is no way to know whether the added complexity solved anything or just made the system more expensive.





