How theborulesai/agentic-rag-assistant works
This is an agentic RAG assistant: users ask questions in a React chat, and a LangGraph agent can retrieve indexed documents, search the live web, then stream a cited answer and activity events back to the UI. Documents enter through upload or first-boot sample seeding, then are split, embedded, and persisted for retrieval. The README also documents LangSmith tracing and an offline evaluation suite. Several backend modules and evaluation implementations were not sampled; their nodes and connections rely on README claims and the repository tree.
Main entry points: streaming.py Stream bridge · useAgentStream.ts Stream state · agent.py ReAct agent · api.py FastAPI
Components 22
Chat experience
- Chat UI
frontend/src/App.tsx - Stream state
frontend/src/hooks/useAgentStream.ts - SSE parser
frontend/src/lib/sse.ts - Document upload
frontend/src/components/upload/UploadDialog.tsx - API client
frontend/src/lib/api.ts
Agent and API
- FastAPI
src/rag_agent/api.py - Stream bridge
src/rag_agent/streaming.py - ReAct agent
src/rag_agent/agent.py - Event schemas
src/rag_agent/schemas.py - Thread memory
src/rag_agent/agent.py
Knowledge and tools
- Ingestion
src/rag_agent/ingest.py - Embeddings
src/rag_agent/embeddings.py - Vector store access
src/rag_agent/vectorstore.py - Chroma index
src/rag_agent/vectorstore.py - Agent tools
src/rag_agent/tools.py - Model factories
src/rag_agent/llms.py - Sample documents
data/sample_docs
Tracing and evaluation
- LangSmith
- Evaluation suite
evals/run_evals.py
Other components
- User
- OpenAI models
- Web search
Connections 26
- User → Chat UI: asks
- Chat UI → Stream state: submits
- Stream state → FastAPI: POST chat
- FastAPI → Stream bridge: streams events
- Stream bridge → ReAct agent: consumes astream
- ReAct agent → Agent tools: dispatches tools
- ReAct agent → Model factories: uses models
- Model factories → OpenAI models: calls
- Agent tools → Vector store access: retrieves documents
- Vector store access → Chroma index: reads and writes
- Agent tools → Web search: searches web
- ReAct agent → Thread memory: checkpoints threads
- Stream bridge → Event schemas: formats events
- Stream bridge → LangSmith: auto-traces
- Stream bridge → Stream state: SSE events
- Stream state → SSE parser: parses stream
- SSE parser → Stream state: yields events
- Chat UI → Document upload: offers upload
- Document upload → API client: uploads files
- API client → FastAPI: POST ingest
- FastAPI → Ingestion: ingests files
- Sample documents → Ingestion: seeded on boot
- Ingestion → Embeddings: embeds chunks
- Embeddings → OpenAI models: requests embeddings
- Ingestion → Vector store access: persists chunks
- Evaluation suite → LangSmith: runs evaluations