How jasirahamed786/infosys-rag-project works
Purpose and Entry Points
Clario is a real-time customer-support coaching system. A React agent console submits conversation turns to a FastAPI backend, which executes AI analysis and returns coaching artifacts. Backend entry point: backend/app/main.py; frontend bootstrap and root UI: frontend/src/main.tsx, frontend/src/App.tsx.
API and Session Boundary
FastAPI registers domain routers for conversation processing, session lifecycle, knowledge ingestion, simulator operation, coaching, escalation, analytics, and reports. Request/response and persistence-facing schemas are centralized in backend/app/models/schemas.py. Key API surfaces are organized in backend/app/routers/conversation.py, backend/app/routers/sessions.py, and backend/app/routers/knowledge.py.
Turn Orchestration Pipeline
backend/app/orchestration/pipeline.py is the central control-flow boundary for a conversation turn. It composes specialized agents, isolates failures through fallbacks, and aggregates outputs for the live console. The staged flow is: incoming customer message → intent/sentiment classification → conditional RAG retrieval → coaching recommendation → escalation assessment; simulator mode additionally generates the next customer message.
Specialized AI Agents
Agent responsibilities are split by concern rather than embedded in route handlers:
• Intent, sentiment, and frustration classification: backend/app/agents/intent_sentiment_agent.py
• Knowledge-grounded retrieval decisions: backend/app/agents/knowledge_agent.py
• Suggested agent response and communication feedback: backend/app/agents/coaching_agent.py
• Cross-turn escalation risk and recommended action: backend/app/agents/escalation_agent.py
• Simulated customer turns for practice mode: backend/app/agents/simulator_agent.py
• Future/post-session summarization capability: backend/app/agents/summary_agent.py
Groq/Llama is used for intent and simulation; Google Gemini serves knowledge, coaching, and escalation functions through the shared LLM boundary in backend/app/utils/llm_client.py.
Persistence and Knowledge Retrieval
MongoDB persists sessions, messages, and report-oriented data through backend/app/services/mongo.py. RAG ingestion/retrieval is separated in backend/app/services/rag.py, backed by local persisted ChromaDB data at backend/chroma_data/chroma.sqlite3. This separates durable operational conversation state (MongoDB) from semantic knowledge indexing (ChromaDB). Runtime credentials and service configuration are environment-driven via backend/app/core/config.py and .env.example.
Frontend Session Experience
The frontend is a Vite React 18/TypeScript SPA. frontend/src/context/SessionContext.tsx holds active conversation state and accumulated pipeline output above navigation, so state survives movement between session configuration and live views. frontend/src/services/api.ts is the frontend/backend contract boundary. Primary operational screens are frontend/src/pages/SessionConfig.tsx, frontend/src/pages/LiveConsole.tsx, and frontend/src/pages/KnowledgeBaseUpload.tsx.
Runtime and External Dependencies
The deployable runtime is a Python FastAPI server (typically Uvicorn on port 8000) plus a Node/Vite frontend (typically port 5173). Material external services are MongoDB, Groq, and Google Gemini. ChromaDB is locally persisted under backend/chroma_data/; no separate web-server or queue infrastructure is evidenced by the repository tree.
Main entry points: pipeline.py Turn pipeline · llm_client.py LLM client · conversation.py Domain routers · App.tsx Root UI
Components 21
React SPA
- App bootstrap
frontend/src/main.tsx - Root UI
frontend/src/App.tsx - Session state · Retains active session and pipeline output across views.
frontend/src/context/SessionContext.tsx - Session & live screens
frontend/src/pages/SessionConfig.tsx - Knowledge upload
frontend/src/pages/KnowledgeBaseUpload.tsx - API client
frontend/src/services/api.ts
FastAPI backend
- FastAPI entry
backend/app/main.py - Domain routers · Conversation, session, knowledge, simulator, coaching, escalation, analytics, and reports.
backend/app/routers/conversation.py - Shared schemas
backend/app/models/schemas.py
AI pipeline
- Turn pipeline · Composes agents, fallbacks, and live coaching artifacts.
backend/app/orchestration/pipeline.py - Intent & sentiment
backend/app/agents/intent_sentiment_agent.py - Knowledge retrieval
backend/app/agents/knowledge_agent.py - Coaching
backend/app/agents/coaching_agent.py - Escalation assessment
backend/app/agents/escalation_agent.py - Customer simulator · Used only for practice-mode next turns.
backend/app/agents/simulator_agent.py - LLM client · Routes Groq/Llama and Google Gemini calls.
backend/app/utils/llm_client.py
Data & external services
- Mongo persistence
backend/app/services/mongo.py - MongoDB · Stores sessions, messages, and report data.
- RAG service
backend/app/services/rag.py - ChromaDB index
backend/chroma_data/chroma.sqlite3 - Groq & Gemini · Groq/Llama supports intent and simulation; Gemini supports knowledge, coaching, and escalation.
Connections 27
- App bootstrap → Root UI: mounts
- Root UI → Session state: provides state
- Session state → Session & live screens: supplies session state
- Root UI → Knowledge upload: renders
- Session & live screens → API client: submits turns
- Knowledge upload → API client: uploads knowledge
- API client → FastAPI entry: HTTP
- FastAPI entry → Domain routers: registers
- Domain routers → Shared schemas: validates with
- Domain routers → Turn pipeline: processes turns
- Domain routers → Mongo persistence: session lifecycle
- Domain routers → RAG service: knowledge ingestion
- Turn pipeline → Intent & sentiment: classifies
- Turn pipeline → Knowledge retrieval: retrieves conditionally
- Turn pipeline → Coaching: recommends
- Turn pipeline → Escalation assessment: assesses
- Turn pipeline → Customer simulator: practice mode
- Turn pipeline → Mongo persistence: persists turn data
- Knowledge retrieval → RAG service: queries
- RAG service → ChromaDB index: indexes and retrieves
- Mongo persistence → MongoDB: stores
- Intent & sentiment → LLM client: LLM call
- Knowledge retrieval → LLM client: LLM call
- Coaching → LLM client: LLM call
- Escalation assessment → LLM client: LLM call
- Customer simulator → LLM client: LLM call
- LLM client → Groq & Gemini: provider requests