RAG vs agentic search: retrieval becomes a tool the agent calls
Classic RAG retrieves passages from a pre-built index once and places them in the prompt before the model answers, while agentic search lets the agent run its own searches, greps and file reads step by step, deciding what to look at next from what it has found.
Checked
RAG was designed for a model that answers once. An agent works over many steps, so it can search, read a result, and search again with a better query. That turns retrieval from a pipeline stage into a tool the agent calls.
Coding agents are where the split is clearest. Anthropic says Claude Code uses glob and grep instead of a pre-built index. Cursor reports that adding semantic search to grep raises answer accuracy. Both positions hold up, for different corpora.
How each works
Classic RAG
Documents are chunked, embedded and indexed ahead of time. Each query retrieves the top passages, often through hybrid keyword and vector search plus a reranker, and the model answers from them.
Agentic search
The agent holds lightweight references such as file paths, queries and links, and uses tools to list, grep, search and open files as the task unfolds. Anthropic calls this just-in-time retrieval.
What the labs and tool makers report
Anthropic
Claude Code uses glob and grep just in time rather than a pre-built index, which avoids stale indexes. Anthropic recommends a hybrid: some context up front, such as a CLAUDE.md file, plus autonomous exploration.
Anthropic Agent SDK guidance
Start with agentic search over the filesystem, and add semantic search only if needed.
Cursor
Semantic search raised answer accuracy by 12.5% on average, between 6.5% and 23.5% depending on the model. Cursor concludes that grep and semantic search together outperform grep alone.
Anthropic Contextual Retrieval
For indexed retrieval, contextual embeddings plus contextual BM25 plus a reranker cut top-20 retrieval failures by 67%.
Which fits which corpus
Agentic search with grep and file tools fits corpora that are small enough to explore, change often, and have structure the agent can navigate, such as a code repository. It avoids index drift, at the cost of more tool calls and tokens per question.
Indexed hybrid search with a reranker fits large, conceptual or multi-tenant corpora, such as years of support tickets, contracts or a product knowledge base, where grep cannot find a passage that uses different words from the query.
How they combine
In production the question is rarely either-or. Motiontic's engineers give the agent several retrieval tools, such as a hybrid index over documents, grep over structured files and direct queries against databases, and let it choose per step. Each tool is evaluated on the client's real questions, so a tool that does not raise task success is removed.
Classic RAG compared with agentic search
| Classic RAG | Agentic search | |
|---|---|---|
| When retrieval happens | Once, before the answer | Repeatedly, as the agent works |
| Index | Built and maintained ahead of time | None required for grep and file tools |
| Freshness | As fresh as the last index update | Reads the current files |
| Cost per question | One retrieval plus one model call | Several tool calls and more tokens |
| Fits | Large, conceptual or multi-tenant corpora | Code and other navigable, fast-changing corpora |
| Weak at | Multi-hop questions that need follow-up searches | Finding passages phrased differently from the query |
Common questions
What is the difference between RAG and agentic search?
Classic RAG retrieves passages from a pre-built index once and puts them in the prompt. Agentic search lets the agent run its own searches and file reads step by step, refining what it looks for based on what it finds.
Does Claude Code use RAG?
Anthropic says Claude Code uses glob and grep to retrieve files just in time rather than relying on a pre-built index, and recommends combining some up-front context, such as a CLAUDE.md file, with autonomous exploration.
Does semantic search still help coding agents?
Cursor reports that adding semantic search raised answer accuracy by 12.5% on average across models, and concludes that grep and semantic search together outperform grep alone.
Is RAG obsolete for AI agents?
No. Retrieval is becoming a tool the agent calls rather than a fixed pipeline step. Indexed hybrid search with a reranker remains the stronger option for large or conceptual document sets.
Which is cheaper, RAG or agentic search?
Per question, classic RAG is usually cheaper because it retrieves once. Agentic search spends more tool calls and tokens but needs no index to maintain. The fair comparison is cost per correctly answered question on real tasks.
Related
RAG vs Fine-Tuning
Fetching the right facts at query time, compared with retraining the model's behaviour.
Claude Code vs Cursor
Anthropic's coding agent and the SpaceX-owned AI editor compared on plans, models and agent tooling.
Context Engineering vs Prompt Engineering
Wording the instructions, compared with curating every token the model sees.
Context rot
Why agents get worse the longer they run, and what keeps context clean.
Agentic search
Retrieval as a tool the agent calls, step by step, rather than a pipeline stage.
Four levels of AI in a product
Why most products stop at a chatbot, and what levels three and four take.
Running agents that have to hold up?
Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.