Book a free call

Agentic RAG Best Practices: Keep Retrieval Agents Accurate

Agentic RAG lets an agent plan, search and check its own sources before answering. These practices keep retrieval accurate, sources visible and mistakes cheap.

Hertiv engineering teamReviewed by a senior engineer
8 min read
Agentic RAG Best Practices: Keep Retrieval Agents Accurate
On this page

Short answer

Agentic RAG best practices start with letting the agent plan what to look for before it searches, giving it narrow retrieval tools instead of open access, and checking each retrieval step before the answer is written. The agent should cite the passages it used, stop when sources disagree, and log every step so a team can test its traces, not just its final answers.

What is agentic RAG, and how is it different?

Agentic RAG is a retrieval pattern in which an AI agent decides what to search for, runs the searches itself, and checks the results before it answers. Unlike plain RAG, where one fixed query is turned into one retrieval step, the agent can break a question apart, search several sources in turn, and change its plan when the first results are thin or contradictory.

The difference matters because hard questions rarely map to one search. A support question about a billing error might need a pricing page, a changelog and a ticket history. A fixed pipeline fetches whatever the first query returns; an agent can fetch the pricing page, see that it does not cover the case, and then search the changelog.

That flexibility is the benefit, and also the risk: every extra step is another chance to retrieve the wrong thing.

Part Plain RAG Agentic RAG
Who plans the search Fixed pipeline The agent, per question
Retrieval steps One, then answer Several, with checks
Sources used One index Several tools and indexes
When it stops After one pass When evidence is enough
Failure mode Wrong passage, wrong answer Wrong plan, wasted steps

The practices below apply to the agent layer, not to the retrieval basics. Chunking, embedding quality and index hygiene still matter, and the general RAG best practices cover those. What follows is what changes once an agent is doing the searching.

Why should the agent plan before it retrieves?

The agent should plan before it retrieves because a good plan turns one vague question into a small set of answerable searches. Without a plan, the agent fires off the user's words as a query, gets a mixed set of passages, and then has to guess which parts matter. With a plan, it states what it needs to find, in what order, and what would count as enough evidence.

A workable plan is short: two to four sub-questions, each tied to a source. For a question about a refund policy change, the plan might be to find the current policy text, then the date it changed, then any exceptions for annual plans. Each sub-question maps to one retrieval tool or index, so the agent is not searching the whole corpus for every part.

Planning also gives you something to test. When an answer is wrong, you can read the plan and see whether the agent searched for the wrong thing, searched the right thing in the wrong place, or searched well and still reasoned badly. That is far more useful than a log that only shows the final answer.

Keep the plan in the trace, and keep it short enough that a human can read it in under a minute.

How do you keep retrieval tools narrow and safe?

You keep retrieval tools narrow by giving the agent one tool per source, each with a clear name and a short description of what it returns. A tool called "search help centre" should search only the help centre; a tool called "search tickets" should search only tickets. When tools are broad or overlapping, the agent picks at random and you cannot tell why.

Each tool should also limit what it returns. Cap the number of passages, cap their length, and return the source title and date with each passage. Long, unlabelled passages push the agent toward quoting text it cannot place, and they crowd out the passages that matter. A limit of five to eight passages per call is a sensible starting point for most support and internal-search agents.

Safety comes from the same narrowness. Retrieval tools should be read-only: they fetch text and return it, and they never write, delete or call another system. If the agent needs to act, that is a separate tool with its own approval rules, as described in the agentic AI governance framework. Keeping retrieval read-only means a bad plan wastes time instead of changing data.

Why retrieve in steps instead of all at once?

Retrieving in steps works better than fetching everything at once because each step can use what the previous step found. The first search locates the right document; the second searches inside it; the third checks a detail the first two raised. A single large fetch cannot do that, because it has to guess the whole information need before seeing any of it.

Step-by-step retrieval also keeps the agent's working text short. When ten long passages arrive at once, the model has to weigh all of them and often leans on the first or the longest. When passages arrive in small groups, the agent can summarise each group, keep the useful facts, and drop the rest before the next step. That keeps the final answer grounded in a small set of passages it actually used.

Set a step limit so the loop always ends. Three to five retrieval steps cover most questions; after that, the agent should answer with what it has and say what is missing, rather than keep searching. A cap also bounds cost and latency, which grow with every extra call. Log the step count per question so you can see whether the cap is cutting off good answers or stopping wasted loops.

How do you keep the agent's answers tied to sources?

You keep answers tied to sources by requiring the agent to quote or cite the passages it used, and by checking those citations before the answer reaches a user. A citation is only useful if it points at a real passage: the source title, the section, and the exact words the answer relies on. A citation that points at a whole document is little better than no citation.

Build the check into the flow, not into a review queue. After the agent drafts an answer, a small verification step compares each factual claim with the cited passage and flags claims with no supporting text. Claims that fail the check go back to the agent for another retrieval round, or to a human when the sources genuinely disagree. This check is cheap compared with the cost of a confident wrong answer reaching a customer.

