LLMs & GenAI

Agentic RAG

Replacing static single-shot vector lookups with dynamic multi-step agentic retrieval loops.

🔴 advanced5 min readragagents
Agentic RAG transforms passive single-shot retrieval pipelines into autonomous control loops where an LLM agent dynamically controls retrieval strategy. Capabilities include Dynamic Query Routing (directing queries to specialized vector DBs, SQL, or Web Search), Adaptive Retrieval (evaluating whether retrieved context is sufficient and re-formulating queries if incomplete), and Corrective RAG (CRAG - using web search fallbacks when internal retrieval precision is low).

Static RAG vs Agentic RAG

  STATIC RAG (Passive Pipeline):
  User Query ──► Vector Search ──► Single LLM Prompt ──► Final Output
  (If retrieval fails or is incomplete, generation fails!)

  AGENTIC RAG (Autonomous Decision Loop):
  User Query ──► Router Agent ──► [ Query Decomposition ]
                                        │
             ┌──────────────────────────┼──────────────────────────┐
             ▼                          ▼                          ▼
     [ Vector Search ]            [ SQL Database ]         [ Web Search API ]
     (Policy Documents)          (Sales Metrics)          (Live News Fallback)
             │                          │                          │
             └──────────────────────────┼──────────────────────────┘
                                        ▼
                             [ Evaluator Agent ]
                             "Is context sufficient?"
                             /                      \
                        Yes /                        \ No (Re-formulate Query)
                           ▼                          ▼
                   Final Response            Sub-Query Execution Loop

Core Agentic RAG Patterns

1. Corrective RAG (CRAG)

Evaluates retrieved document quality before passing to generation:

  Retrieved Context ──► [ Retrieval Evaluator Model ]
                              │
         ┌────────────────────┼────────────────────┐
         ▼                    ▼                    ▼
     CORRECT               AMBIGUOUS           INCORRECT
  Pass to LLM        Combine Internal +    Drop Internal; Trigger
                     Web Search Fallback   External Web Search

2. Self-RAG (Asai et al., 2023)

Fine-tunes the LLM to output explicit Reflection Tokens during generation:

3. Multi-Hop Query Decomposition

For complex queries ("Did company X or Y spend more on R&D in 2023?"):

  1. Sub-Query 1: retrieve("Company X R&D spend 2023") $\implies $5\text{B}$.
  2. Sub-Query 2: retrieve("Company Y R&D spend 2023") $\implies $8\text{B}$.
  3. Synthesis: Compare values $\implies$ Company Y spent $$3\text{B}$ more.

Say this out loud

"Agentic RAG replaces static single-shot retrieval pipelines with an autonomous loop. It uses Dynamic Query Routing to direct queries to Vector DBs, SQL, or Web Search, query decomposition for multi-hop reasoning, and Corrective RAG (CRAG) to trigger web search fallbacks when internal vector retrieval confidence is low."

Follow-ups to expect

Check yourself

Question 1 of 3

Why does static single-shot RAG (Retrieve -> Generate) fail on complex multi-step queries like 'Compare quarterly revenue growth of Apple vs Microsoft'?

More in LLMs & GenAI

See all →
Pretraining → SFT → RLHF5 minFine-Tune vs RAG vs Prompt: Choosing5 minRetrieval-Augmented Generation5 min