CoolFace
Apppublic

UtkarshTheAIMaster/ai-ticket-routing-pro

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

๐ŸŽซ AI Ticket Routing Pro (OpenEnv Environment)

An advanced OpenEnv-compatible Reinforcement Learning environment for simulating real-world customer support systems.

This project challenges an AI agent to intelligently:

  • โ€”Classify support tickets
  • โ€”Assign appropriate priority
  • โ€”Decide escalation
  • โ€”Generate professional responses

๐Ÿš€ Why This Project?

Customer support automation is a real-world, high-impact problem used by:

  • โ€”SaaS companies
  • โ€”E-commerce platforms
  • โ€”Enterprise support systems

This environment replicates real-world complexity including:

  • โ€”Multi-step decision making
  • โ€”Ambiguous user intent
  • โ€”Escalation handling
  • โ€”Human-like response generation

๐Ÿง  Core Features

๐Ÿ”น OpenEnv Compatible

Fully follows OpenEnv standards:

  • โ€”/reset, /step, /state, /tasks, /grader, /baseline

๐Ÿ”น Multi-Decision Action Space

The agent must output:

FieldDescription
categoryType of issue (billing, technical, complaint, etc.)
priorityUrgency level (low โ†’ critical)
responseProfessional reply (80+ chars recommended)
escalateWhether to escalate to human support

๐Ÿ”น Rich Observation Space

The agent receives:

  • โ€”Ticket message
  • โ€”Conversation history
  • โ€”Difficulty level (easy/medium/hard)
  • โ€”Feedback from previous attempt
  • โ€”Reward signals
  • โ€”Hints after failures

๐Ÿ”น Realistic Task Design

  • โ€”15 curated tasks
  • โ€”Balanced across difficulty:
  • โ€”Easy (5)
  • โ€”Medium (5)
  • โ€”Hard (5)

Includes:

  • โ€”Billing issues
  • โ€”Technical failures
  • โ€”Fraud detection
  • โ€”Enterprise outages
  • โ€”Legal threats

๐Ÿ”น Advanced Reward System (0.0 โ†’ 1.0)

ComponentWeight
Category accuracy0.30
Priority accuracy0.30
Escalation decision0.20
Response quality0.20

โœ” Partial credit for near-correct answers โœ” Bonus for strong decisions โœ” Feedback-driven learning


๐Ÿ”น ๐ŸŒ Interactive Web Dashboard

A modern UI dashboard allows real-time interaction:

  • โ€”View tickets
  • โ€”Submit agent actions
  • โ€”See rewards + feedback instantly

๐Ÿ‘‰ Open in browser:

http://localhost:7860

๐Ÿ—๏ธ Project Structure

ai-ticket-routing-pro/
โ”‚
โ”œโ”€โ”€ server/
โ”‚   โ”œโ”€โ”€ app.py              # FastAPI server + endpoints + UI serving
โ”‚   โ””โ”€โ”€ environment.py      # Core RL logic + tasks + reward system
โ”‚
โ”œโ”€โ”€ models.py               # Pydantic schemas
โ”œโ”€โ”€ client.py               # Python RL client
โ”‚
โ”œโ”€โ”€ frontend/               # Web dashboard
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ style.css
โ”‚   โ””โ”€โ”€ script.js
โ”‚
โ”œโ”€โ”€ baseline/
โ”‚   โ””โ”€โ”€ inference.py        # LLM + rule-based agent
โ”‚
โ”œโ”€โ”€ openenv.yaml            # OpenEnv metadata
โ”œโ”€โ”€ Dockerfile              # Deployment
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

โš™๏ธ Setup & Run

1๏ธโƒฃ Install dependencies

pip install -r requirements.txt

2๏ธโƒฃ Run server

uvicorn server.app:app --host 0.0.0.0 --port 7860

3๏ธโƒฃ Open UI

http://localhost:7860

๐Ÿงช API Usage

๐Ÿ”น Reset Environment

POST /reset

๐Ÿ”น Take Action

POST /step

Example:

json
{
  "category": "billing",
  "priority": "medium",
  "response": "We sincerely apologize for the inconvenience. Your refund will be processed within 3-5 business days.",
  "escalate": false
}

๐Ÿค– Baseline Agent

Includes:

  • โ€”Rule-based agent
  • โ€”Optional LLM (Groq / OpenAI)

Run:

python baseline/inference.py

๐Ÿ“Š Learning Objectives

This environment helps train and evaluate agents on:

  • โ€”Decision making under uncertainty
  • โ€”Priority reasoning
  • โ€”Customer empathy
  • โ€”Escalation judgment
  • โ€”Real-world workflow simulation

๐Ÿณ Deployment (HuggingFace Spaces)

  • โ€”SDK: Docker
  • โ€”Port: 7860
  • โ€”Auto-deploy supported

๐Ÿ‘ค Author

Utkarsh Meta PyTorch OpenEnv Hackathon x Scaler School of Technology


๐Ÿ’ก Final Note

This project goes beyond a simple classification task โ€” it simulates a real-world AI support system with structured decision-making and human-like interaction.