Agentic RAG vs Traditional RAG: Core Architectural Differences Explained

Traditional RAG follows a static, single-shot retrieve-then-generate pipeline, while Agentic RAG implements an iterative, agent-driven ReAct loop that allows the LLM to dynamically control when, what, and whether to retrieve.

The evolution from Traditional RAG to Agentic RAG represents a fundamental shift in how large language models interact with knowledge bases. According to the bojieli/ai-agent-book repository, Traditional RAG treats retrieval as a deterministic preprocessing step with no feedback mechanisms, whereas Agentic RAG empowers the LLM to act as a decision-making controller that orchestrates multi-step retrieval strategies through the ReAct pattern.

Traditional RAG: The Fixed Data-Processing Flow

Traditional RAG implements a single-shot pipeline that processes queries through two deterministic stages. As documented in book-en/chapter3.md (lines 557-563), this architecture follows a "fixed data-processing flow" where the system executes retrieval exactly once before generation begins.

The pipeline consists of:

  1. Retrieve – A one-time search over a static knowledge base using vector stores, BM25 indexing, or dense embeddings.
  2. Generate – The LLM receives the retrieved chunks and produces the final answer without further access to the knowledge base.

In this design, the LLM acts as a passive consumer of text. The retriever executes a single query—often based on initial keywords or vector similarity—without the ability to adjust strategies based on intermediate results or missing information.

Agentic RAG: Agent-Driven Iterative Retrieval

Agentic RAG transforms the pipeline into an agent-driven, iterative process using the ReAct pattern (Reason → Act → Observe). According to book-en/chapter3.md (lines 570-576), the agent maintains control over the retrieval process, deciding when to query, what terms to use, and whether additional rounds are necessary.

The core implementation resides in /chapter3/agentic-rag/agent.py (lines 36-38), where the AgenticRAG class manages the decision loop. Unlike Traditional RAG, this approach enables the agent to invoke retrieval tools repeatedly, incorporate feedback from previous searches, and refine queries dynamically to close information gaps.

Six Critical Architectural Differences

Control Flow: Single-Pass vs. ReAct Loop

Traditional RAG executes a rigid Retrieve → Generate sequence in a single pass. Agentic RAG implements a ReAct loop where the agent iterates through reasoning, action, and observation phases until satisfying the information requirements (lines 570-576).

Retrieval Strategy: Fixed vs. Dynamic Queries

Traditional systems rely on fixed queries derived from the initial user input, using single-keyword or dense vector searches without modification. Agentic RAG supports dynamic query adjustment, allowing the agent to reformulate searches, change tools, and incorporate context from previous rounds as described in /chapter3/agentic-rag/README.md (lines 14-16).

Tool Usage: Passive Consumption vs. Active Orchestration

Traditional RAG provides no tool-calling capabilities—the LLM merely consumes whatever text the retriever returns. Agentic RAG leverages the ReAct pattern to actively orchestrate retrieval tools, enabling the agent to search, observe results, reason about gaps, and repeat the process (agent.py lines 36-38).

Context Handling: Static Chunking vs. Structured Indexes

Traditional pipelines rely on initial document chunking with limited awareness of cross-document relationships or hierarchical structures. Agentic RAG integrates structured indexes such as RAPTOR and GraphRAG, enabling the agent to refine its view of the knowledge base on-the-fly using contextual retrieval (IMPLEMENTATION_GUIDE.md lines 144-146).

Adaptivity: Deterministic vs. Feedback-Driven

Traditional RAG operates as a static pipeline where performance hinges entirely on the quality of the first retrieval pass (lines 561-566). Agentic RAG adapts by issuing additional searches, re-ranking intermediate results, or switching between dense and sparse retrieval based on observed information gaps.

Use Cases: Straightforward vs. Complex Multi-Step Problems

Traditional RAG excels with straightforward queries where a single relevant document provides sufficient context. Agentic RAG handles complex, multi-step problems such as legal reasoning, multi-hop questions, and multi-turn dialogue where iterative refinement uncovers missing facts (lines 581-588).

Code Implementation Comparison

The following examples illustrate the architectural contrast between the two approaches.

Traditional RAG implements a simple sequential call:


# Traditional RAG (single-shot)

from rag_simple import retrieve, generate_answer

query = "What are the rules on self-defence?"
docs = retrieve(query)                 # one-time search

answer = generate_answer(query, docs)  # LLM consumes the docs

print(answer)

This pattern appears in /chapter3/agentic-rag/test_simple.py (lines 14-20).

Agentic RAG encapsulates the decision logic within an agent class that manages the iteration internally:


# Agentic RAG (ReAct loop)

from agentic_rag.agent import AgenticRAG
from agentic_rag.config import Config

cfg = Config(llm="openai", retriever="faiss")
agent = AgenticRAG(cfg)

# The agent decides internally how many retrieval rounds are needed.

response = agent.run("What are the rules on self-defence?")
print(response)

The AgenticRAG class and its run() method handle the iterative retrieval logic (agent.py lines 36-38).

Summary

  • Traditional RAG uses a static, single-shot pipeline where retrieval acts as deterministic preprocessing with no feedback mechanisms or decision-making capabilities.
  • Agentic RAG implements an iterative ReAct loop in /chapter3/agentic-rag/agent.py, empowering the LLM to control retrieval timing, query formulation, and tool selection dynamically.
  • The transition from passive text consumption to active tool orchestration enables Agentic RAG to solve complex, multi-step problems requiring iterative fact-finding and cross-document synthesis.
  • Key implementation files include agent.py for the ReAct loop logic, README.md for architectural documentation, and IMPLEMENTATION_GUIDE.md for structured index integration.

Frequently Asked Questions

What is the primary architectural difference between Agentic RAG and Traditional RAG?

Traditional RAG follows a fixed retrieve-then-generate pipeline with no decision-making capability, treating retrieval as a static preprocessing step. Agentic RAG transforms the LLM into an active controller that decides when to retrieve, what queries to issue, and whether additional rounds are necessary through the ReAct pattern implemented in agent.py.

How does the ReAct pattern improve retrieval quality in Agentic RAG?

The ReAct pattern enables the agent to iterate through Reason → Act → Observe cycles, allowing it to refine searches based on intermediate findings rather than relying on a single initial query. As implemented in /chapter3/agentic-rag/agent.py (lines 36-38), this loop allows the system to discover missing information and adjust retrieval strategies dynamically based on observation feedback.

When should I use Traditional RAG instead of Agentic RAG?

Use Traditional RAG for straightforward queries where a single relevant document provides sufficient context and the information need is well-defined upfront. It offers lower latency and simpler infrastructure for simple question-answering tasks that do not require multi-hop reasoning or iterative refinement across multiple knowledge sources.

What are the key files for implementing Agentic RAG in the bojieli/ai-agent-book repository?

The core implementation resides in /chapter3/agentic-rag/agent.py (lines 36-38), which defines the AgenticRAG class and ReAct loop. Architectural concepts contrasting both approaches are documented in /book-en/chapter3.md (lines 557-588) and /chapter3/agentic-rag/README.md (lines 14-16), while structured index integration guidance appears in /chapter3/structured-index/IMPLEMENTATION_GUIDE.md (lines 144-146).

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →