Skip to content

Latest commit

Β 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ§πŸ’¬ SmartSupport: Intelligent Customer Support Agent

SmartSupport is an AI-powered customer support agent that automatically categorizes incoming queries, detects sentiment, and routes each conversation to the right handler all in real time. No rigid decision trees, no hardcoded FAQs. Just a smart agent that knows when to troubleshoot, when to handle billing, and when to escalate.

Python Streamlit LangGraph Groq License

Smart Support

Note: This is a general-purpose customer support agent. It is not affiliated with any company or product, use it to explore AI-powered support routing


πŸ“Œ Overview

SmartSupport is a multi-node customer support agent built with:

  • LangGraph for stateful, graph-based query routing
  • Groq (Llama 3.3 70B) for fast, high-quality LLM inference
  • Streamlit for a clean, zero-config chat interface

Paste your Groq API key, type a customer query, and the agent handles everything, classifying the issue, reading the sentiment, picking the right handler, and responding with context-aware, empathetic answers.


✨ Features

Feature Details
πŸ”‘ Bring-your-own key Enter your Groq API key in the sidebar, no .env or server config needed
πŸ—‚ Auto categorization Every query is classified as Technical, Billing, or General before routing
πŸ’¬ Sentiment detection Positive, Neutral, or Negative, detected automatically on each message
πŸ”€ Smart routing LangGraph conditional edges route to the right handler based on category + sentiment
🚨 Escalation logic Only Negative + Technical queries escalate, other frustrated users still get real help
🀝 Empathy-aware replies Negative-sentiment queries get an empathetic opening before the actual answer
πŸ“Š Live metadata badges Every response shows the detected category and sentiment inline

πŸ›  Tools & Technologies

Layer Technology Purpose
UI Streamlit 1.45 Chat interface, sidebar, session state
LLM Groq Β· Llama 3.3 70B Fast inference, categorization, response generation
Orchestration LangGraph 1.2 Stateful agent graph with conditional routing

πŸ“ Project Structure


β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
β”œβ”€β”€ SmartSupport_CustomerSupportAgent.ipynb
β”œβ”€β”€ app.py
└── requirements.txt

⚑ Quick Start

1 Β· Clone the repo

git clone https://github.com/muqadasejaz/SmartSupport-Customer-Support-Agent
cd SmartSupport-agent

2 Β· Create a virtual environment

python -m venv venv

# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

3 Β· Install dependencies

pip install -r requirements.txt

4 Β· Run the app

streamlit run app.py

The app opens at http://localhost:8501.

5 Β· Get a free Groq API key

Sign up at console.groq.com, go to API Keys, and click Create API Key. It is free.


🧭 How to Use

1. Enter your Groq API key in the sidebar
2. Type a customer query in the chat box
3. The agent categorizes the query and detects sentiment
4. You get a routed, context-aware response instantly
5. Category and sentiment badges appear under each response
6. Click "Clear chat" to start a fresh session

Try these sample queries:

  • "My app keeps crashing when I open the dashboard" β†’ Technical
  • "I was charged twice this month" β†’ Billing
  • "Do you offer live chat support?" β†’ General
  • "I've been trying to fix this for three days and nothing works" β†’ Escalated

πŸ— Architecture

The diagram below shows how a user message flows through the agent graph:

User sends a message
β”‚
β–Ό
Streamlit (app.py)
Passes query into LangGraph workflow
β”‚
β–Ό
Node 1 Β· categorize
β†’ Classifies query as: Technical | Billing | General
β”‚
β–Ό
Node 2 Β· analyze_sentiment
β†’ Detects sentiment as: Positive | Neutral | Negative
β”‚
β–Ό
Conditional Router Β· route_query
β†’ Negative + Technical   β†’  escalate
β†’ Technical              β†’  handle_technical
β†’ Billing                β†’  handle_billing
β†’ General / fallback     β†’  handle_general
β”‚
β–Ό
Handler Node
β†’ Generates a context-aware, role-appropriate response
β†’ Adds empathetic opening if sentiment is Negative
β”‚
β–Ό
Streamlit renders response
β†’ Shows category + sentiment badges
β†’ Appends to chat history

Why separate categorization and sentiment?

Treating them as two independent nodes gives the router a two-axis decision surface. A frustrated billing complaint and a frustrated technical crash look similar in raw text, but they need completely different handlers. Splitting the signals keeps the routing logic clean and extensible.

Why only escalate Negative + Technical?

Escalating every negative-sentiment query is a common mistake β€” it leaves frustrated billing or general users with a dead-end message instead of actual help. Only Technical issues with negative sentiment genuinely benefit from a human review. Everything else gets a real LLM response with an empathetic tone.


πŸ–₯ GUI Preview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  🎧 Customer Support Agent                      sidebar      β”‚
β”‚  ──────────────────────────────────────────────────────────  β”‚
β”‚  βš™οΈ Configuration                                            β”‚
β”‚  Groq API Key                                                β”‚
β”‚  [gsk_β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’]                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                        main area                             β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  You: My app keeps crashing on file upload           β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  πŸ”§ Technical          😐 Neutral                    β”‚   β”‚
β”‚  β”‚                                                      β”‚   β”‚
β”‚  β”‚  πŸ€– This sounds like a client-side upload error.    β”‚   β”‚
β”‚  β”‚     Here's what to try:                              β”‚   β”‚
β”‚  β”‚     1. Clear your browser cache and retry           β”‚   β”‚
β”‚  β”‚     2. Check the file size β€” the limit is 10MB      β”‚   β”‚
β”‚  β”‚     3. Try a different browser                      β”‚   β”‚
β”‚  β”‚     What file format are you uploading?             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                              β”‚
β”‚  [ Describe your issue…                          Send β–Ά ]   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

☁️ Deploy to Streamlit Cloud

Step 1: Push to GitHub

git init
git add .
git commit -m "Initial commit β€” SmartSupport Agent"
git remote add origin https://github.com/muqadasejaz/SmartSupport-Customer-Support-Agent
git push -u origin main

Step 2: Deploy on Streamlit Cloud

  1. Go to share.streamlit.io
  2. Click New app
  3. Select your repository and set Main file path to app.py
  4. Click Deploy

πŸ’‘ No secrets needed users supply their own Groq API key through the sidebar UI.


πŸ“‹ Requirements

streamlit>=1.45.0
langchain-core>=0.3.0
langchain-groq>=1.1.2
langgraph>=1.2.0
python-dotenv>=1.0.0

🀝 Contributing

Pull requests are welcome. For major changes, open an issue first to discuss what you'd like to change.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m "Add my feature"
  4. Push to the branch: git push origin feature/my-feature
  5. Open a Pull Request

πŸ‘€ Author

Muqadas Ejaz

BS Computer Science (AI Specialization)

AI/ML Engineer

Kaggle Grand Master

Data Science & Gen AI

πŸ“« Connect with me on LinkedIn

🌐 GitHub: github.com/muqadasejaz

πŸ“¬ Kaggle: Kaggle Profile


πŸ“„ License

This project is licensed under the MIT License

⭐ If you find this project useful, don’t forget to star the repository!

About

An AI-powered customer support agent that classifies user queries, analyzes sentiment, and provides accurate and context-aware responses for technical, billing, and general issues

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages