How shaadclt/agentic-adaptive-rag works
Agentic Adaptive RAG accepts questions and uploaded documents, routes each question between local retrieval and web search, grades evidence and answers, then returns a protected response with sources. Document ingestion, evaluation, and observability are supporting product workflows. The README documents the frontend/backend capabilities; sampled backend files and the SOURCE INDEX support several implementation links. Some frontend-to-API wiring and unsampled graph details are documented but not directly visible in source excerpts.
Main entry points: graph.py LangGraph Workflow · api.py HTTP API · retrieval.py Local Retrieval · model.py LLM and Embeddings
Components 25
User Experience
- Chat UI
frontend/src/app/page.tsx - Evaluation UI
frontend/src/app/evaluation/page.tsx - Observability UI
frontend/src/app/observability/page.tsx - HTTP API
backend/api.py
Knowledge Base
- Document Ingestion
backend/ingestion.py - Chroma Vector Store
backend/ingestion.py - Local Retrieval
backend/retrieval.py - Source Extraction
backend/sources.py
Agent Workflow
- LangGraph Workflow
backend/graph/graph.py - Query Router
backend/graph/chains/router.py - Retrieve Node
backend/graph/nodes/retrieve.py - Retrieval Grader
backend/graph/chains/retrieval_grader.py - Web Search
backend/graph/nodes/web_search.py - Answer Generation
backend/graph/chains/generation.py - Answer Graders
backend/graph/chains/answer_grader.py - Evidence Context
backend/graph/context.py
Safety and Models
- Input Security
backend/graph/nodes/security.py - Content Guard
backend/security/content_guard.py - Output Security
backend/security/output_guard.py - Security Rules
backend/security/security_config.py - LLM and Embeddings
backend/model.py
Evaluation and Observability
- Evaluation Tracker
backend/evaluation.py - Run Observability
backend/observability.py
Other components
- User
- Web Search Service
Connections 34
- User → Chat UI: asks or uploads
README.md - Chat UI → HTTP API: sends requests
README.md - HTTP API → LangGraph Workflow: invokes
backend/api.py - HTTP API → Document Ingestion: manages documents
backend/api.py - Document Ingestion → Chroma Vector Store: writes and lists
backend/ingestion.py - Local Retrieval → Chroma Vector Store: searches
backend/retrieval.py - LangGraph Workflow → Local Retrieval: retrieves routing context
backend/graph/graph.py - LangGraph Workflow → Input Security: checks requests
backend/graph/graph.py - LangGraph Workflow → Query Router: routes questions
backend/graph/graph.py - LangGraph Workflow → Retrieve Node: dispatches retrieval
backend/graph/graph.py - Retrieve Node → Local Retrieval: invokes retriever
backend/graph/nodes/retrieve.py - LangGraph Workflow → Retrieval Grader: grades retrieved documents
backend/graph/graph.py - LangGraph Workflow → Web Search: dispatches fallback
backend/graph/graph.py - Web Search → Web Search Service: searches web
README.md - LangGraph Workflow → Answer Generation: generates answers
backend/graph/graph.py - LangGraph Workflow → Answer Graders: validates answers
backend/graph/graph.py - LangGraph Workflow → Evidence Context: formats evidence
backend/graph/graph.py - Evidence Context → Content Guard: wraps untrusted text
backend/graph/context.py - LangGraph Workflow → Output Security: protects response
backend/graph/graph.py - Input Security → Security Rules: uses rules
- Content Guard → Security Rules: uses patterns
backend/security/content_guard.py - Output Security → Security Rules: uses limits
backend/security/output_guard.py - Query Router → LLM and Embeddings: uses LLM
backend/graph/chains/router.py - Answer Generation → LLM and Embeddings: uses LLM
backend/graph/chains/generation.py - Local Retrieval → LLM and Embeddings: uses embeddings
backend/retrieval.py - Document Ingestion → LLM and Embeddings: uses embeddings
backend/ingestion.py - HTTP API → Source Extraction: extracts sources
backend/api.py - LangGraph Workflow → Evaluation Tracker: records run results
README.md - HTTP API → Evaluation Tracker: serves evaluation
backend/api.py - HTTP API → Run Observability: serves run data
backend/api.py - Evaluation UI → HTTP API: loads evaluation
README.md - Observability UI → HTTP API: loads observability
README.md - User → Evaluation UI: reviews results
README.md - User → Observability UI: reviews runs
README.md