How ochirinho/agentic-rag works
Agentic-RAG answers questions over technical documentation through a FastAPI endpoint, input guardrails, and a tool-using agent that can repeat retrieval before returning a grounded, cited answer. The separate indexing workflow chunks corpus documents, embeds them, and stores them in ChromaDB. The README also documents web search and calculator tools. Some subsystem links are based on README descriptions because their implementation files were not sampled.
Main entry points: graph.py Agent graph · index.py Index builder · tools.py Agent tools · main.py Chat API
Components 18
API
- Chat API
src/api/main.py - Cited answer
Agent workflow
- Agent graph
src/agent/graph.py - Input guardrail
src/guardrails/filters.py - LLM factory
src/agent/llm.py - Tool dispatch
src/agent/graph.py - Agent tools
src/agent/tools.py
Knowledge base
- Semantic search
src/retrieval/search.py - Text chunking
src/ingest/chunk.py - Index builder
src/ingest/index.py - Embedding encoder
src/ingest/embed.py - Docs corpus
data/corpus - Chroma collection
src/retrieval/search.py
Integrations
- LLM provider
- Web search
- Calculator
src/agent/tools.py - Embedding model
Other components
- Questioner
Connections 21
- Questioner → Chat API: asks
- Chat API → Agent graph: runs agent
- Agent graph → Input guardrail: checks input
- Input guardrail → Semantic search: checks relevance
- Semantic search → Embedding encoder: embeds query
- Embedding encoder → Embedding model: encodes locally
- Semantic search → Chroma collection: queries
- Agent graph → LLM factory: requests model
- LLM factory → LLM provider: invokes
- Agent graph → Tool dispatch: dispatches calls
- Tool dispatch → Agent tools: executes tools
- Agent tools → Semantic search: retrieves documents
- Agent tools → Web search: searches web
- Agent tools → Calculator: calculates
- Tool dispatch → Agent graph: returns results
- Index builder → Docs corpus: reads documents
- Index builder → Text chunking: splits text
- Index builder → Embedding encoder: embeds chunks
- Index builder → Chroma collection: stores vectors
- Agent graph → Chat API: returns answer
- Chat API → Cited answer: responds with