Agentic RAG Explained: When the Agent Decides What to Search
What is agentic RAG?
Agentic RAG is retrieval-augmented generation where an AI agent decides how to search. Instead of one fixed search for every question, the language model gets search as a tool and, in a loop, decides whether to search, rewrites or splits the question, picks the right source, such as documents, a SQL database or the web, and searches again if what it found is not enough. It answers comparisons, multi-hop and list questions that one search cannot, but every decision is another model call, so it is slower and costs more than traditional RAG.
Answer last checked
Save your progress and get the AI Engineering cheat sheet PDF
This guide answers 8 questions about agentic RAG: what it is, how it differs from traditional RAG, what the agent actually does with worked examples, which questions it answers better, what it costs, how reliable it is and when to use it. The facts come from the retrieval and agents chapters of our AI Engineering course.
8 questions · 3 sections · answers from the course
These answers come from our course Agentic AI Engineering with LangChain, LangGraph and LangSmith: Build Real Agents, Hands-On: 38 video lessons are out now (Modules 0 to 4), about 692 minutes, of the 219 planned. Module 0 is free to watch with no sign-in.


The short version
Traditional RAG retrieves once, then answers. Agentic RAG lets the model rewrite, decompose, route and search again in a loop. Use it for the questions your logs show one search cannot answer, keep the loop short with a hard limit, route counting questions to a database, and fix parsing and chunking first, because an agent cannot find text that was never stored well.
1. What agentic RAG is
Agentic RAG puts an AI agent in charge of the retrieval step of a RAG app. These answers explain the difference from ordinary RAG in plain words.
What is agentic RAG?
Agentic RAG is retrieval-augmented generation in which a language model decides how to search, instead of the app running one fixed search for every question. The model is given search as a tool, often several tools, and in a loop it decides whether to search at all, what to search for, where to search, and whether what it found is enough or it should search again.
Ordinary RAG, sometimes called two-step RAG, always does the same two things: retrieve, then answer. Agentic RAG lets the agent decide when to search, which is how our agentic AI course frames the two lessons that teach them side by side.
Lesson: Query transformation and routing: fixing retrieval before it runs
What is the difference between agentic RAG and traditional RAG?
Traditional RAG is a fixed pipeline: the question is embedded, the top passages are found, and the model answers from them, once. It is fast, cheap and predictable, and it fails on questions that one search cannot answer.
Agentic RAG is a loop. The model can rewrite the question, split it into parts, pick between a document search, a SQL database or a web search, read the results and search again. It answers harder questions, but every extra decision is another model call, so it is slower, costs more and takes a different path from one run to the next.
Lesson: Query transformation and routing: fixing retrieval before it runs
2. What the agent actually does, with a worked example
Most of what an agentic RAG system adds is five moves that happen before or between searches. The worked examples come from our query transformation lesson.

What does agentic RAG look like on a real question?
Take "How does retry behaviour differ between the v1 and v2 SDK?". One search for that sentence tends to return passages about one version or the other. An agent decomposes it into two standalone questions, "How does retry behaviour work in the v1 SDK?" and the same for v2, searches for each in parallel, and answers from both sets of passages.
A multi-hop question works in series instead. "Who manages the team that owns the billing service?" needs one search to find the owning team and a second, written from that answer, to find its manager. A fixed pipeline cannot do the second search, because it does not know what to ask until the first one returns.
Lesson: Query transformation and routing: fixing retrieval before it runs
Why does agentic RAG need more than vector search?
Because some answers are not written down anywhere. "How many refunds did we issue in March?" retrieves text about refunds, but the answer has to be counted from the orders database, so the right tool is a SQL query, not a better search. Questions about one product's settings belong in that product's documents, and a greeting needs no search at all.
Routing sends each question to the right place. Our lesson builds it cheapest first: plain rules for what a pattern can catch, then an embedding router that compares the question with a few example questions per route, and a model only for what is left. Keep one rule: the router chooses a destination, it does not answer.
Lesson: Query transformation and routing: fixing retrieval before it runs
Which questions does agentic RAG answer better?
Comparisons, questions with several parts, multi-hop questions, questions that need counting or a live system, and list questions such as "which documents mention X?". A fixed top-10 search returns 10 passages whatever the true answer is, so it cannot list 40.
On our own lessons, top-10 search found 22% to 34% of the lessons that mention a common name, while an index of names built by a small model found 93%. An agent that can call that kind of tool, or a plain text filter, answers list questions a single vector search never can.
What we measured: Our course lessons, common names: top-10 vector search found 22% to 34% of the lessons that mention them; a model-built name index found 93%.
3. What agentic RAG costs, and when to use it
Every decision an agent makes is a model call, and model calls are where RAG spends its time and money. That is the whole trade.
Is agentic RAG slower and more expensive?
Yes, usually. In the worked budget in our production RAG lesson, the model takes about 1,100 milliseconds of a roughly 1,300 millisecond answer, and generation is about 85% of the cost of each question. Traditional RAG calls the model once. An agent that rewrites, routes, checks its results and searches again calls it once for every one of those decisions, before it writes the answer.
So measure on your own traffic what share of questions actually need the extra steps. Often most do not, and a fixed pipeline with a router in front is enough.
What we measured: Worked budget, one question that misses the cache: about 1,100 ms of about 1,300 ms is the model; the model is about 85% of the worked cost per question.
Is agentic RAG less reliable?
It can be. Each step an agent takes can go wrong, and success multiplies down the chain: at 95% per step, a 20-step run succeeds only about 36% of the time. An agentic RAG loop that searches, judges, rewrites and searches again a few times is a short chain, but still longer than one search.
Keep the loop short, give it a hard limit on searches and model calls, log every search the agent made and why, and test the final answers, not only whether the right passage was found somewhere along the way.
What we measured: Whole-task success at 95% per step: about 77% over 5 steps, about 36% over 20 steps.
When should I use agentic RAG?
When your logs show questions that one search cannot answer: comparisons, multi-part and multi-hop questions, list questions, and questions that need a database or a live system. Start with a fixed pipeline, add rewriting and reranking, and add routing next; turn retrieval into an agent's tool only for the share of questions that still fail.
Do not use it to cover up weak retrieval. If the right passage is never found because the documents were badly parsed or chunked, an agent that searches five times finds the wrong passage five times.
Where to go next
Everything on this page comes from Agentic AI Engineering with LangChain, LangGraph and LangSmith: Build Real Agents, Hands-On. 38 video lessons are out now (Modules 0 to 4), about 692 minutes, of the 219 planned. Module 0 is free to watch with no sign-in. Start with the free lessons before you decide.
These questions are a start. The interview asks more.
Get all 120 questions in the Agentic AI Engineering pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (153 diagrams in all). A PDF you keep, junior to staff level.
Pay by UPI, cards or netbanking through Razorpay. Pay by card or PayPal, in US dollars. Download at once from My packs.
