<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SAID </title>
    <description>The latest articles on DEV Community by SAID  (@saidnb).</description>
    <link>https://dev.to/saidnb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F744275%2F458ce3db-9d46-4d4a-b5ab-b1f636339c76.png</url>
      <title>DEV Community: SAID </title>
      <link>https://dev.to/saidnb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saidnb"/>
    <language>en</language>
    <item>
      <title>Classic RAG vs. Agentic RAG: Moving from a Fixed Pipeline to a Control Loop</title>
      <dc:creator>SAID </dc:creator>
      <pubDate>Sun, 22 Nov 2026 15:50:40 +0000</pubDate>
      <link>https://dev.to/saidnb/classic-rag-vs-agentic-rag-moving-from-a-fixed-pipeline-to-a-control-loop-3kk6</link>
      <guid>https://dev.to/saidnb/classic-rag-vs-agentic-rag-moving-from-a-fixed-pipeline-to-a-control-loop-3kk6</guid>
      <description>&lt;p&gt;Retrieval-Augmented Generation (&lt;strong&gt;RAG&lt;/strong&gt;) is the standard way to ground LLMs in private or up-to-date data. For straightforward questions, a classic RAG pipeline works great.&lt;/p&gt;

&lt;p&gt;But the moment user questions become multi-part, ambiguous, or span multiple data sources, that straight-line pipeline starts to break. That is where &lt;strong&gt;Agentic RAG&lt;/strong&gt; comes in.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Quick Recap: Classic RAG
&lt;/h2&gt;

&lt;p&gt;Classic RAG connects an LLM to an external knowledge base in a fixed, linear pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    A["User Query"] --&amp;gt; B["Embedding Model"]
    B --&amp;gt; C[("Vector Store")]
    C --&amp;gt; D["Top-k Chunks"]
    D --&amp;gt; E["LLM"]
    E --&amp;gt; F["Generated Answer"]
    style F fill:#e0f2f1,stroke:#00695c,stroke-width:2px&lt;/code&gt;&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Embed:&lt;/strong&gt; Convert the user's query into a vector.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieve:&lt;/strong&gt; Search a vector database for the &lt;em&gt;k&lt;/em&gt; most similar chunks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Augment:&lt;/strong&gt; Inject those chunks into the LLM prompt as context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generate:&lt;/strong&gt; Ask the LLM to answer using that context.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For simple, single-hop lookups (&lt;em&gt;"What is our refund policy?"&lt;/em&gt;), Classic RAG is fast, cheap, and easy to debug. If that covers your use case, &lt;strong&gt;stop here&lt;/strong&gt;—there is no need to over-engineer it.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Where Classic RAG Breaks
&lt;/h2&gt;

&lt;p&gt;Classic RAG executes the exact same steps for every query. That rigidity creates five common failure modes in production:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-shot retrieval:&lt;/strong&gt; Retrieval runs once. If the first search misses, nothing recovers it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No query understanding:&lt;/strong&gt; A complex, multi-part question is compressed into a single vector, returning a muddled mix of chunks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No relevance check:&lt;/strong&gt; Whatever the vector store returns goes straight into the prompt—even if it is irrelevant, which actively increases hallucinations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single knowledge source:&lt;/strong&gt; One pipeline typically talks to one vector store. Answering questions that need a SQL database, live web search, and internal docs requires brittle, hard-coded glue code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One strategy for every query:&lt;/strong&gt; A casual &lt;em&gt;"hello"&lt;/em&gt; and a deep research question take the exact same path.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The core shift:&lt;/strong&gt; In Classic RAG, the LLM is a text-completer at the &lt;em&gt;end&lt;/em&gt; of a pipe. &lt;strong&gt;Agentic RAG moves the LLM to the &lt;em&gt;center&lt;/em&gt; of a control loop&lt;/strong&gt;, gives it tools, and lets it drive.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. What Is Agentic RAG?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Agentic RAG&lt;/strong&gt; embeds autonomous agent behavior directly into the retrieval process. Instead of a fixed &lt;em&gt;retrieve → generate&lt;/em&gt; chain, an agent decides &lt;strong&gt;what&lt;/strong&gt; to retrieve, &lt;strong&gt;evaluates&lt;/strong&gt; what comes back, and &lt;strong&gt;iterates&lt;/strong&gt; until it has enough grounded evidence to answer reliably.&lt;/p&gt;

