An AI-powered multi-agent customer support system built using LangGraph, LangChain, and Ollama.
This project simulates a real-world customer support workflow where multiple AI agents collaborate to:
- classify support tickets
- analyze customer sentiment
- resolve issues
- retrieve knowledge-base answers
- escalate critical cases to humans
The system is fully local and can run using Ollama models like llama3.2.
The system contains specialized agents with independent responsibilities.
- Triage Agent
- Billing Support Agent
- Technical Support Agent
- FAQ Agent
- Sentiment Analysis Agent
- Escalation Agent
Automatically categorizes tickets into:
- billing
- technical
- refund
- account
- complaint
Analyzes customer tone:
- angry
- frustrated
- neutral
- happy
- urgent
Escalates tickets when:
- sentiment is highly negative
- confidence is low
- issue cannot be resolved
- refund/legal keywords appear
Stores:
- previous interactions
- ticket history
- escalation history
- customer context
Runs locally using Ollama.
Supported models:
- llama3.2
graph TD
%% Styling and Themes
classDef client fill:#e1f5fe,stroke:#03a9f4,stroke-width:2px,color:#000;
classDef orchestrator fill:#ffe0b2,stroke:#fb8c00,stroke-width:2px,color:#000;
classDef agent fill:#e8f5e9,stroke:#4caf50,stroke-width:2px,color:#000;
classDef data fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px,color:#000;
classDef infra fill:#eceff1,stroke:#607d8b,stroke-width:2px,color:#000;
%% User Interface Layer
subgraph UI_Layer ["User Interface (Streamlit / CLI)"]
A[Customer / Support Agent] -->|Submits Ticket| B[Streamlit UI / CLI main.py]
end
class B client;
%% Orchestration Layer
subgraph Orchestration_Layer ["Graph Workflow Management (LangGraph & LangChain)"]
B -->|Initializes State| C[LangGraph State Workflow]
C -->|1. Parse Ticket| D[Triage Agent]
%% Routing Decision
D -->|2. Route Category| E{Category Router}
%% Specialized Agents
E -->|billing / refund| F[Billing Support Agent]
E -->|technical / account| G[Technical Support Agent]
E -->|complaint / general| H[FAQ Agent]
%% Response Processing Pipeline
F --> I[Response Aggregator]
G --> I
H --> I
%% Sentiment and Evaluation
I -->|3. Evaluate Output| J[Sentiment Analysis Agent]
J -->|4. Check Escalation Triggers| K{Escalation Router}
end
class C,E,K orchestrator;
class D,F,G,H,J,L agent;
%% Human Escalation Fallback
subgraph Escalation_Layer ["Escalation Management"]
K -->|Highly Negative / Low Confidence| L[Escalation Agent]
L -->|Handoff| M[Human Support Pipeline]
end
class M client;
%% Data and Storage Layer
subgraph Storage_Layer ["Data & Vector Systems"]
C <-->|Read / Write History| N[(SQLite Chat Memory)]
F & G & H <-->|Query Context| O[(ChromaDB Knowledge Base)]
end
class N,O data;
%% Local LLM Execution Layer
subgraph Local_Infra ["Local LLM Infrastructure"]
D & F & G & H & J & L -.->|Local API Calls| P[FastAPI Backend]
P -.->|Inference| Q[Ollama Service]
Q -.->|Model Runtime| R[llama3.2]
end
class P,Q,R infra;
%% Output Node
K -->|Resolved State| S[Final Output Response to UI]
M -->|Human Response| S
S --> B
| Component | Technology |
|---|---|
| LLM | Ollama |
| Models | llama3.2 |
| Framework | LangChain |
| Orchestration | LangGraph |
| Backend | FastAPI |
| UI | Streamlit |
| Database | SQLite |
| Vector Store | ChromaDB |
customer_support_ai/
│
├── agents/
│ ├── triage_agent.py
│ ├── billing_agent.py
│ ├── technical_agent.py
│ ├── faq_agent.py
│ ├── sentiment_agent.py
│ └── escalation_agent.py
│
├── graph/
│ └── workflow.py
│
├── prompts/
│ └── prompts.py
│
├── memory/
│ └── chat_memory.py
│
├── database/
│ └── tickets.db
│
├── ui/
│ │
│ ├── app.py
│ │
│ ├── pages/
│ │ ├── dashboard.py
│ │ ├── ticket_history.py
│ │ ├── analytics.py
│ │ └── settings.py
│ │
│ ├── components/
│ │ ├── agent_card.py
│ │ ├── workflow_graph.py
│ │ ├── sentiment_meter.py
│ │ └── escalation_box.py
│ │
│ └── assets/
│ └── styles.css
│
├── main.py
├── requirements.txt
├── .env
└── README.md
git clone <your-repo-url>
cd customer_support_aipython -m venv venv
source venv/bin/activatepython -m venv venv
venv\Scripts\activatepip install -r requirements.txtDownload and install Ollama:
ollama pull llama3.2ollama run llama3.2Create a .env file:
MODEL_NAME=llama3.2:latest
TEMPERATURE=0python main.pystreamlit run ui/app.pyI was charged twice for my subscription and nobody has responded for 3 days.
Category : technical
Sentiment : frustrated
Escalation : escalate
Response:
Step-by-step troubleshooting guide for payment failure...
Ticket Received
↓
Triage Agent
↓
Routing (Billing / Technical / FAQ)
↓
Response Generation
↓
Sentiment Analysis
↓
Escalation Decision
↓
Final Output
This project demonstrates:
- Multi-agent orchestration
- AI workflow design
- LangGraph state management
- LLM routing
- Memory systems
- Human escalation pipelines
| Agent | Responsibility |
|---|---|
| Triage Agent | Ticket classification |
| Billing Agent | Payment/refund issues |
| Technical Agent | Bug troubleshooting |
| FAQ Agent | General support |
| Sentiment Agent | Emotion detection |
| Escalation Agent | Human escalation |
- Add RAG-based knowledge base
- Add confidence scoring before escalation
- Add structured JSON outputs
- Add evaluation metrics for routing accuracy
- Add logging dashboard for agent decisions
- Voice based chat
MIT License
- LangChain
- LangGraph
- Ollama
- Streamlit
- FastAPI