An AI-powered customer support automation system built with Python, LangGraph, LangChain, Ollama, RAG, and SQLite. The application classifies customer queries, routes them to specialized support agents, retrieves relevant information from a knowledge base, maintains customer conversation history, applies human approval to high-risk requests, and generates a polished final response.
The project demonstrates how agentic workflows, retrieval-augmented generation, persistent memory, and human-in-the-loop approval can be combined to build a practical customer support automation system.
- 🤖 LLM-powered customer support
- 🧠 Automatic customer-query intent classification
- 🔀 LangGraph-based conditional routing
- 💼 Specialized Sales support agent
- 🛠️ Specialized Technical support agent
- 💳 Specialized Billing support agent
- 👤 Specialized Account support agent
- 🧠 Conversation-memory support
- 📚 Retrieval-Augmented Generation (RAG)
- 🔎 Semantic knowledge-base retrieval
- 💾 Persistent customer conversation history using SQLite
- 🛡️ Human approval workflow for high-risk requests
- 👨💼 Supervisor agent for final response review
- 🖥️ Interactive Streamlit interface
- 🏠 Local LLM inference using Ollama
- 📊 Retrieved-context display and department identification
Customer Query
↓
Intent Classification
↓
LangGraph Routing
↓
Specialized Support Agent
↓
Knowledge-Base Retrieval
↓
Agent Response
↓
High-Risk Check
↓
Human Approval if Required
↓
Supervisor Review
↓
Final Customer Response
The intent classifier assigns customer queries to supported categories such as:
- Sales — Pricing, subscriptions, and product information
- Technical — Login issues, crashes, errors, and installation problems
- Billing — Invoices, refunds, and payments
- Account — Passwords, profiles, and account-related requests
- Memory — Questions involving previous customer conversations
LangGraph conditionally routes each request to the appropriate workflow.
Handles sales-related questions and uses relevant knowledge-base context to generate responses.
Handles technical issues and provides troubleshooting guidance using retrieved support information.
Handles billing-related questions such as invoices, refunds, and payments.
Handles account-related questions involving passwords, profiles, and account information.
Retrieves previous conversations for the specified customer from the SQLite database and uses that history to answer questions about earlier interactions.
The support agents use a local knowledge base through a RAG pipeline.
The retrieval process:
- Loads text documents from the
data/directory. - Splits documents into chunks using
RecursiveCharacterTextSplitter. - Generates embeddings using the local nomic-embed-text model through Ollama.
- Stores embeddings in Chroma.
- Performs similarity search for incoming customer queries.
- Retrieves relevant document chunks.
- Passes the retrieved context to the appropriate support agent.
This allows responses to be grounded in the project's available support knowledge base.
Customer conversations are stored in a local SQLite database.
Each conversation stores information such as:
- Customer name
- Customer query
- Assistant response
When a customer asks about a previous interaction, the Memory Agent retrieves the customer's stored conversation history and uses it as context.
Certain potentially high-risk requests trigger a human approval step.
Examples include requests involving:
- Refunds
- Subscription cancellation
- Account closure
- Compensation
- Management or manager escalation
When a high-risk keyword is detected, the workflow requests explicit human approval before continuing.
The current implementation uses a simulated command-line approval prompt rather than an external support-management system.
After a specialized support agent generates a response, the Supervisor Agent reviews it before the final response is returned.
The supervisor is responsible for:
- Checking whether the response addresses the customer's question
- Improving grammar when necessary
- Keeping the response professional and polite
- Preserving the original meaning
- Producing the final customer-facing response
Customer Query
↓
Intent Classification
↓
Conditional Routing
↓
Specialized Agent
↓
RAG Retrieval
↓
Agent Response
↓
High-Risk Check
↓
Human Approval if Required
↓
Supervisor Review
↓
Final Response
Memory-related requests use stored customer conversation history through the Memory Agent.
- Python
- LangChain
- LangGraph
- Ollama
- Qwen3 8B
- nomic-embed-text
- Chroma
- Ollama Embeddings
- RecursiveCharacterTextSplitter
- SQLite
- Streamlit
- PyPDF
- Sentence Transformers
- ChromaDB
- python-dotenv
Customer-Support-Automation/
│
├── data/ # Customer-support knowledge-base documents
├── vectorstore/ # Vector-store related project directory
├── app.py # Streamlit interface
├── database.py # SQLite database initialization
├── graph.py # LangGraph workflow and routing
├── human_loop.py # High-risk human approval workflow
├── memory.py # Conversation storage and retrieval
├── nodes.py # Intent classifier and specialized agents
├── prompts.py # Prompt definitions
├── rag.py # RAG and vector retrieval pipeline
├── state.py # LangGraph shared state definition
├── supervisor.py # Final response supervisor
├── memory.db # SQLite conversation database
├── requirements.txt # Python dependencies
└── .gitignore
git clone https://github.com/SurajGoyal13/Customer-Support-Automation.git
cd Customer-Support-Automation
python -m venv .venv
.venv\Scripts\activate
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Install Ollama on your computer and make sure it is available from the command line.
Then download the models used by the project:
ollama pull qwen3:8b
ollama pull nomic-embed-text
Make sure Ollama is running before starting the application.
Start the Streamlit application:
streamlit run app.py
The application provides fields for:
- Customer name
- Customer query
After submitting a query, the interface displays the retrieved context, final response, department or intent, and whether human approval was required.
The RAG pipeline expects text documents inside the data/ directory.
When the vector database does not already exist, the application creates it by:
- Loading supported text documents from
data/ - Splitting them into chunks
- Generating embeddings
- Storing the resulting vectors in Chroma
The knowledge base can be updated by adding appropriate documents to the data/ directory and rebuilding the vector database when required.
- The system uses a locally hosted Qwen3 8B model through Ollama.
- Intent classification depends on the underlying LLM correctly selecting a supported intent.
- The current human-approval workflow is a simulated command-line approval process.
- High-risk detection uses predefined keywords.
- Conversation memory is stored locally in SQLite rather than a production customer-support platform.
- RAG response quality depends on the quality and coverage of the available knowledge-base documents.
- The application does not directly integrate with external CRM, ticketing, payment, or customer-account systems.
- No production authentication or authorization system is included.
- The project is intended as a prototype and demonstration rather than a production customer-support platform.
The goal of this project is to demonstrate how modern AI application components can be combined into an automated customer-support workflow.
The project demonstrates:
- LLM-based intent classification
- Agent-based workflow orchestration
- Conditional routing with LangGraph
- Retrieval-Augmented Generation
- Local vector search
- Persistent conversation memory
- Human-in-the-loop approval
- Supervisor-based response refinement
- Interactive Streamlit application development
- 🎫 Integrate with real ticketing systems
- 💬 Add richer conversational memory
- 🔐 Add authentication and role-based access
- 🧑💼 Replace simulated approval with a web-based human-review interface
- 📧 Add email-based support automation
- 📊 Add support analytics and dashboards
- 🔌 Integrate CRM and customer-account APIs
- 🧠 Improve intent classification and routing
- 📚 Support additional knowledge-base document formats
- 🛡️ Add stronger validation and safety controls
- 🧪 Add automated tests and evaluation datasets
- 🚀 Deploy the system for production-style environments
Suraj Goyal
Computer Science Student · Python · AI/ML · Web Development · DSA
⭐ If you find this project useful, consider starring the repository.