&lt;p&gt;Three capabilities make this possible:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Planning:&lt;/strong&gt; Breaking a complex question into smaller sub-questions instead of running one muddled search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool use:&lt;/strong&gt; Choosing the right source per sub-task—vector store, SQL database, web search, or an internal API at runtime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterative refinement:&lt;/strong&gt; Grading retrieved results for relevance and rewriting the query (or switching tools) when the evidence is weak.
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    A["Naive RAG&amp;lt;br/&amp;gt;index-retrieve-generate"] --&amp;gt; B["Advanced RAG&amp;lt;br/&amp;gt;reranking, hybrid search, HyDE"]
    B --&amp;gt; C["Modular RAG&amp;lt;br/&amp;gt;pluggable pipelines"]
    C --&amp;gt; D["Agentic RAG&amp;lt;br/&amp;gt;LLM-driven control loop&amp;lt;br/&amp;gt;tools, grading, self-correction"]
    style A fill:#e8eaf6
    style B fill:#e3f2fd
    style C fill:#e1f5fe
    style D fill:#e0f2f1,stroke:#00695c,stroke-width:2px&lt;/code&gt;&lt;/pre&gt;






&lt;h2&gt;
  
  
  4. The Core Idea: The Retrieval Control Loop
&lt;/h2&gt;

&lt;p&gt;Under the hood, almost every Agentic RAG system follows the same shape a &lt;strong&gt;bounded loop&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    Q["User Question"] --&amp;gt; P["PLAN&amp;lt;br/&amp;gt;analyze &amp;amp; decompose&amp;lt;br/&amp;gt;into sub-questions"]
    P --&amp;gt; R["RETRIEVE&amp;lt;br/&amp;gt;tool call: vector store,&amp;lt;br/&amp;gt;web search, SQL..."]
    R --&amp;gt; G{"GRADE&amp;lt;br/&amp;gt;relevant &amp;amp; sufficient?"}
    G --&amp;gt;|"yes"| GEN["GENERATE&amp;lt;br/&amp;gt;grounded answer"]
    G --&amp;gt;|"no"| RW["REFINE&amp;lt;br/&amp;gt;rewrite query or&amp;lt;br/&amp;gt;switch tool"]
    RW --&amp;gt; R
    GEN --&amp;gt; V{"VERIFY&amp;lt;br/&amp;gt;grounded &amp;amp; accurate?"}
    V --&amp;gt;|"passes"| OUT["Final Answer + Citations"]
    V --&amp;gt;|"fails"| RW
    style OUT fill:#e0f2f1,stroke:#00695c,stroke-width:2px&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Plan:&lt;/strong&gt; Analyze the query and decide whether retrieval is even needed, or decompose it into sub-questions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieve:&lt;/strong&gt; Call the appropriate tool(s) to fetch context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grade:&lt;/strong&gt; Check whether the returned chunks actually help answer the question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refine &amp;amp; Verify:&lt;/strong&gt; If the evidence is weak, rewrite the query or try another source. Once an answer is drafted, verify that it is grounded in the retrieved context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;One non-negotiable rule:&lt;/strong&gt; Always enforce a &lt;strong&gt;retry / iteration budget&lt;/strong&gt; (e.g., max 3 retrieval cycles). Without a guardrail, an agent that keeps rejecting documents can loop indefinitely and burn tokens.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Common Agentic RAG Patterns
&lt;/h2&gt;

