support-env / README.md
dtharuneswar's picture
Upgraded Env-v2
6c7a6ef verified
|
Raw History Blame Contribute Delete
9.41 kB
metadata
title: Enterprise Support Ticket Triage
emoji: 🎫
colorFrom: indigo
colorTo: purple
sdk: docker
pinned: false
license: mit
short_description: OpenEnv RL environment for enterprise helpdesk ticket triage
tags:
  - openenv
  - reinforcement-learning
  - enterprise-support
  - ticket-triage

Enterprise Support Ticket Triage β€” OpenEnv RL Environment

A production-grade reinforcement learning environment for training and evaluating AI agents on enterprise helpdesk workflows. Each episode presents one inbound support ticket that the agent must triage through a multi-step decision process.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        OpenEnv HTTP Server                         β”‚
β”‚                     (FastAPI on port 7860)                          β”‚
β”‚                                                                     β”‚
β”‚  POST /reset ──► EnterpriseSupportTicketTriageEnv.reset()           β”‚
β”‚  POST /step  ──► EnterpriseSupportTicketTriageEnv.step()            β”‚
β”‚  GET  /state ──► EnterpriseSupportTicketTriageEnv.state()           β”‚
β”‚  GET  /schema ─► Action/Observation Pydantic schemas                β”‚
β”‚  WS   /ws    ──► Persistent WebSocket session                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Environment Core   β”‚
    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
    β”‚  β”‚   9 Tasks      β”‚ β”‚  easy_billing_duplicate_charge
    β”‚  β”‚   (3 easy,     β”‚ β”‚  easy_password_reset_request
    β”‚  β”‚    3 medium,   β”‚ β”‚  easy_feature_request
    β”‚  β”‚    3 hard)     β”‚ β”‚  medium_security_suspicious_login
    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  medium_data_export_compliance
    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  medium_api_rate_limiting
    β”‚  β”‚ Shaped Rewards β”‚ β”‚  hard_production_outage
    β”‚  β”‚ + Anti-Gaming  β”‚ β”‚  hard_data_breach_investigation
    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  hard_multi_service_cascade_failure
    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
    β”‚  β”‚  Deterministic β”‚ β”‚
    β”‚  β”‚  Graders (per  β”‚ β”‚
    β”‚  β”‚  task)         β”‚ β”‚
    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
    β”‚  β”‚  Customer      β”‚ β”‚
    β”‚  β”‚  Simulation    β”‚ β”‚
    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What Makes This Environment Interesting

Feature Description
Multi-step triage workflow Agents must classify β†’ route β†’ investigate β†’ resolve in order
9 diverse tasks Billing, security, compliance (GDPR), API issues, data breaches, cascading failures
Customer simulation After request_info, the customer "responds" with diagnostic details
Anti-gaming grading Keyword stuffing is penalized; substance and workflow order are rewarded
Stochastic variants Each task can be randomized with different customer tones, entity values, and IP addresses
SLA pressure Hard tasks include SLA deadlines that create urgency
Safety checks Agents are penalized for unsafe behavior (e.g., suggesting users share passwords)

Action Space

{
  "action_type": "classify | reply | escalate | close | request_info | update_priority | assign_queue",
  "message": "Free text response or request",
  "queue": "Target queue name (for assign_queue)",
  "priority": "low | normal | high | urgent (for update_priority)",
  "tags": ["structured", "hints"],
  "resolution_code": "Optional close reason"
}

Observation Space

{
  "task_id": "hard_production_outage",
  "difficulty": "hard",
  "ticket_id": "TKT-0007-HARD",
  "subject": "Production API returning 503 after deployment, checkout unavailable",
  "customer_message": "Our production checkout API started returning 503...",
  "extracted_entities": {
    "impact": "checkout_down",
    "environment": "production",
    "error_code": "503",
    "deployment_id": "deploy-2025-04-10-1847"
  },
  "customer_metadata": {
    "account_tier": "enterprise",
    "org_size": "1000+",
    "sla_tier": "premium"
  },
  "attachment_refs": ["deploy_log_2025-04-10.txt", "error_trace_503.json"],
  "sla_deadline_minutes": 30,
  "current_status": "open",
  "current_queue": "triage-intake",
  "current_priority": "normal",
  "conversation_history": [
    {"speaker": "customer", "message": "Our production checkout API...", "timestamp": "2025-04-10T14:47:00Z"}
  ],
  "required_missing_fields": ["incident_start_time", "affected_service", "request_id", "error_logs"],
  "step_count": 0,
  "max_steps_remaining": 8
}

