CoolFace
Apppublic

hyperlinken/triage

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
0likes
App README

๐ŸŽซ IT Helpdesk Triage & Incident Management โ€” OpenEnv

![OpenEnv](https://huggingface.co/openenv) ![Python 3.11](https://python.org) ![FastAPI](https://fastapi.tiangolo.com) ![License](LICENSE)

A production-grade OpenEnv RL training environment that simulates a real enterprise IT Service Desk. An AI agent receives incoming IT support tickets and must make triage decisions across five dimensions โ€” culminating in the management of a cascading database outage spanning seven simultaneous tickets.


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   OpenEnv Interface                      โ”‚
โ”‚  POST /reset  โ”€โ”€โ–บ  Observation (first ticket in queue)  โ”‚
โ”‚  POST /step   โ”€โ”€โ–บ  StepResult (obs + reward + done)     โ”‚
โ”‚  GET  /state  โ”€โ”€โ–บ  EnvironmentState (full snapshot)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   ITTriageEnvironment (core)   โ”‚
         โ”‚                                โ”‚
         โ”‚  Task Registry                 โ”‚
         โ”‚  โ”œโ”€ basic_triage    (easy)     โ”‚
         โ”‚  โ”œโ”€ priority_routing (medium)  โ”‚
         โ”‚  โ””โ”€ incident_escalation (hard) โ”‚
         โ”‚                                โ”‚
         โ”‚  Dense Reward Engine           โ”‚
         โ”‚  โ”œโ”€ Category score (exact)     โ”‚
         โ”‚  โ”œโ”€ Priority score (partial)   โ”‚
         โ”‚  โ”œโ”€ Routing score  (exact)     โ”‚
         โ”‚  โ”œโ”€ Incident score (bonus)     โ”‚
         โ”‚  โ”œโ”€ Escalation score           โ”‚
         โ”‚  โ””โ”€ Resolution score (NLP)     โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ—‚๏ธ Environment Description

Real-world motivation

Every enterprise runs an IT service desk. Triage quality โ€” getting the right ticket to the right team at the right priority โ€” directly affects business continuity, SLA compliance, and employee productivity. Training AI agents on realistic triage tasks produces models immediately applicable to production helpdesk automation.

Episode structure

Each episode processes a queue of IT support tickets. The agent sees one ticket per step and must return a TriageAction. The episode ends when the queue is exhausted or max_steps is reached.


๐Ÿ“ Action Space

python
class TriageAction(BaseModel):
    ticket_id:              str             # Ticket being triaged
    category:               TicketCategory  # hardware|software|network|security|access|database|performance|other
    priority:               TicketPriority  # P1|P2|P3|P4
    assigned_team:          AssignedTeam    # infrastructure|application_support|network_ops|security_ops|database_admin|helpdesk
    is_part_of_incident:    bool            # Incident linkage flag
    incident_id:            str | None      # e.g. "INC-MAJOR-01"
    resolution_steps:       list[str]|None  # Ordered remediation steps (P1 hard-task)
    escalate_to_management: bool            # Page senior management

๐Ÿ‘๏ธ Observation Space

python
class Observation(BaseModel):
    task_id:          str            # Active task
    current_ticket:   Ticket | None  # Ticket to triage (None = queue empty)
    queue_remaining:  int            # Tickets still waiting
    processed_count:  int            # Tickets processed this episode
    step_number:      int
    action_feedback:  str | None     # Correctness feedback on previous action
    cumulative_score: float          # Running mean reward (0.0-1.0)
    episode_done:     bool
    active_incidents: list[str]      # Incident IDs declared so far
    hints:            list[str]      # Task-level guidance

๐ŸŽฏ Tasks

Task IDDifficultyTicketsMax StepsKey Challenge
basic_triage๐ŸŸข Easy510Category + Priority + Routing
priority_routing๐ŸŸก Medium510Incident detection + Escalation
incident_escalation๐Ÿ”ด Hard715Cascading DB outage + Noise filtering + Remediation

Hard task: INC-MAJOR-01

The hard task simulates a PostgreSQL WAL-corruption event at 14:32. Five of seven tickets are incident symptoms (primary DB down, auth service failing, e-commerce checkout dead, analytics frozen, reporting job failed). Two tickets are unrelated noise (team lunch reminder, routine cert renewal). The agent must distinguish signal from noise, group the five linked tickets under INC-MAJOR-01, and provide specific remediation steps for each P1 ticket.


๐Ÿ’ฐ Reward Function

Rewards are dense โ€” computed per step (not just at episode end). All values are strictly bounded to [0.0, 1.0].

Weight profiles by difficulty

DimensionEasyMediumHard
Category classification0.400.280.20
Priority assignment0.350.220.18
Team routing0.250.180.14
Incident detectionโ€”0.180.20
Escalation decisionโ€”0.140.12
Resolution qualityโ€”โ€”0.16

Priority partial credit: adjacent level (e.g., P2 when P1 expected) scores 0.5 instead of 0.0, providing a learning gradient rather than a cliff.

Resolution scoring: Uses keyword-recall + step-level recall over domain-critical tokens, rewarding agents that cover the right remediation concepts even with paraphrased wording.

Penalties: Escalating a P4 cosmetic ticket to senior management incurs a -0.15 penalty.


๐Ÿš€ Quick Start

Local development

bash
# Clone and set up
git clone https://huggingface.co/spaces/<your-username>/it-triage-env
cd it-triage-env
pip install -r requirements.txt

# Start the server
uvicorn app:app --host 0.0.0.0 --port 7860 --reload

# In a separate terminal โ€” run the baseline agent
export OPENAI_API_KEY="sk-..."
export API_BASE_URL="http://localhost:7860"
export MODEL_NAME="gpt-4o"
python inference.py

Docker

bash
docker build -t it-triage-env .
docker run -p 7860:7860 \
  -e OPENAI_API_KEY="sk-..." \
  -e MODEL_NAME="gpt-4o" \
  it-triage-env

Interact manually with curl

bash
# Reset to the hard task
curl -X POST http://localhost:7860/reset \
  -H "Content-Type: application/json" \
  -d '{"task_id": "incident_escalation"}'

# Submit a triage action
curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{
    "ticket_id": "TKT-H001",
    "category": "database",
    "priority": "P1",
    "assigned_team": "database_admin",
    "is_part_of_incident": true,
    "incident_id": "INC-MAJOR-01",
    "escalate_to_management": true,
    "resolution_steps": [
      "Promote db-prod-replica-01 using pg_promote()",
      "Update all app DB_HOST configs to replica",
      "Preserve original primary for WAL forensics"
    ]
  }'

๐Ÿ“Š Baseline Scores

TaskModelScore
basic_triageGPT-4o0.87
priority_routingGPT-4o0.74
incident_escalationGPT-4o0.61
OverallGPT-4o0.74

๐Ÿ”Œ API Reference

MethodPathDescription
GET/Health check + task list
POST/resetReset episode {"task_id": "..."}
POST/stepSubmit TriageAction, receive StepResult
GET/stateFull EnvironmentState snapshot
GET/tasksAll tasks with metadata
GET/docsSwagger UI (interactive)
GET/redocReDoc UI

๐Ÿ“ฆ File Structure

it-triage-env/
โ”œโ”€โ”€ models.py         # Pydantic Action / Observation / State models
โ”œโ”€โ”€ environment.py    # Core environment logic + reward engine + graders
โ”œโ”€โ”€ app.py            # FastAPI server (OpenEnv REST interface)
โ”œโ”€โ”€ client.py         # Typed HTTP client
โ”œโ”€โ”€ inference.py      # Baseline LLM inference script
โ”œโ”€โ”€ openenv.yaml      # OpenEnv specification file
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ Dockerfile
โ””โ”€โ”€ README.md

โš™๏ธ Environment Variables

VariableRequiredDefaultDescription
API_BASE_URLinference onlyhttp://localhost:7860OpenEnv server URL
MODEL_NAMEinference onlygpt-4oLLM model identifier
OPENAI_API_KEYinference onlyโ€”OpenAI / compatible API key
HF_TOKENHF deployโ€”Hugging Face token
PORToptional7860Server port override

๐Ÿ… Citation

bibtex
@misc{it-helpdesk-triage-openenv,
  title  = {IT Helpdesk Triage & Incident Management โ€” OpenEnv},
  year   = {2024},
  url    = {https://huggingface.co/spaces/<username>/it-triage-env}
}