How chandancoding/production-agentic-rag works
This is a provider-agnostic agentic RAG library with CLI and FastAPI interfaces. Its main workflow loads and chunks documents into a hybrid index, then checks a question, plans sub-questions, retrieves and synthesizes grounded answers, and returns citations and a trace. Evaluation, alternate LangGraph execution, and optional integrations are separate capabilities. Edges follow shown calls or README claims; some branches are documented but their implementation was not sampled.
Main entry points: pipeline.py RAG pipeline · rag_agent.py Agent loop · hybrid.py Hybrid retriever · cli.py CLI
Components 21
Interfaces
- CLI
src/production_agentic_rag/cli.py - HTTP service
api/main.py - RAG pipeline
src/production_agentic_rag/pipeline.py
Ingestion
- File loaders
src/production_agentic_rag/ingestion/loaders.py - Chunk strategies
src/production_agentic_rag/ingestion/chunking.py
Retrieval
- Hybrid retriever
src/production_agentic_rag/retrieval/hybrid.py - BM25 search
src/production_agentic_rag/retrieval/bm25.py - Vector store
src/production_agentic_rag/retrieval/vectorstore.py - Embedding providers
src/production_agentic_rag/providers/embeddings.py
Agent and safeguards
- Agent loop
src/production_agentic_rag/agents/rag_agent.py - Query planner
src/production_agentic_rag/agents/planner.py - Retrieval tool
src/production_agentic_rag/agents/tools.py - LLM providers
src/production_agentic_rag/providers/llm.py - Guardrails
src/production_agentic_rag/guardrails.py - LangGraph engine
src/production_agentic_rag/graph.py
Evaluation and telemetry
- Evaluation harness
src/production_agentic_rag/evaluation/harness.py - Evaluation metrics
src/production_agentic_rag/evaluation/metrics.py - Trace accounting
src/production_agentic_rag/observability.py - Optional integrations
src/production_agentic_rag/integrations.py
Other components
- User
- Document corpus
Connections 28
- User → CLI: asks or evaluates
README.md - User → HTTP service: sends request
README.md - CLI → File loaders: loads documents
src/production_agentic_rag/cli.py - CLI → RAG pipeline: runs query
src/production_agentic_rag/cli.py - Document corpus → File loaders: provides files
README.md - File loaders → RAG pipeline: supplies documents
src/production_agentic_rag/cli.py - RAG pipeline → Chunk strategies: chunks text
src/production_agentic_rag/pipeline.py - RAG pipeline → Hybrid retriever: indexes chunks
src/production_agentic_rag/pipeline.py - RAG pipeline → Guardrails: checks and redacts
src/production_agentic_rag/pipeline.py - RAG pipeline → Agent loop: runs selected engine
src/production_agentic_rag/pipeline.py - RAG pipeline → Embedding providers: builds embedder
src/production_agentic_rag/pipeline.py - RAG pipeline → LLM providers: builds provider
src/production_agentic_rag/pipeline.py - RAG pipeline → Trace accounting: records query trace
src/production_agentic_rag/pipeline.py - RAG pipeline → LangGraph engine: selects when configured
src/production_agentic_rag/pipeline.py - Agent loop → Query planner: decomposes query
src/production_agentic_rag/agents/rag_agent.py - Agent loop → Retrieval tool: calls retrieval
src/production_agentic_rag/agents/rag_agent.py - Agent loop → LLM providers: synthesizes answer
src/production_agentic_rag/agents/rag_agent.py - Agent loop → Guardrails: scores grounding
src/production_agentic_rag/agents/rag_agent.py - Agent loop → Trace accounting: records usage spans
src/production_agentic_rag/agents/rag_agent.py - Retrieval tool → Hybrid retriever: retrieves chunks
src/production_agentic_rag/agents/tools.py - Hybrid retriever → BM25 search: searches lexically
src/production_agentic_rag/retrieval/hybrid.py - Hybrid retriever → Vector store: searches vectors
src/production_agentic_rag/retrieval/hybrid.py - Vector store → Embedding providers: embeds chunks
src/production_agentic_rag/retrieval/vectorstore.py - HTTP service → RAG pipeline: serves RAG requests
README.md - CLI → Evaluation harness: runs eval
src/production_agentic_rag/cli.py - Evaluation harness → Evaluation metrics: computes measures
src/production_agentic_rag/evaluation/harness.py - Optional integrations → Hybrid retriever: wraps retrieval tool
README.md - Trace accounting → Optional integrations: exports telemetry
README.md