Advanced RAG/Advanced Patterns
Advanced11 min

Agentic RAG

Moving from static RAG pipelines to agent-driven retrieval. The agent decides what to retrieve, when, from which source, and evaluates retrieval quality with self-reflection.

Quick Reference

  • Agentic RAG: an LLM agent controls the retrieval process instead of a fixed pipeline
  • Agent decides: which retriever to use, what query to send, whether results are good enough
  • Multi-source routing: different tools for different query types (docs, API, database)
  • Self-reflection: agent checks retrieval quality and retries with a different strategy if needed
  • LangGraph is the natural framework — model retrieval decisions as graph state transitions

From Static Pipeline to Agent-Driven Retrieval

Standard RAG is a fixed pipeline: embed query → search vector store → generate answer. The pipeline makes the same decisions for every query. Agentic RAG replaces this fixed pipeline with an LLM agent that dynamically decides how to retrieve information. The agent can choose between multiple retrievers, reformulate queries, evaluate results, and retry with different strategies. This flexibility dramatically improves answer quality for complex or ambiguous queries.

AspectStatic RAG PipelineAgentic RAG
Retrieval strategyFixed (same for every query)Dynamic (agent chooses per query)
Data sourcesOne vector storeMultiple sources (vector store, SQL, API, web)
Query handlingDirect embedding lookupAgent reformulates, decomposes, or routes
Quality controlNone — returns whatever the retriever findsAgent evaluates results, retries if poor
ComplexitySimple, predictableMore complex, higher quality for hard queries
Latency200-500ms1-5s (multiple agent steps)
When to upgrade to agentic RAG

Upgrade from static RAG when: (1) you have multiple data sources (docs, databases, APIs), (2) your queries vary widely in complexity, (3) retrieval failures are common and reformulation would help, (4) users expect the system to try different approaches when the first doesn't work. Keep static RAG for simple, homogeneous knowledge bases.