Agentic RAG: When Retrieval Needs to Think Before It Answers
Summary
Agentic RAG addresses the limitations of standard, single-shot Retrieval Augmented Generation (RAG) pipelines that struggle with complex questions requiring multiple facts not found in a single document. It enables a Large Language Model (LLM) to "think" and perform iterative retrieval. Two primary patterns are ReAct, which interleaves reasoning (Thought), action (retrieval with new queries), and observation, and Plan-and-Execute, which pre-defines a sequence of retrieval steps. While effective for intricate queries, each additional reasoning iteration in agentic RAG adds latency, typically 300 to 1,500 milliseconds, and a few cents per LLM call (e.g., GPT-4o pricing). Therefore, agentic RAG should be a deliberate choice for specific question types, not a default, especially when basic RAG with good chunking and hybrid search already achieves a faithfulness score above 0.85.
Key takeaway
For AI Engineers designing advanced RAG systems, prioritize maximizing basic retrieval quality through better chunking and hybrid search before considering agentic patterns. Implement agentic RAG, such as ReAct for open-ended questions or Plan-and-Execute for structured tasks, only for complex queries where single-shot retrieval demonstrably fails. Be mindful that each agentic iteration adds significant latency (300-1,500ms) and cost, making it a specialized solution rather than a universal default for systems with strict latency budgets or high baseline performance.
Key insights
Agentic RAG enables LLMs to reason and retrieve iteratively, addressing complex queries single-shot RAG cannot.
Principles
- Single-shot RAG fails when answers span multiple facts.
- Agentic RAG adds latency and cost per iteration.
- Match RAG pattern to query structure: ReAct for open-ended, Plan-and-Execute for structured.
Method
ReAct involves alternating Thought, Action (retrieval with a new query), and Observation steps, where each observation informs the next thought. Plan-and-Execute defines a full sequence of retrieval steps upfront.
In practice
- Use ReAct for genuinely open-ended questions.
- Apply Plan-and-Execute for well-structured research tasks.
- Avoid agentic patterns for simple FAQs or high-performing RAG.
Topics
- Agentic RAG
- Retrieval-Augmented Generation
- ReAct Pattern
- Plan-and-Execute
- LLM Inference Cost
- RAG Architecture
- Hybrid Search
Best for: Machine Learning Engineer, AI Engineer, AI Architect
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by LLM on Medium.