What Is Agentic RAG?
What agentic RAG is, how an agent plans, searches, grades and retries, and when a simple pipeline is the better choice, for your AI interview.
In short
Agentic RAG is retrieval-augmented generation where an AI agent picks its own searches, grades the results and searches again if they are weak. It handles multi-part questions that one search misses, but it adds time and cost, so start with a simple pipeline.
12 min readAdvancedCommon · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Agentic RAG means the model chooses its own searches. A normal RAG system runs one search with the user's question, then answers from the results. An agentic one plans several searches, grades what comes back, and searches again with a better query when the results are weak. I would use it for questions that span several sources. For a question one search can answer, I would keep the simple pipeline, because every extra step adds delay and cost.
A standard RAG system has a fixed path. Your code takes the question, runs one search, passes the top results to the model, and the model writes the answer. Agentic RAG puts an agent in that path. The agent is a model that chooses its next step, so it decides what to search for and whether to search again.
Take a legal team asking which supplier contracts allow an exit after a data breach. One search may miss the clause, because contracts say security incident or unauthorised access. An agent can split the question into parts, search the contract index and the policy index, and grade each result. If the results are weak, it rewrites the query and tries again, with a hard limit on steps.
The cost is real. Each step adds model calls and seconds, and an agent can loop or pick the wrong source. So I would keep a simple pipeline for questions one search can answer. For the rest, I would set a step limit, log every search, and measure answer quality on a set of real questions before trusting it.
The word itself is used in several ways. Anthropic notes that agent can be defined in several ways, and a 2025 survey sorts these systems by how many agents they use, how they are controlled, how autonomous they are and how they represent knowledge. So the label covers a wide range. I would describe what my system actually does, and skip the argument over the label.
What is agentic RAG, in plain words?
RAG, short for retrieval-augmented generation, means searching your own documents first, then giving the best matches to an AI model so it answers from them. In a standard setup, your code runs that search once, with the user's question, and the model writes the answer from what came back.
Agentic RAG puts an AI agent in charge of that search. The agent is a model that chooses its own next step. It can split a question into parts, pick a source for each part, check what came back, and search again if the results are weak.
A paralegal makes a good comparison. A junior who follows a checklist pulls one box of old files, reads it and writes up what is there. A good paralegal reads the first pages, sees the answer is probably in another box, pulls that one, and stops once the evidence is enough. The second paralegal is the agent.
Now the AI version. A legal team has 40,000 supplier contracts. A single fixed query misses the clause that matters. The agent runs several searches, grades them, and writes an answer that cites the clauses it used.
Key words
- Agent
- An AI model that chooses its next step and can use tools, such as a search.
- Retrieval
- Finding the stored documents that match a question.
- Grading
- Checking whether a search result actually helps answer the question.
- Query rewriting
- Turning a weak search into a better one, often with the contract's own words.
- Step limit
- A hard cap on how many searches or model calls the agent may make.
How does the agent's search loop work?
A common shape for agentic RAG is this loop. Here it is for the legal question: can we end a supplier deal after a data breach?
- 1
Plan
The agent splits the question into parts and picks a source for each, such as the contract index (a searchable store of the documents) or the renewal table.
- 2
Search
It runs the searches. Several can run at the same time, as Microsoft's agentic retrieval does, which keeps the wait short.
- 3
Grade
It reads each result and asks whether it answers its part of the question.
- 4
Retry or answer
Weak results: it rewrites the query and searches again. Strong results: it writes the answer and cites the clauses.
- 5
Stop
A step limit ends the loop, so a confused agent cannot search forever. When the limit is hit, it says what it found and what is missing.
The agent's search loop
Legal question
Can we exit after a breach?
Agent
plans, grades, decides
Sources
Contract index
40,000 supplier contracts
Policy index
our own security rules
Cited answer
with citations, or not found
- 1The agent gets the legal question.
- 2It sends searches to the contract and policy indexes.
- 3The results come back, and the agent grades them.
- 4Good enough: it writes a cited answer.
Here is the loop as a short program. It is a sketch: a keyword match stands in for the search, and the rewrites are fixed in advance, so no model writes them.
# A simplified agent loop: a tiny keyword index, a grader and a rewrite list.
CONTRACT_TERMS = {
"breach": ["Clause 9.2: the supplier may end the deal after a data breach."],
"unauthorised access": ["Clause 14.1: notify us within 24 hours of unauthorised access."],
}
MAX_STEPS = 3
def search(query):
return [text for term, texts in CONTRACT_TERMS.items() if term in query for text in texts]
def answer(query, rewrites):
for step in range(1, MAX_STEPS + 1):
hits = search(query)
grade = "strong" if hits else "weak"
print(f"step {step}: {query!r} -> {len(hits)} hit(s), {grade}")
if grade == "strong":
return hits
if not rewrites:
break
query = rewrites.pop(0)
return []
hits = answer("security incident exit", ["breach", "unauthorised access"])
print(hits[0] if hits else "Not found: say what was searched and what is missing.")Output
step 1: 'security incident exit' -> 0 hit(s), weak step 2: 'breach' -> 1 hit(s), strong Clause 9.2: the supplier may end the deal after a data breach.
Why use it, and when should you skip it?
Agentic RAG is worth its cost only when one search cannot do the job. Anthropic's post on agents says that simpler options often come first. Microsoft describes its own agentic retrieval as a multi-query pipeline designed for complex questions. In our reading, that is closer to a fixed workflow than to a free-roaming agent.
- Use it when
Several sources or several parts
The answer needs a clause from one place and a renewal date from another. One search cannot cover both.
- Skip it when
One search already answers it
A fixed pipeline is faster, cheaper and easier to test. Start there, and add an agent when you measure a gap.
Two ways to search
Classic RAG
One fixed search
same search every time
Agentic RAG
Plan and search
several checked searches
Clause missed
answer may lack the clause
Clause found
answer cites the right clause
- 1One search may miss the clause that matters.
- 2The agent searches again with better queries and grades each result.
“Agentic systems often trade latency and cost for better task performance, and you should consider when this tradeoff makes sense.”
Anthropic
“Agentic retrieval adds latency compared to a single-query pipeline, but it handles query complexity that a single query can't.”
Microsoft, Azure AI Search
Anthropic also points out that autonomy brings higher costs, and that one mistake can build on the next. One wrong grade early can send the rest of the run in the wrong direction.
Tip
Asked whether you would always use it? Say no. Start with the simplest pipeline, prove it misses something, then add the loop.
What does a real run look like?
Here is a made-up but realistic run. A compliance team asks: which supplier contracts let us end the deal after a data breach, and does any of them renew this quarter? The answer needs two sources, which is the case agentic RAG is built for.
- 1
The single search
One query covers both parts. It returns five passages, mostly about payment terms. The exit clause and the renewal date are missed, so the answer says it cannot tell. About 2 model calls and 3 seconds.
- 2
Round one
The agent plans three searches: breach exit clauses, renewal dates, and the company's security rules. Two come back strong. The security search returns weak hits, so the grader marks it weak.
- 3
Round two
It rewrites that search with the words the contracts use, such as unauthorised access, and gets three matching notice clauses.
- 4
The answer
Four suppliers allow an exit after a breach, and two of them renew this quarter. Each claim cites its clause and date. About 7 model calls and 14 seconds in total.
Tip
The trade is clear here. The agent fixed the miss, but it took about three and a half times the calls and nearly five times the seconds. Measure both before you ship.
How would you stop an agentic RAG system from running up cost or looping?
Put limits on the loop, log what it does, and test it like any other system.
- 1
Cap the rounds
Set a maximum number of searches and model calls per question. When the cap is hit, return what was found and what is missing.
- 2
Log every step
Keep the query, the results, the grade and the reason for each rewrite. A lawyer can then audit the answer.
- 3
Test on real questions
Keep a set of real questions with known answers, and run it after each change. Look for wrong answers and for extra rounds that added nothing.
Tip
A strong answer names the two costs, calls and seconds, and the control that matters most: the step limit.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: an agent picks its own searches, grades the results and retries when they are weak.
- What it fixes: questions with several parts, and first searches that miss.
- What it costs: more model calls, more seconds, and more places to fail.
- The limits: a step cap, logging, and tests on real questions.
- When to skip it: a single search that already answers the question well.
- Honesty about the term: it can be defined in several ways, so describe what your system does.
Common traps
Trap"It's just RAG with a smarter model."
BetterSearch quality still decides the answer. Test the search on its own, then add the agent's planning and checks.
Trap"The model decides everything, so the code can stay simple."
BetterYour code sets the step limit and the allowed sources. The model only proposes the steps.
Trap"More searches always give better answers."
BetterMore rounds add cost and delay, and can drift off topic. Cap them and measure.
Can you spot the weak point?
Spot the risky setup
Which agent setup for a legal search is the risky one?
Quick check
A legal team's agent misses breach clauses in its first search. Which change is most likely to help?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Last updated on 26 November 2026
Building an agent that searches your contracts or policies?
I can help you design an agent with step limits, checked searches and tests on real questions. Book a short call and tell me what your team needs to find.