An autonomous, agentic email-based assistant for NBFC professionals. It automatically ingests, classifies, and responds to queries about RBI guidelines and internal lending processes. It also includes a traditional web-based RAG chatbot interface.
backend/: Contains the FastAPI server for the web chat and the complete agentic email workflow.agents/: Houses the Classifier, Coordinator, and Retrieval agents.core/: Core logic for orchestration, configuration, and the main agent service runner.db/: Database models, session management, and CRUD operations for logging.services/: Connectors for external services like Email (IMAP/SMTP).api/: The FastAPI application for the web chat interface.
frontend/: React.js UI for the web chat and feedback.data/: Source documents like RBI circulars, PDFs, etc.
- Install Python 3.10+ and Node.js.
- Create a
.envfile in thebackenddirectory. Populate it with your credentials. Seebackend/core/config.pyfor all required variables (OpenAI, Pinecone, IMAP, SMTP). - Backend:
cd backend && pip install -r requirements.txt - Frontend:
cd frontend && npm install - Run Agentic Service:
python -m backend.run_agent_service - Run Web Chat Backend:
uvicorn backend.api.main:app --reload - Run Web Chat Frontend:
cd frontend && npm start
- Agentic Email Workflow:
- Email Ingestion Agent: Automatically reads unread emails from a specified inbox (e.g.,
compliance@nbfcbot.com). - Email Classifier Agent: Uses an LLM to classify email intent (RBI Regulation, NBFC Lending, Combined, or Other).
- Coordinator & Retrieval Agents: Routes the query to the correct RAG pipeline, retrieving context from separate vector databases (one for RBI rules, one for internal lending processes).
- Response Generation Agent: Generates a contextual, natural-language answer with sources.
- Email Reply Agent: Automatically sends the formatted response back to the customer.
- Email Ingestion Agent: Automatically reads unread emails from a specified inbox (e.g.,
- Database Logging: Every email interaction is logged in a database for auditing and review.
- Web Chat Interface: A traditional RAG chatbot interface is also available for direct queries.
- Document Ingestion: Scripts to ingest, chunk, embed, and store documents in Pinecone vector stores.
┌────────────┐
│ Email │
│ Inbox │
└────┬───────┘
▼
┌──────────────────┐
│ Email Ingestion │
└────┬─────────────┘
▼
┌─────────────────────────────┐
│ Email Classifier Agent │
│ (RBI / Lending / Other?) │
└────┬─────────────┬──────────┘
▼ ▼
┌────────────┐ ┌──────────────┐
│ Regulation │ │ Lending │
│ Agent │ │ Agent │
│ (RBI DB) │ │ (NBFC DB) │
└────┬───────┘ └─────┬────────┘
▼ ▼
┌─────────────────────┐
│ Coordinator Agent │
│ (Merge, Format) │
└────┬────────────────┘
▼
┌────────────────────┐
│ Email Reply Agent │
└────────────────────┘
┌──────────────┐
│ User │
│ (NBFC Staff) │
└────┬─────────┘
│
▼
┌─────────────────────┐
│ Chatbot Frontend │
│ (React.js UI) │
└────┬────────────────┘
▼
┌────────────────────────────────────┐
│ Backend API Server (FastAPI) │
└────┬────────────┬─────────────────┘
▼ ▼
┌────────────┐ ┌─────────────────────┐
│ RAG Flow │ │ Chart Generator │
│ (LLM + DB) │ │ (Matplotlib) │
└────┬───────┘ └─────────────────────┘
▼
┌─────────────────────────────┐
│ Vector DB (Pinecone) │
│ (Chunks + Embeddings) │
└────────────┬────────────────┘
▼
┌──────────────────────┐
│ Document Store │
│ (PDFs/Text) │
└──────────────────────┘
User → Frontend: Enter query
Frontend → Backend: Send query
Backend → Pinecone: Embed & search chunks
Backend → LLM: Generate answer
Backend → Chart Generator: (if numeric) Generate chart
Backend → SQL DB: Store search history/feedback
Backend → Frontend: Return answer, sources, chart
Frontend → User: Display results
- Data Collection
- Text Extraction, Chunking, Embedding
- RAG Integration
- Chatbot Interface + Backend API
- Chart Generator Integration
- Feedback Loop + Logging
- Dockerization + Deployment