AgenticRAG is a sophisticated Retrieval-Augmented Generation (RAG) system built on LangGraph. It implements the latest "Agentic RAG" patterns, including Adaptive Routing and Corrective Self-Healing, ensuring high-accuracy answers by grading its own work.
The system doesn't assume all answers are in the vector store. It uses an LLM-powered router to decide whether a query should be served by the Local Vector Store (domain-specific knowledge) or Web Search (real-time/general info via Tavily).
Retrieved documents are automatically graded for relevance. If the system finds the retrieved data is insufficient or irrelevant:
- It transforms the query to better capture intent.
- It re-tries the retrieval or falls back to web search.
Before a response is shown to the user, CodeWeaver performs two critical checks:
- Hallucination Check: Is the answer supported only by the retrieved facts?
- Utility Check: Does the answer actually resolve the user's original question?
- Orchestration: LangGraph
- Vector Store: FAISS
- Embeddings: HuggingFace (
all-MiniLM-L6-v2) - LLM: Groq (Llama 3.3 70B)
- Tools: Tavily Search API
graph TD
START --> Router[Router Node]
Router -->|Local| Retrieve[Retrieve from VectorStore]
Router -->|General| WebSearch[Web Search]
Retrieve --> Grade[Grade Documents]
Grade -->|Relevant| Generate[Generate Answer]
Grade -->|Irrelevant| Transform[Transform Query]
Transform --> Retrieve
WebSearch --> Generate
Generate --> Hallucination{Hallucination Check}
Hallucination -->|Failed| Generate
Hallucination -->|Passed| AnswerCheck{Answer Utility Check}
AnswerCheck -->|Not Useful| Transform
AnswerCheck -->|Useful| END
- Python 3.9+
- Groq API Key
- Tavily API Key
pip install -r requirements.txtCreate your vector index first:
python ingest.pypython AdaptiveCorrectiveAgenticRag.pyAdaptiveCorrectiveAgenticRag.py: The main graph logic.ingest.py: Data ingestion and vector store creation.faiss_index/: Local vector database.requirements.txt: Project dependencies.
Created as part of the LangGraph Learning Series - Tier 1 Showcase.