Intelligent multi-agent chatbot for insurance claims and customer support, built with LangGraph and LangChain. It combines NL2SQL and RAG to give accurate, context-aware answers, with robust memory management for smooth multi-turn conversations.
Final year project (PFE) — insurance/health ("Santé") customer support assistant for adherents (policyholders) and médecins (doctors).
- Overview
- Multi-agent architecture
- Tech stack
- Project structure
- Getting started
- Configuration
- Running the project
- Roadmap
- License
Isanté Assistant is a conversational agent designed for an insurance/health context. It handles two types of users — adherents (policyholders) and médecins (doctors) — and can:
- Answer general questions conversationally
- Handle insurance claims ("réclamations"), distinguishing simple cases from ones that need human intervention
- Retrieve structured data (user history, policy details) via natural-language-to-SQL
- Retrieve unstructured knowledge (policy documents, FAQs) via retrieval-augmented generation
- Maintain conversation memory across turns, with per-user persistent profiles
The system is orchestrated as a stateful graph (DAG) in LangGraph, with a shared AgentState acting as the whiteboard that every agent reads from and writes to.
Core agents
| Agent | File | Responsibility |
|---|---|---|
| Conversational Agent | conversationalagent.py |
First point of contact. Handles general chat and triages intent — decides if a query needs the claims or database agent. |
| Claims Agent | claimsagent.py |
Handles insurance claim logic; distinguishes simple claims from cases requiring human intervention. |
| Database Agent | databaseagent.py |
Retrieves structured data (user history, policy details) via NL2SQL. |
| Final Answer Agent | finalansweragent.py |
Synthesizes the output of the previous agents into a single, coherent response. |
Workflow (workflow.py)
- Load memory — load the adherent/médecin profile for personalized context.
- Ingest input — the user's question enters a fresh turn of state.
- Conversational Agent — analyzes the request and routes:
- to the Claims Agent if the query concerns a claim,
- to the Database Agent if it needs stored data,
- or straight to a general answer if it's a simple conversational query.
- Claims / Database Agent → Final Answer Agent — whichever specialized agent ran, its output is passed to the Final Answer Agent to build the response.
- Summarize & update memory — before ending, the conversation is summarized to control token usage, and the user's persistent memory is updated.
State management
The shared AgentState tracks:
- User context (
adherent_id,medecin_id, etc.) - Per-agent message histories (to avoid cross-agent context pollution)
- A running conversation summary, so follow-up questions work without blowing the context window
- Backend (
smart Backend/) — Python, LangChain, LangGraph - Frontend (
frontend/) — TypeScript - Additional service — Java
- Data layer — SQL database (via NL2SQL) + vector store for RAG
PFE-Project/
├── Isanté-assistant/ # Multi-agent core (LangGraph workflow, agents)
│ ├── conversationalagent.py
│ ├── claimsagent.py
│ ├── databaseagent.py
│ ├── finalansweragent.py
│ └── workflow.py
├── frontend/ # TypeScript client application
├── smart Backend/ # Python backend service(s)
└── .gitignore
- Python 3.10+
- Node.js 18+ (for the frontend)
- A running SQL database (for the Database Agent)
- An LLM provider API key (e.g. OpenAI/Anthropic — set in your
.env)
# Clone the repo
git clone https://github.com/medlouaynjima/PFE-Project.git
cd PFE-Project
# Backend
cd "smart Backend"
pip install -r requirements.txt
# Frontend
cd ../frontend
npm installCreate a .env file in the backend directory with the variables your setup needs, for example:
OPENAI_API_KEY=your_key_here
DATABASE_URL=your_database_connection_string
VECTOR_STORE_PATH=your_vector_store_pathAdjust the variable names above to match what your code actually reads — update this section with your real config keys before publishing.
# Start the backend
cd "smart Backend"
python main.py
# Start the frontend (in a separate terminal)
cd frontend
npm run devUpdate the run commands above to match your actual entry points.
- Add automated evaluation for intent-routing accuracy
- Add graceful fallback handling for failed DB/RAG lookups
- Expand human-handoff flow for complex claims
- Add test coverage for the LangGraph workflow
Specify a license for your project (e.g. MIT) here.