CoolFace
Apppublic

abi2209mj/Ticker_RL_Environment

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

๐ŸŽซ Customer Support Ticket Resolution โ€” RL Environment

A real-world reinforcement learning environment where an agent resolves customer support tickets through multi-turn dialogue.

Built for the OpenEnv Hackathon โ€” fully OpenEnv-compliant.


๐ŸŒŸ Key Features (Beyond Baseline)

1. ๐Ÿง  Dynamic LLM Ticket Generator

Every reset() calls Claude to generate a fresh, realistic ticket โ€” different industries, emotions, and complexity. No two episodes are the same.

2. ๐Ÿ˜ค Sentiment Escalation Engine

Customer sentiment degrades dynamically in response to bad agent behavior:

  • โ€”Repeated questions โ†’ sentiment worsens
  • โ€”Wrong solution โ†’ sentiment worsens
  • โ€”Correct resolution โ†’ sentiment improves
  • โ€”Sentiment state: happy โ†’ neutral โ†’ frustrated โ†’ angry โ†’ demands_supervisor

3. โฑ๏ธ SLA Step Budget Penalty

Each task has a step budget (Easy: 3, Medium: 5, Hard: 8). Steps over budget incur a -0.05 per-step penalty, rewarding efficiency.

4. ๐Ÿ“Š Live Gradio Dashboard

Deployed on HuggingFace Spaces โ€” interactive browser UI with:

  • โ€”Live conversation replay
  • โ€”Real-time reward breakdown table
  • โ€”Cumulative reward chart
  • โ€”Sentiment timeline chart
  • โ€”Session leaderboard

๐Ÿ“ Observation Space

FieldTypeDescription
ticketstringCustomer's support message
historylistFull conversation turns
customer_sentimentenumhappy/neutral/frustrated/angry/demands_supervisor
issue_categorystringAuto-detected category
sla_steps_remainingintSteps before SLA breach
turn_numberintCurrent turn count
repeated_questionsintDuplicate clarifications count
is_classifiedboolWhether ticket was classified
is_resolvedboolWhether ticket was resolved

โšก Action Space

FieldTypeDescription
action_typeenumclassify / ask_clarification / give_solution / escalate / close_ticket
messagestringResponse to customer
classificationenumbilling / technical / account / shipping / general

๐ŸŽฏ Reward Function

EventReward
Correct classification+0.30
Relevant clarification+0.20
Resolving issue+0.50
Speed bonus (fast resolution)+0.10
Wrong/irrelevant response-0.10 to -0.20
Sentiment escalation-0.10 to -0.30
Repeated question-0.30
SLA over-budget per step-0.05

๐Ÿ“ฆ Tasks

TaskDifficultyMax StepsObjective
easy_classifyEasy3Classify the ticket correctly
medium_clarify_resolveMedium5Ask 1 clarification, then resolve
hard_multi_turnHard8Multi-turn resolution without supervisor escalation

๐Ÿš€ Setup & Usage

bash
# Install
pip install -r requirements.txt

# Set API keys
export ANTHROPIC_API_KEY=your_key   # for LLM ticket generation
export HF_TOKEN=your_hf_token       # for baseline inference

# Run the dashboard
python ui/dashboard.py

# Run baseline inference
python scripts/baseline_inference.py

๐Ÿณ Docker

bash
docker build -t support-rl-env .
docker run -p 7860:7860 -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY support-rl-env

๐Ÿค— HuggingFace Spaces

Deploy by pushing to a HuggingFace Space with gradio SDK. Tag the space with openenv for discoverability.


๐Ÿ“Š Baseline Performance

TaskScoreModel
easy_classify0.74Rule-based baseline
mediumclarifyresolve0.58Rule-based baseline
hardmultiturn0.41Rule-based baseline
Average0.58