How mudavath-kumar/major-project-trust-aware-consensus-framework-for-multi-agent-rag works
TrustRAG is an evidence-first, multi-agent RAG platform. The principal workflow is a user uploading tenant-scoped documents, asking a scoped question, and receiving a cited consensus answer with trust and evaluation metrics. The graph follows the documented client → Express backend → FastAPI AI service flow, then shows ingestion, retrieval, agent review, consensus, and persisted results. The README documents several capabilities whose implementation details were not sampled; those links are shown only where documented.
Main entry points: rag.py RAG API · server.ts API server · api-client.ts API client · models Application records
Components 28
User application
- App screens
src/routes/app.chat.tsx - Knowledge screens
src/routes/app.knowledge.tsx - API client
src/lib/api-client.ts - Document store
src/lib/doc-store.ts - Evaluation matrix
src/components/app/EvaluationMatrixModal.tsx
API and security
- API server
backend/src/server.ts - Authentication
backend/src/middleware/auth.ts - Chat workflow
backend/src/controllers/chat.controller.ts - Document workflow
backend/src/controllers/document.controller.ts - Evidence reporting
backend/src/controllers/evidence.controller.ts - AI service client
backend/src/services/ai.service.ts - File storage
backend/src/services/storage.service.ts
RAG and consensus
- Vector store
ai-service/app/rag/vectorstore.py - RAG API
ai-service/app/api/rag.py - Document chunking
ai-service/app/rag/chunker.py - Embeddings
ai-service/app/rag/embeddings.py - Researcher
ai-service/app/agents/researcher.py - Fact checker
ai-service/app/agents/fact_checker.py - Critic
ai-service/app/agents/critic.py - Trust assessor
ai-service/app/agents/trust_assessor.py - Consensus engine
ai-service/app/consensus/engine.py - Final reasoner
ai-service/app/agents/reasoner.py - LLM provider routing
ai-service/app/core/llm_router.py
Persistence
- Application records
backend/src/models
Other components
- User
- Gemini / OpenRouter
- Backblaze B2
- MongoDB
Connections 31
- User → App screens: asks / reviews
- User → Knowledge screens: uploads files
- App screens → API client: requests
src/routes/app.chat.tsx - Knowledge screens → Document store: ingests file
src/routes/app.knowledge.tsx - Document store → API client: uploads through
src/lib/doc-store.ts - API client → API server: REST requests
- API server → Authentication: mounts protected routes
backend/src/server.ts - API server → Chat workflow: routes chat
backend/src/server.ts - API server → Document workflow: routes documents
backend/src/server.ts - API server → Evidence reporting: routes evidence
backend/src/server.ts - Chat workflow → AI service client: runs query pipeline
backend/src/controllers/chat.controller.ts - Chat workflow → Application records: persists conversations and results
backend/src/controllers/chat.controller.ts - Document workflow → Application records: persists document records
backend/src/controllers/document.controller.ts - Document workflow → File storage: stores uploaded files
backend/src/controllers/document.controller.ts - File storage → Backblaze B2: uploads / deletes objects
backend/src/services/storage.service.ts - Application records → MongoDB: stores records
- AI service client → RAG API: internal HTTP RPC
- RAG API → Document chunking: chunks documents
ai-service/app/api/rag.py - RAG API → Embeddings: creates embeddings
ai-service/app/api/rag.py - RAG API → Vector store: reads / writes vectors
ai-service/app/api/rag.py - RAG API → Researcher: retrieves evidence
ai-service/app/api/rag.py - RAG API → Fact checker: cross-checks claims
ai-service/app/api/rag.py - RAG API → Critic: audits reasoning
ai-service/app/api/rag.py - RAG API → Trust assessor: scores attribution
ai-service/app/api/rag.py - RAG API → Consensus engine: builds consensus
ai-service/app/api/rag.py - RAG API → Final reasoner: requests synthesis
ai-service/app/api/rag.py - Consensus engine → Final reasoner: feeds final reasoning
- Researcher → LLM provider routing: generates with
ai-service/app/agents/researcher.py - LLM provider routing → Gemini / OpenRouter: calls configured provider
ai-service/app/core/llm_router.py - Evaluation matrix → API client: loads evaluations
- Evidence reporting → Application records: reads audit results
backend/src/controllers/evidence.controller.ts