&lt;p&gt;You will see several named architectures in the wild. Most are variations of the control loop above, often starting with a &lt;strong&gt;router&lt;/strong&gt; that selects the right path per query:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    Q["User Query"] --&amp;gt; R{"Agent Router&amp;lt;br/&amp;gt;analyze intent &amp;amp; complexity"}
    R --&amp;gt;|"simple / general"| LLM["Direct LLM Answer&amp;lt;br/&amp;gt;(no retrieval)"]
    R --&amp;gt;|"internal docs"| VS[("Vector Store")]
    R --&amp;gt;|"structured data"| SQL[("SQL Database")]
    R --&amp;gt;|"fresh / external"| WS["Web Search"]
    VS --&amp;gt; GEN["Synthesize &amp;amp;&amp;lt;br/&amp;gt;Generate Answer"]
    SQL --&amp;gt; GEN
    WS --&amp;gt; GEN
    GEN --&amp;gt; OUT["Final Answer"]
    LLM --&amp;gt; OUT
    style OUT fill:#e0f2f1,stroke:#00695c,stroke-width:2px&lt;/code&gt;&lt;/pre&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;How It Works&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Query Routing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A lightweight router picks the right source (docs, SQL, web, or direct answer) per query.&lt;/td&gt;
&lt;td&gt;Multiple distinct knowledge sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ReAct (Reason + Act)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The model alternates between reasoning (&lt;em&gt;Thought&lt;/em&gt;), calling a retrieval tool (&lt;em&gt;Action&lt;/em&gt;), and reading results (&lt;em&gt;Observation&lt;/em&gt;).&lt;/td&gt;
&lt;td&gt;Open-ended, multi-step lookups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Self-RAG / Corrective RAG (CRAG)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Grades retrieved chunks; filters noise, rewrites bad queries, or falls back to web search when internal docs fail.&lt;/td&gt;
&lt;td&gt;High-accuracy domains where hallucinations are costly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Adaptive RAG&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Classifies query complexity up front: simple queries skip retrieval, factual queries use Classic RAG, complex queries enter an iterative loop.&lt;/td&gt;
&lt;td&gt;Mixed traffic with strict cost/latency budgets&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  6. Classic RAG vs. Agentic RAG
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Classic RAG&lt;/th&gt;
&lt;th&gt;Agentic RAG&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Control flow&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fixed linear pipeline&lt;/td&gt;
&lt;td&gt;Dynamic loop decided at runtime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Retrieval&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One-shot, always runs&lt;/td&gt;
&lt;td&gt;On-demand, iterative, retry-capable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sources&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Single vector store&lt;/td&gt;
&lt;td&gt;Multiple tools (vector DB, SQL, web, APIs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Validation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;None (trusts top-&lt;em&gt;k&lt;/em&gt; chunks)&lt;/td&gt;
&lt;td&gt;Grades retrieval relevance &amp;amp; answer groundedness&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Latency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Low &amp;amp; predictable&lt;/td&gt;
&lt;td&gt;Higher &amp;amp; variable (multiple LLM calls)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost per query&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Minimal&lt;/td&gt;
&lt;td&gt;Scales with loop iterations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Simple, single-hop Q&amp;amp;A at scale&lt;/td&gt;
&lt;td&gt;Multi-hop, multi-source, high-stakes accuracy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  7. When &lt;em&gt;Not&lt;/em&gt; to Use Agentic RAG
&lt;/h2&gt;

&lt;p&gt;Agentic RAG is &lt;strong&gt;not&lt;/strong&gt; a drop-in upgrade for every app. Skip it (or limit it to hard queries) when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Latency is critical:&lt;/strong&gt; Each loop iteration adds at least one LLM call plus a retrieval call—too slow for autocomplete or real-time inline suggestions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your queries are simple:&lt;/strong&gt; If you have one clean corpus and single-hop questions, routing and grading add overhead with nothing to fix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost is tight at high volume:&lt;/strong&gt; Running 3–5× more LLM calls across all traffic adds up fast. Route the easy 80% through Classic RAG and save the agent loop for the hard 20%.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You lack tracing/observability:&lt;/strong&gt; Multi-step loops fail in subtle ways (bad routing, poor rewrites, retry loops). If you cannot trace each step, you cannot debug it in production.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Practical decision rule:&lt;/strong&gt; Start with Classic RAG, log where it fails on real user queries, and introduce agentic steps &lt;em&gt;only&lt;/em&gt; where single-pass retrieval demonstrably falls short.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>agents</category>
      <category>rag</category>
    </item>
  </channel>
</rss>