Tasks (9 total, 3 difficulty levels)

ID Difficulty Category Key Challenge
easy_billing_duplicate_charge Easy Billing Classify, acknowledge, close properly
easy_password_reset_request Easy Account Verify identity before resetting
easy_feature_request Easy General Acknowledge without over-promising
medium_security_suspicious_login Medium Security Request verification, advise reset, don't close
medium_data_export_compliance Medium Compliance GDPR handling, verify authority, set timeline
medium_api_rate_limiting Medium Technical Diagnose 429 errors, gather API usage data
hard_production_outage Hard Incident Urgent priority, diagnostics, must escalate
hard_data_breach_investigation Hard Security Contain breach, revoke tokens, must escalate
hard_multi_service_cascade_failure Hard Incident Multi-service triage, dependency analysis, escalate

Reward Design

Shaped rewards are awarded per-step for meaningful progress:

  • +0.22 Correct classification
  • +0.18 Correct queue assignment
  • +0.16 Correct priority (harder tasks get more)
  • +0.10 Per required diagnostic field requested
  • +0.40 Correct closure (easy tasks only)
  • +0.20–0.40 Correct escalation (hard tasks)
  • +0.10 Workflow order bonus (following expected sequence)

Penalties:

  • -0.25 Invalid action schema
  • -0.35 Premature/unsafe closure
  • -0.18 Unnecessary escalation
  • -0.05nΒ² Repeated identical actions (quadratic)
  • -0.10 Discouraged content
  • -0.35 Unsafe behavior (suggesting password sharing, etc.)
  • -0.08 Keyword stuffing (anti-gaming)

Setup

git clone <repo-url>
cd Enterprise-Support-Ticket-Triage
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Usage

Start the API Server

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

API Examples

Health check:

curl http://localhost:7860/

Reset environment (start new episode):

curl -X POST http://localhost:7860/reset \
  -H "Content-Type: application/json" \
  -d '{"task_id": "easy_billing_duplicate_charge"}'

Take a step:

curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
      "action_type": "classify",
      "message": "This is a billing issue for a duplicate charge.",
      "tags": ["billing", "duplicate_charge"]
    }
  }'

Get schemas:

curl http://localhost:7860/schema

Run Baseline Inference (Heuristic)

python inference.py --disable-api

Run with LLM (Optional)

export HF_TOKEN="<your_hf_token>"
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="Qwen/Qwen2.5-7B-Instruct"
python inference.py

Run Specific Tasks

python inference.py --disable-api --tasks hard_production_outage hard_data_breach_investigation

Docker

# Build
docker build -t enterprise-support-ticket-triage .

# Run server
docker run --rm -p 7860:7860 enterprise-support-ticket-triage

# Health check
curl http://localhost:7860/

# Run inference inside container
docker run --rm enterprise-support-ticket-triage python inference.py --disable-api

Baseline Scores

The deterministic heuristic baseline is intentionally imperfect to demonstrate grader discriminating power:

Task Baseline Score Why Not Perfect
Easy tasks ~0.75-0.85 Skips some verification steps
Medium tasks ~0.65-0.80 Misses diagnostic fields, wrong priority
Hard tasks ~0.60-0.75 Incomplete diagnostics coverage
Average ~0.70 Room for RL improvement

A trained RL agent should significantly outperform this baseline.

Resources / Runtime

  • 2 vCPU, 8 GB RAM
  • No GPU required
  • Inference completes in under 2 minutes
  • Docker-compatible with HF Spaces