How shu0209/agentic-rag works
This is an agentic RAG chatbot for answering machine-learning questions from an ingested knowledge base, with conversational memory and guardrails. The main workflow gates a user request, plans whether retrieval is needed, optionally retrieves and reranks documents, then generates a response; the agent graph retains conversation state by thread. A separate ingestion workflow parses and chunks source documents, embeds them, and indexes them in Qdrant. Some API, UI, and integration wiring is documented in the README but their source excerpts were not available, so those edges cite the README.
Main entry points: processor.py Ingestion Processor · graph.py Agent Graph · retriever.py Context Retriever · responder.py Answer Generator
Components 22
Client
- Chat UI
ui/app.py
Request Handling
- FastAPI API
app/main.py - Guardrails Gate
app/guardrails/rails.py - Guardrail Flows
app/guardrails/colang_rules.py
Agent Workflow
- Agent Graph
app/agents/graph.py - Conversation State
app/agents/state.py - Intent Planner
app/agents/nodes/planner.py - Context Retriever
app/agents/nodes/retriever.py - Answer Generator
app/agents/nodes/responder.py - LLM Gateway
app/gateways/client.py
Knowledge Ingestion
- Ingestion Processor
app/ingestion/processor.py - PDF Loader
app/ingestion/loaders/pdf_loader.py - HTML Loader
app/ingestion/loaders/html_loader.py - Office Loader
app/ingestion/loaders/office_loader.py - Text Loader
app/ingestion/loaders/text_loader.py - Text Chunker
app/ingestion/chunking/splitter.py
Retrieval Services
- Embedding Service
app/services/retrieval/embeddings.py - Vector Search
app/services/retrieval/qdrant_service.py - Document Reranker
app/services/retrieval/ranking_service.py - Qdrant Store
Other components
- User
- Knowledge Sources
Connections 28
- User → Chat UI: asks
README.md - Chat UI → FastAPI API: submits query
README.md - User → FastAPI API: queries
README.md - FastAPI API → Guardrails Gate: gates request
README.md - Guardrails Gate → Guardrail Flows: uses flows
app/guardrails/rails.py - Guardrails Gate → Agent Graph: passes allowed query
README.md - Agent Graph → Intent Planner: runs first
app/agents/graph.py - Agent Graph → Context Retriever: routes technical query
app/agents/graph.py - Agent Graph → Answer Generator: routes conversational query
app/agents/graph.py - Agent Graph → Answer Generator: routes after retrieval
app/agents/graph.py - Agent Graph → Conversation State: checks state
app/agents/graph.py - Intent Planner → Conversation State: reads and updates
app/agents/nodes/planner.py - Context Retriever → Conversation State: reads and updates
app/agents/nodes/retriever.py - Answer Generator → Conversation State: reads and updates
app/agents/nodes/responder.py - Intent Planner → LLM Gateway: gets LLM
app/agents/nodes/planner.py - Answer Generator → LLM Gateway: uses gateway
README.md - Context Retriever → Vector Search: searches
app/agents/nodes/retriever.py - Context Retriever → Document Reranker: reranks results
app/agents/nodes/retriever.py - Vector Search → Embedding Service: embeds query
app/services/retrieval/qdrant_service.py - Vector Search → Qdrant Store: queries
app/services/retrieval/qdrant_service.py - Ingestion Processor → PDF Loader: parses PDF
app/ingestion/processor.py - Ingestion Processor → HTML Loader: parses HTML
app/ingestion/processor.py - Ingestion Processor → Office Loader: parses Office
app/ingestion/processor.py - Ingestion Processor → Text Loader: parses text
app/ingestion/processor.py - Ingestion Processor → Text Chunker: chunks text
app/ingestion/processor.py - Ingestion Processor → Embedding Service: embeds chunks
app/ingestion/processor.py - Ingestion Processor → Qdrant Store: upserts vectors
app/ingestion/processor.py - Knowledge Sources → Ingestion Processor: provides files
README.md