Skip to content

yousafzeb-byte/AI-Ticket-Triage-Workflow-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Ticket Assistant β€” FastAPI | Python | Docker | CI/CD

FastAPI Python Uvicorn Pydantic OpenAI pytest Docker Render CI

Recruiter Snapshot

  • Built a production-style full-stack triage system with FastAPI, a responsive vanilla JS dashboard, and deterministic classification logic.
  • Delivered a plain-English input experience so non-technical users can submit tickets without JSON or structured syntax.
  • Implemented explainable ticket decisions with priority scoring (P0-P3), team routing, rationale output, and one-line summaries.
  • Added optional OpenAI-powered summarization with a robust fallback path to keep results available even without API access.
  • Shipped deployment-ready engineering standards: automated CI checks, Docker packaging, Render configuration, and tested API workflows.

Architecture At A Glance

  • FastAPI app serves both the REST API and the static frontend from a single process.
  • Keyword-matching engine in workflow.py drives priority and team inference β€” deterministic and testable.
  • OptionalLLMSummarizer wraps OpenAI with graceful fallback so the app never breaks without a key.
  • Pydantic models enforce request validation at the API boundary.
  • Frontend communicates via POST /api/triage and requires no build step β€” plain HTML, CSS, JS.

Visual Showcase

AI Ticket Assistant UI

🎯 What It Does

Paste support tickets in plain English, click Run, and get back:

  • Priority level β€” P0 (critical) to P3 (low)
  • Assigned team β€” Security, Billing, Auth, Platform, or Support
  • Reason β€” why that priority and team were chosen
  • Summary β€” one-line plain English description of the issue

πŸ“‹ Features

🧠 AI Triage Engine

  • Keyword-based priority and routing β€” no model required
  • Optional OpenAI integration for richer summaries (gpt-4.1-mini)
  • Rule-based fallback summary when AI is unavailable
  • Handles multiple tickets in a single run

πŸ–₯️ Frontend Dashboard

  • Plain-English input β€” type tickets naturally, no JSON or brackets
  • Stats bar: total tickets, critical count, top team, last run time
  • Copy and download results buttons
  • Detailed view panel for full JSON output
  • Mobile-friendly responsive layout

πŸ”Œ REST API

  • POST /api/triage β€” classify and route a batch of tickets
  • GET /api/tickets/sample β€” load example tickets
  • GET /api/health β€” health check endpoint
  • Auto-generated interactive docs at /docs

πŸš€ DevOps & Quality

  • GitHub Actions CI β€” runs on every push to main
  • Dockerfile for containerised deployment
  • Docker Compose for local multi-service setup
  • render.yaml for one-click Render deployment
  • 4 automated tests covering triage logic and API endpoints

πŸš€ Quick Start

1. Install Dependencies

pip install -r requirements.txt

2. (Optional) Enable AI Summaries

copy .env.example .env
# Add your OPENAI_API_KEY to .env

3. Run the App

uvicorn src.api:app --reload

Open http://127.0.0.1:8000 in your browser.

πŸ”Œ API Endpoints

Method Endpoint Description
POST /api/triage Classify and route a batch of tickets
GET /api/tickets/sample Returns sample tickets
GET /api/health Health check
GET /docs Interactive Swagger UI

πŸ› οΈ Technologies Used

  • FastAPI 0.115 β€” REST API framework
  • Uvicorn β€” ASGI server
  • Pydantic β€” Request validation and serialisation
  • OpenAI SDK β€” Optional AI summarisation (gpt-4.1-mini)
  • Python-dotenv β€” Environment variable management
  • pytest + httpx β€” API and unit testing
  • Docker + Docker Compose β€” Containerisation
  • Render β€” Cloud deployment target
  • GitHub Actions β€” CI pipeline

πŸ“ Project Structure

AI-Ticket-Triage_Assistant/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml                # GitHub Actions CI pipeline
β”œβ”€β”€ data/
β”‚   └── tickets.json              # Sample ticket data
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api.py                    # FastAPI app, routes, request models
β”‚   β”œβ”€β”€ models.py                 # Ticket and TriageResult data models
β”‚   β”œβ”€β”€ workflow.py               # Priority + team inference engine
β”‚   └── main.py                   # CLI entry point
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ conftest.py               # Pytest path setup
β”‚   └── test_api.py               # API and triage logic tests
β”œβ”€β”€ web/
β”‚   β”œβ”€β”€ index.html                # Frontend dashboard
β”‚   β”œβ”€β”€ styles.css                # Responsive stylesheet
β”‚   └── app.js                    # Frontend logic
β”œβ”€β”€ Dockerfile                    # Container build definition
β”œβ”€β”€ docker-compose.yml            # Local multi-service config
β”œβ”€β”€ render.yaml                   # Render deployment config
β”œβ”€β”€ requirements.txt              # Python dependencies
└── .env.example                  # Environment variable template

βœ… Project Checklist

Triage Engine

  • βœ… Keyword-based priority scoring (P0–P3)
  • βœ… Team routing across 5 domains
  • βœ… Rule-based summary fallback
  • βœ… Optional OpenAI integration

Frontend

  • βœ… Plain-English ticket input (no JSON)
  • βœ… Stats dashboard (total, critical, top team, last run)
  • βœ… Copy and download results
  • βœ… Responsive mobile layout

API

  • βœ… Batch triage endpoint with Pydantic validation
  • βœ… Sample data endpoint
  • βœ… Health check endpoint
  • βœ… Auto-generated Swagger docs

DevOps & CI/CD

  • βœ… GitHub Actions CI β€” passing on all pushes
  • βœ… Dockerfile for containerised builds
  • βœ… Docker Compose for local development
  • βœ… Render deployment config (render.yaml)
  • βœ… 4 automated tests

πŸš€ Deployment

Docker

docker build -t ai-ticket-assistant .
docker run -p 8000:8000 --env-file .env ai-ticket-assistant

Docker Compose

docker-compose up --build

Render

Connect this repo to Render. It will detect render.yaml automatically and deploy using Docker. Set OPENAI_API_KEY in Render's environment variables (optional).

πŸ”’ Security Notes

  • API keys are never committed β€” use .env locally and Render environment variables in production.
  • Input is validated with Pydantic at the API boundary before processing.
  • CORS is configured to allow frontend–backend communication.

πŸ‘¨β€πŸ’» Author

Yousaf Zeb Full-Stack Software Engineer | Python Β· FastAPI Β· React Β· CI/CD

About

Full-stack AI triage app with FastAPI backend, plain-English UI, keyword classification, OpenAI integration, and CI/CD deployment.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors