Spaces:
Sleeping
Sleeping
Professional README in OpenEnv style
Browse files
README.md
CHANGED
|
@@ -11,22 +11,120 @@ pinned: false
|
|
| 11 |
|
| 12 |
# Customer Support Ticket Resolution Environment
|
| 13 |
|
| 14 |
-
A real-world OpenEnv environment where an AI agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
## Tasks
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
-
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## Action Space
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Observation Space
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Baseline Scores
|
| 30 |
-
|
| 31 |
-
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Customer Support Ticket Resolution Environment
|
| 13 |
|
| 14 |
+
A real-world [OpenEnv](https://github.com/meta-pytorch/OpenEnv) environment where an AI agent acts as a customer support executive, triaging and resolving incoming tickets.
|
| 15 |
+
|
| 16 |
+
## Overview
|
| 17 |
+
|
| 18 |
+
Customer support triage is one of the most common real-world tasks for AI agents. Every company handles thousands of tickets daily. Getting the classification wrong routes the ticket to the wrong team. Choosing the wrong action has direct business impact. This environment trains agents to handle exactly this challenge.
|
| 19 |
+
|
| 20 |
+
## Quick Start
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
from support_ticket_env import SupportAction, SupportTicketEnv
|
| 24 |
+
|
| 25 |
+
with SupportTicketEnv(base_url="https://algocore-support-ticket-env.hf.space").sync() as env:
|
| 26 |
+
# Task 1 - Classify a ticket
|
| 27 |
+
result = env.reset(task_id=1, seed=42)
|
| 28 |
+
print(result.observation.ticket_text)
|
| 29 |
+
|
| 30 |
+
result = env.step(SupportAction(action_type="classify", category="billing"))
|
| 31 |
+
print(result.reward) # 1.0 if correct
|
| 32 |
+
```
|
| 33 |
|
| 34 |
## Tasks
|
| 35 |
+
|
| 36 |
+
| Task | Difficulty | Description | Score Range |
|
| 37 |
+
|------|-----------|-------------|-------------|
|
| 38 |
+
| Task 1 | Easy | Classify ticket into correct category | 0.0 - 1.0 |
|
| 39 |
+
| Task 2 | Medium | Classify then choose correct action | 0.0 - 1.0 |
|
| 40 |
+
| Task 3 | Hard | Resolve a full queue of 3 tickets | 0.0 - 1.0 |
|
| 41 |
|
| 42 |
## Action Space
|
| 43 |
+
|
| 44 |
+
Actions are `SupportAction` Pydantic objects:
|
| 45 |
+
|
| 46 |
+
| Field | Type | Required | Values |
|
| 47 |
+
|-------|------|----------|--------|
|
| 48 |
+
| `action_type` | str | always | `classify` / `reply` / `escalate` / `close` |
|
| 49 |
+
| `category` | str | for classify | `billing` / `technical` / `account` / `general` / `refund` |
|
| 50 |
+
| `reply_text` | str | for reply | free text |
|
| 51 |
+
| `reason` | str | optional | free text |
|
| 52 |
|
| 53 |
## Observation Space
|
| 54 |
+
|
| 55 |
+
| Field | Type | Description |
|
| 56 |
+
|-------|------|-------------|
|
| 57 |
+
| `ticket_id` | str | Unique ticket ID |
|
| 58 |
+
| `ticket_text` | str | Customer message |
|
| 59 |
+
| `task_id` | int | 1, 2, or 3 |
|
| 60 |
+
| `current_category` | str | Category assigned so far |
|
| 61 |
+
| `resolved` | bool | Whether ticket is resolved |
|
| 62 |
+
| `step_count` | int | Steps taken this episode |
|
| 63 |
+
| `feedback` | str | Human-readable feedback |
|
| 64 |
+
| `reward` | float | Reward signal |
|
| 65 |
+
| `done` | bool | Episode finished |
|
| 66 |
+
|
| 67 |
+
## Reward Function
|
| 68 |
+
|
| 69 |
+
Rewards provide partial progress signals throughout the trajectory:
|
| 70 |
+
|
| 71 |
+
- **Task 1:** 1.0 for correct category, 0.0 for wrong
|
| 72 |
+
- **Task 2:** 1.0 correct action, 0.5 defensible alternative, 0.3 classification only
|
| 73 |
+
- **Task 3:** 0.20 classification + 0.40 action + 0.25 reply quality + 0.15 efficiency bonus
|
| 74 |
+
- **Penalty:** -0.05 per step over 10 (loop deterrent)
|
| 75 |
+
|
| 76 |
+
## Project Structure
|
| 77 |
+
|
| 78 |
+
```
|
| 79 |
+
support_ticket_env/
|
| 80 |
+
βββ __init__.py # Package exports
|
| 81 |
+
βββ models.py # SupportAction, SupportObservation, SupportState
|
| 82 |
+
βββ tickets.py # Ticket dataset with ground-truth labels
|
| 83 |
+
βββ graders.py # Reward/grader functions for all 3 tasks
|
| 84 |
+
βββ client.py # EnvClient subclass
|
| 85 |
+
βββ baseline.py # Baseline inference script
|
| 86 |
+
βββ openenv.yaml # Environment metadata
|
| 87 |
+
βββ Dockerfile # Container definition
|
| 88 |
+
βββ server/
|
| 89 |
+
βββ app.py # FastAPI entry point
|
| 90 |
+
βββ support_environment.py # Environment logic
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
## Setup
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
# Install dependencies
|
| 97 |
+
pip install openenv-core fastapi uvicorn pydantic gradio openai
|
| 98 |
+
|
| 99 |
+
# Run locally
|
| 100 |
+
cd support_ticket_env
|
| 101 |
+
uvicorn server.app:app --host 0.0.0.0 --port 7860
|
| 102 |
+
|
| 103 |
+
# Docker
|
| 104 |
+
docker build -t support-ticket-env .
|
| 105 |
+
docker run -p 7860:7860 support-ticket-env
|
| 106 |
+
|
| 107 |
+
# Run tests
|
| 108 |
+
python run_tests.py
|
| 109 |
+
```
|
| 110 |
|
| 111 |
## Baseline Scores
|
| 112 |
+
|
| 113 |
+
Measured with `gpt-4o-mini`, seeds `[42, 7, 123]`:
|
| 114 |
+
|
| 115 |
+
| Task | Avg Score |
|
| 116 |
+
|------|-----------|
|
| 117 |
+
| Task 1 - Classification | 0.87 |
|
| 118 |
+
| Task 2 - Action Selection | 0.71 |
|
| 119 |
+
| Task 3 - Full Resolution | 0.58 |
|
| 120 |
+
| **Overall** | **0.72** |
|
| 121 |
+
|
| 122 |
+
## Links
|
| 123 |
+
|
| 124 |
+
- **HuggingFace Space:** https://huggingface.co/spaces/AlgoCore/support-ticket-env
|
| 125 |
+
- **GitHub:** https://github.com/TryingHardToBeDeveloper/support-ticket-env
|
| 126 |
+
- **OpenEnv Docs:** https://meta-pytorch.org/OpenEnv/
|
| 127 |
+
|
| 128 |
+
## License
|
| 129 |
+
|
| 130 |
+
MIT
|