CoolFace
Apppublic

nikhilbabuy/openenv-ticket-triage

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

๐ŸŽซ OpenEnv โ€” IT Support Ticket Triage

A production-grade reinforcement learning environment where an AI agent learns to triage IT support tickets โ€” classifying priority, category, team assignment, and resolution steps.

![OpenEnv Compliant](https://openenv.dev) ![Java 17](https://openjdk.org/projects/jdk/17/) ![Spring Boot 3.2](https://spring.io/projects/spring-boot) ![License: MIT](LICENSE)


๐Ÿง  Environment Description

IT support ticket triage is a high-volume, expert-knowledge task performed daily by Level 1/2 support engineers. A triage agent must read a natural-language ticket, assess its urgency, classify its domain, assign it to the correct team, and propose a resolution โ€” all from the ticket text alone.

This environment simulates that workflow with 15 realistic support tickets across 6 categories (Hardware, Software, Network, Security, Access, Other), and 3 tasks of escalating difficulty.

Why this task?

  • โ€”Real-world: This exact task is done by humans in every company with an IT department
  • โ€”Text-grounded: Requires understanding natural language, not pattern matching
  • โ€”Multi-objective: Priority, category, team, resolution, and time estimate all interact
  • โ€”Gradable: Has clear ground truth with partial credit available

๐ŸŽฎ Tasks

TaskDescriptionMax StepsDifficultyBaseline Score
EASYClassify priority (LOW / MEDIUM / HIGH / CRITICAL)1โญ Easy0.62
MEDIUMPriority + Category + Team assignment1โญโญ Medium0.48
HARDFull triage: all fields + resolution suggestion + similar tickets + time estimate3โญโญโญ Hard0.34

๐Ÿ”ญ Observation Space

All observations are structured JSON. Ground truth is never included โ€” only the ticket text and task context.

json
{
  "ticket_id": "TKT-010",
  "ticket_title": "Phishing email received โ€” employee clicked link",
  "ticket_description": "An employee in the Finance department received a phishing email...",
  "user_name": "Ramesh Krishnan",
  "user_department": "Finance",
  "submitted_at": "2025-03-15T10:30:00",
  "task_type": "HARD",
  "task_description": "Perform complete triage: priority, category, team...",
  "step_count": 0,
  "max_steps": 3,
  "done": false,
  "previous_actions": [],
  "cumulative_reward": 0.0,
  "action_schema": {
    "required_fields": ["priority", "category", "assigned_team", "resolution_suggestion",
                        "similar_ticket_ids", "estimated_resolution_hours"],
    "optional_fields": ["reasoning"],
    "valid_priorities": ["LOW", "MEDIUM", "HIGH", "CRITICAL"],
    "valid_categories": ["HARDWARE", "SOFTWARE", "NETWORK", "SECURITY", "ACCESS", "OTHER"],
    "valid_teams": ["HELPDESK", "SYSADMIN", "NETWORK_OPS", "SECURITY_OPS", "DEVOPS", "MANAGEMENT"]
  },
  "similar_tickets": [
    {
      "ticket_id": "TKT-011",
      "title": "Suspicious login attempts on server",
      "resolution_summary": "Block source IP, enable fail2ban, rotate SSH keys.",
      "resolved_in_hours": 3
    }
  ]
}

โšก Action Space

Actions are structured JSON objects. Required fields vary by task type.

json
{
  "priority": "CRITICAL",
  "category": "SECURITY",
  "assigned_team": "SECURITY_OPS",
  "resolution_suggestion": "Reset user credentials immediately. Revoke all active sessions. Check audit logs for unauthorized access. Notify CISO. File security incident report.",
  "similar_ticket_ids": ["TKT-011", "TKT-012"],
  "estimated_resolution_hours": 2,
  "reasoning": "Phishing with credential entry is a CRITICAL SECURITY incident requiring immediate credential reset."
}
FieldRequired ForValid Values
priorityEASY, MEDIUM, HARDLOW, MEDIUM, HIGH, CRITICAL
categoryMEDIUM, HARDHARDWARE, SOFTWARE, NETWORK, SECURITY, ACCESS, OTHER
assigned_teamMEDIUM, HARDHELPDESK, SYSADMIN, NETWORK_OPS, SECURITY_OPS, DEVOPS, MANAGEMENT
resolution_suggestionHARDFree text string
similar_ticket_idsHARDArray of ticket IDs
estimated_resolution_hoursHARDInteger (1โ€“720)
reasoningNever requiredFree text (never penalized)

๐Ÿ† Reward Function

Rewards are dense and multi-dimensional โ€” not binary end-of-episode.

EASY Task

ComponentWeightScoring
Priority exact match1.01.0 โ†’ 0.5 โ†’ 0.2 โ†’ 0.0 for 0/1/2/3+ levels off

MEDIUM Task

ComponentWeightScoring
Priority0.40Partial credit (same as EASY)
Category0.35Binary: correct=0.35, wrong=0.0
Team0.25Binary: correct=0.25, wrong=0.0

HARD Task

ComponentWeightScoring
Priority0.25Partial credit
Category0.20Binary
Team0.15Binary
Resolution0.25Keyword overlap with ground truth hint
Similar Tickets0.10Fraction of correct references
Time Estimate0.05Full credit if in priority-expected range, partial for near-miss

Penalties:

  • โ€”Missing required field: -0.05 per field
  • โ€”Invalid enum value: -0.03 to -0.10

All rewards are clamped to [0.0, 1.0]. Reward signal is provided at every step, not just end-of-episode.


๐Ÿš€ Setup & Usage

Quick Start (Docker)

bash
# Build
docker build -t ticket-triage-env .

# Run (with OpenAI baseline)
docker run -p 7860:7860 \
  -e OPENAI_API_KEY=your_key_here \
  ticket-triage-env

# Run (without OpenAI โ€” mock baseline)
docker run -p 7860:7860 ticket-triage-env

Local Development

bash
# Requirements: Java 17+, Maven 3.8+

# Build
mvn clean package -DskipTests

# Run
java -jar target/ticket-triage-env-1.0.0.jar

# Run tests
mvn test

API Usage

bash
# 1. Reset environment (start episode)
curl -X POST http://localhost:7860/api/v1/reset \
  -H "Content-Type: application/json" \
  -d '{"task_type": "EASY", "seed": 42}'

# 2. Submit action
curl -X POST http://localhost:7860/api/v1/step \
  -H "Content-Type: application/json" \
  -d '{"priority": "HIGH", "reasoning": "Screen flickering with client deadline is HIGH"}'

# 3. Inspect ground truth
curl http://localhost:7860/api/v1/state

# 4. Run baseline
curl -X POST "http://localhost:7860/api/v1/baseline/run?taskTypes=EASY,MEDIUM,HARD"

Interactive API Docs

Visit: http://localhost:7860/swagger-ui


๐Ÿ“Š Baseline Scores

Baseline agent: gpt-4o-mini with temperature 0.2, seed 42.

TaskScoreNotes
EASY0.62LLM correctly identifies most priorities; struggles with MEDIUM vs HIGH edge cases
MEDIUM0.48Category and team assignment errors reduce score significantly
HARD0.34Resolution keyword coverage and time estimation are challenging
Average0.48Room for significant improvement via fine-tuning or RAG

To reproduce:

bash
export OPENAI_API_KEY=your_key
curl -X POST "http://localhost:7860/api/v1/baseline/run?taskTypes=EASY,MEDIUM,HARD"

๐Ÿ—‚ Ticket Dataset

15 real-world style tickets across 6 categories:

CategoryTicketsExample
HardwareTKT-001, TKT-002, TKT-003Laptop screen flickering before a presentation
SoftwareTKT-004, TKT-005, TKT-006SAP crash affecting payroll for 12 users
NetworkTKT-007, TKT-008, TKT-009Building-wide internet outage (200 employees)
SecurityTKT-010, TKT-011, TKT-012Phishing attack with credential compromise
AccessTKT-013, TKT-014, TKT-015New joiner with no system access

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   Spring Boot Application                        โ”‚
โ”‚  Port 7860                                                      โ”‚
โ”‚                                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  OpenEnvControllerโ”‚    โ”‚      EnvironmentService          โ”‚  โ”‚
โ”‚  โ”‚                  โ”‚โ”€โ”€โ”€โ–ถโ”‚  reset() / step() / state()      โ”‚  โ”‚
โ”‚  โ”‚  POST /reset     โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  โ”‚  POST /step      โ”‚               โ”‚                          โ”‚
โ”‚  โ”‚  GET  /state     โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  GET  /info      โ”‚    โ”‚        Grader Pipeline            โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚  EasyTaskGrader  (priority)       โ”‚  โ”‚
โ”‚                           โ”‚  MediumTaskGrader(+cat+team)     โ”‚  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚  HardTaskGrader  (+resolution)   โ”‚  โ”‚
โ”‚  โ”‚ BaselineControllerโ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  โ”‚  POST /baseline  โ”‚               โ”‚                          โ”‚
โ”‚  โ”‚       /run       โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚      TicketDataStore              โ”‚  โ”‚
โ”‚           โ”‚               โ”‚  15 realistic IT tickets         โ”‚  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  โ”‚  BaselineRunner  โ”‚                                          โ”‚
โ”‚  โ”‚  OpenAI API      โ”‚                                          โ”‚
โ”‚  โ”‚  step/reset loop โ”‚                                          โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงช Tests

bash
mvn test
  • โ€”OpenEnvIntegrationTest โ€” Full episode lifecycle for all 3 tasks (50+ assertions)
  • โ€”GraderUnitTest โ€” Isolated reward function tests for all graders

๐Ÿ“„ OpenEnv Spec Compliance

RequirementImplementation
Typed Observation modelObservation.java (Jackson/Spring)
Typed Action modelAction.java (with validation)
Typed Reward modelReward.java (with component breakdown)
reset() โ†’ initial observationPOST /api/v1/reset
step(action) โ†’ obs, reward, done, infoPOST /api/v1/step
state() โ†’ current stateGET /api/v1/state
openenv.yaml metadatasrc/main/resources/openenv.yaml
Minimum 3 tasksEASY, MEDIUM, HARD
Graders (0.0โ€“1.0)EasyTaskGrader, MediumTaskGrader, HardTaskGrader
Dense reward functionPer-step, multi-component, partial credit
Baseline inference scriptBaselineRunner.java (OpenAI API)
Containerized (Dockerfile)Multi-stage Docker build
HF Space tagged openenvsdk: docker, tags in README front matter

๐Ÿ“œ License

MIT License โ€” see LICENSE