agentic-rag

Installation
SKILL.md

Agentic RAG - Self-Correcting Retrieval

Overview

Agentic RAG evolves beyond static information retrieval by embedding autonomous agents within the retrieval and generation pipeline. Unlike "Naive RAG" which assumes a direct mapping from query to document chunk, Agentic RAG employs iterative reasoning, self-correction, and multi-step workflows to ensure answers are grounded, accurate, and comprehensive. It treats retrieval as a dynamic task-oriented process.

When To Use

  • When dealing with multi-hop questions requiring information synthesis from disparate sources.
  • When existing RAG pipelines suffer from high hallucination rates or low retrieval precision.
  • When the domain requires "Codebase RAG" that understands syntax, imports, and symbol definitions rather than just text semantic similarity.
  • When you need systems that can autonomously fall back to web search or tool execution when internal knowledge is insufficient.

Architecture Patterns

  1. Query Decomposition & Routing: Breaking down complex, high-level questions into focused sub-queries. Agents route these sub-queries to appropriate specialized indexes (e.g., code-index, docs-index, general-web).
  2. Hybrid Retrieval + RRF: Combining lexical search (BM25 for acronyms/technical IDs) with dense embedding search (vector similarity), merged using Reciprocal Rank Fusion (RRF) to boost ranking robustness.
  3. Corrective RAG (CRAG): Implementing a relevance grader that evaluates retrieved docs. If quality is low, the agent triggers a fallback workflow (e.g., web search, re-phrasing).
  4. Self-RAG Reflection Loops: Generation output is passed through an evaluator agent that checks for groundedness and relevance. If it fails, the system triggers a re-retrieval or re-generation cycle.
  5. Codebase RAG (AST-aware): Rather than naive chunking, use AST (Abstract Syntax Tree) parsing to extract class/function definitions and method signatures, ensuring the retriever captures the structural context of the codebase.
Installs
4
GitHub Stars
28
First Seen
Sep 23, 2026