When sources disagree, the agent should say so instead of picking one silently. A short note such as "the help centre says X, while the changelog says Y" lets the reader decide and lets your team fix the underlying documents. Disagreement between sources is usually a content problem, not a model problem, and hiding it makes the content problem harder to find.

How do you test an agent's retrieval, not just its answers?

You test an agent's retrieval by checking its traces, not only its final answers. A trace shows the plan, each search, the passages returned, and which passages the answer used. When you score traces, you can see whether the agent searched well and reasoned badly, or searched badly and got lucky with a good guess.

Build a test set of real questions with known good answers and known source passages. For each question, record whether the agent found the right passages, whether it used them, and whether it cited them. Score those three things separately: retrieval recall, use of retrieved text, and citation accuracy.

An agent can score well on answers while scoring badly on retrieval, which means it is guessing from its training data and will fail on questions about your newer content.

Run the test set on a schedule, not once. Sources change, indexes drift, and a new document can crowd out the passage that used to win. A weekly run over twenty to forty questions is enough to catch drift early. When scores drop, look at the traces first: the failing step usually shows up in the plan or the first search, as the guide to how agentic RAG works explains.

Example (hypothetical): a support agent that checks its own work

Example (hypothetical): a 40-person support team builds an agent that answers billing questions from its help centre, changelog and ticket history. Each question gets a plan of two to three searches, and the agent may call each retrieval tool at most twice.

In the first week, the test set has 30 questions. The agent finds the right passages for 24 of them, uses them in 22 answers, and cites them correctly in 20. The six misses share a cause: the agent searches the help centre for refund exceptions that only exist in tickets, because the plan step names the wrong source.

The team fixes the tool descriptions so the ticket tool is described as the place for exceptions and edge cases.

In the second week, the same 30 questions score 27 found, 26 used and 25 cited correctly. The three remaining misses are questions where the help centre and the changelog disagree about a date; the agent now reports the disagreement instead of picking one. Review time per flagged answer falls from about 8 minutes to about 3 minutes, because reviewers read the trace and the citations instead of re-doing the search themselves.

What are the common mistakes?

The most common agentic RAG mistakes are letting the agent search without a plan, giving it broad tools, and judging it only on final answers.

  • No plan, just searching. The agent fires the user's words at the index and hopes. Require a short plan with named sources before the first search.
  • Tools that overlap. Two tools that search the same content make the agent's choices random. One tool per source, with a clear description.
  • Unlimited retrieval loops. Without a step cap, the agent keeps searching on hard questions and burns time and money. Cap steps at three to five.
  • Citations nobody checks. A citation field that is never verified teaches the agent that invented sources are fine. Verify claims against passages automatically.
  • Testing answers only. A good answer from a bad trace is luck. Score retrieval recall and citation accuracy separately.
  • Stale indexes. New documents change what wins. Re-run the test set weekly and watch for drift.

If you are planning a retrieval agent, RAG development covers the underlying pipeline the agent will search.

Key takeaways

  • Let the agent write a short plan with named sources before its first search
  • Give each retrieval tool one source, a clear name and a cap on returned passages
  • Retrieve in three to five steps, checking each step before the next
  • Require citations that point at exact passages, and verify claims against them
  • Test traces, not just answers: score retrieval recall, use of sources and citation accuracy

Frequently asked questions

What is the difference between RAG and agentic RAG?

In plain RAG, a fixed pipeline turns the question into one search and then writes an answer from the results. In agentic RAG, an agent plans the searches, runs several retrieval steps, picks between sources, and checks results before answering. The agent layer adds flexibility and new failure modes.

How many retrieval steps should an agent take?

Three to five steps cover most questions. Fewer steps miss multi-part questions; more steps add cost and latency without much gain. After the cap, the agent should answer with what it has and say what is missing.

What should an agentic RAG test set contain?

Real questions with known good answers and known source passages. For each question, score whether the agent found the right passages, used them in the answer, and cited them correctly. Run the set weekly to catch drift as sources change.

How do you stop an agent citing sources it never read?

Verify each factual claim against the cited passage automatically before the answer is delivered. Claims with no supporting text go back for another retrieval round or to a human. A citation field that is never checked teaches the agent that invented sources are acceptable.

Should retrieval tools be able to write data?

No. Retrieval tools should be read-only: they fetch text and return it. Any action the agent takes should go through a separate tool with its own approval rules, so a bad retrieval plan wastes time instead of changing data.

When is agentic RAG not worth it?

When questions map cleanly to one search, plain RAG is simpler, faster and easier to test. Agentic retrieval earns its cost on multi-part questions that need several sources, follow-up searches or a decision between conflicting documents.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building a retrieval agent and want the retrieval to hold up? Talk to Hertiv.

A senior engineer replies within one business day. Or see our RAG Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call