Skip to content

Repository files navigation

🎫 AI Support Ticket Triage System

Python FastAPI Streamlit Gemini Docker License

An LLM-powered support ticket triage system that automatically classifies customer support tickets, assigns priorities, detects sentiment, and drafts response messages.

The application combines FastAPI, Streamlit, Gemini 2.5 Flash, SQLite, and Docker to demonstrate an end-to-end AI workflow for automating customer support.

🌐 Live Demo

Dashboard: https://ticket-triage-app.onrender.com

API Docs: https://ai-ticket-triage-system.onrender.com/docs

Note

Hosted on Render's free tier. Services sleep after ~15 minutes of inactivity, so the first request may take 30–50 seconds.


✨ Features

  • 🎯 Automatic ticket classification
  • 🚨 Priority prediction (Urgent → Low)
  • 😊 Sentiment analysis
  • ✍️ AI-generated reply drafts
  • ✅ Structured output using Pydantic
  • ⚡ Parallel processing with ThreadPoolExecutor
  • 💾 SQLite persistence
  • 📊 Interactive dashboard with charts
  • 📤 CSV export
  • 📈 Built-in evaluation script
  • 🐳 Docker Compose deployment

🛠 Tech Stack

Layer Technology
Language Python 3.12
Backend FastAPI
Frontend Streamlit
LLM Gemini 2.5 Flash
Validation Pydantic
Database SQLite
Package Manager uv
Concurrency ThreadPoolExecutor
Containerization Docker & Docker Compose

🏗 Architecture

Customer Tickets
        │
        ▼
 Streamlit Dashboard
        │
 POST /analyze
        ▼
 FastAPI Backend
        │
 Gemini 2.5 Flash
        │
 Structured JSON
 (Pydantic)
        │
        ▼
 SQLite Database
        │
        ▼
 Priority Queue
 Charts • Filters • CSV

📂 Project Structure

.
├── api.py
├── app.py
├── database.py
├── eval.py
├── sample_tickets.txt
├── Dockerfile
├── docker-compose.yml
├── pyproject.toml
├── uv.lock
├── sample.env
├── screenshots/
└── README.md

🚀 Getting Started

Clone the repository

git clone https://github.com/21f3001527/ai-support-ticket-triage.git
cd ai-support-ticket-triage

Configure environment

cp sample.env .env

Add your Gemini API key.

GOOGLE_API_KEY=your_api_key

Get a free key:

https://aistudio.google.com


🐳 Run with Docker

docker compose up --build

Open:

Useful commands:

docker compose up -d
docker compose logs -f
docker compose down
docker compose down -v

💻 Run Locally

Install dependencies

uv sync

Backend

uv run fastapi dev api.py

Frontend

uv run streamlit run app.py

📊 Model Evaluation

Run:

uv run python eval.py

Example results:

Category Accuracy : 100%

Priority Accuracy : 75%

Sentiment Accuracy: 100%

The evaluation script tests the same /analyze endpoint used by the application.


📸 Screenshots

Dashboard

Dashboard

Analysis Results

Results

Saved Queue

Saved Queue

FastAPI Documentation

API Docs


⚠ Limitations

  • SQLite is intended for single-user demos.
  • No authentication or authorization.
  • Streamlit is a prototype UI.
  • Gemini free tier has daily request limits.
  • Ambiguous tickets may occasionally be misclassified.
  • Render's free tier does not provide persistent storage, so saved tickets reset after redeployment.

🔮 Future Improvements

  • Team assignment recommendations
  • SLA monitoring
  • PostgreSQL
  • Authentication & user roles
  • Email integration
  • RAG-powered replies
  • Async background processing

👨‍💻 Author

Rajeev Kumar

About

AI powered support ticket triage system classifies, prioritizes, and drafts replies for customer tickets using Gemini 2.5 Flash + FastAPI + Streamlit.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages