Spaces:
Sleeping
Sleeping
File size: 5,394 Bytes
e4accbb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | # Support Queue OpenEnv
A real-world OpenEnv benchmark for **SaaS support triage**.
Agents must read incoming support tickets, assign the right priority, route the case to the correct internal queue, choose the next action, and draft a safe first reply. The benchmark is designed to feel like an actual support operations workflow rather than a toy task.
## Why This Environment
Real support teams repeatedly solve the same high-value triage problems:
- decide how urgent a ticket is
- route it to the right team
- avoid unsafe or misleading replies
- handle ambiguous requests without over-escalating
This makes support triage a strong RL and agent-evaluation environment because success is measurable, partial credit is meaningful, and mistakes are easy to interpret.
## What The Agent Does
For each ticket, the agent must produce a `SupportQueueAction` with:
- `priority`: `P1 | P2 | P3 | P4`
- `queue`: `billing | security | technical | success | trust_safety`
- `disposition`: `respond | request_info | escalate | close`
- `summary`: short internal triage note
- `response`: first customer-facing reply
- `confidence`: float in `[0.0, 1.0]`
## Observation Space
Each `reset()` and `step()` returns a typed `SupportQueueObservation` containing:
| Field | Meaning |
| --- | --- |
| `task_id`, `task_title`, `difficulty` | Active benchmark task metadata |
| `instructions` | Task-specific operating guidance |
| `current_index`, `total_tickets` | Episode progress |
| `ticket` | Current customer ticket payload |
| `allowed_priorities`, `allowed_queues`, `allowed_dispositions` | Valid discrete actions |
| `scoring_weights` | Reward decomposition |
| `last_feedback` | Previous grader output |
| `reward`, `cumulative_reward`, `done` | Episode feedback |
| `info` | Extra metadata such as `episode_id` |
The ticket payload includes:
- `ticket_id`
- `subject`
- `body`
- `customer_tier`
- `product_area`
- `sla_hours`
- `recent_events`
## State Space
`state()` returns a typed `SupportQueueState` with:
- active task card
- current cursor
- cumulative and average reward
- processed ticket ids
- full action history
- full per-ticket grading history
## Tasks
The benchmark includes three deterministic tasks with increasing difficulty.
| Task ID | Difficulty | Tickets | Description |
| --- | --- | ---: | --- |
| `easy_inbox_cleanup` | Easy | 2 | Straightforward access and billing tickets |
| `medium_sla_defense` | Medium | 3 | Mix of phishing escalation, webhook failure, and billing ambiguity |
| `hard_exec_escalations` | Hard | 4 | Executive-pressure tickets spanning production, security, commercial, and retention workflows |
## Reward Design
Each processed ticket gets a reward in `[0.0, 1.0]`.
Reward components:
| Component | Weight |
| --- | ---: |
| Priority accuracy | `0.30` |
| Queue accuracy | `0.25` |
| Disposition accuracy | `0.20` |
| Summary keyword coverage | `0.15` |
| Response keyword coverage | `0.10` |
| Unsafe reply penalty | `-0.10` |
This gives useful partial progress signals. An agent can still earn reward for a good route or good reply even if one part of the triage decision is wrong.
## API Surface
The environment server exposes:
- `POST /reset`
- `POST /step`
- `GET /state`
- `GET /tasks`
- `GET /health`
- `GET /`
Example reset payload:
```json
{
"task_id": "easy_inbox_cleanup"
}
```
## Project Structure
```text
support_queue_env/
client.py
grading.py
models.py
tasks.py
server/
app.py
openenv_compat.py
support_queue_environment.py
Dockerfile
openenv.yaml
inference.py
```
## Running Locally
### Python
```bash
pip install -r requirements.txt
uvicorn support_queue_env.server.app:app --host 0.0.0.0 --port 8000
```
### Docker
```bash
docker build -t support-queue-openenv .
docker run --rm -p 8000:8000 support-queue-openenv
```
## Baseline Inference
The required inference script is [inference.py](./inference.py).
It:
- uses the OpenAI Python client
- reads `API_BASE_URL`, `MODEL_NAME`, `HF_TOKEN`, and optional `LOCAL_IMAGE_NAME`
- emits structured `[START]`, `[STEP]`, and `[END]` logs
- writes `inference_results.json`
Set environment variables:
```bash
API_BASE_URL=https://api.openai.com/v1
MODEL_NAME=gpt-4o-mini
HF_TOKEN=your_token
LOCAL_IMAGE_NAME=
```
Then run:
```bash
python inference.py
```
## Baseline Scores
Expected deterministic baseline scores from the bundled heuristic policy:
| Task | Score |
| --- | ---: |
| `easy_inbox_cleanup` | `1.00` |
| `medium_sla_defense` | `0.98` |
| `hard_exec_escalations` | `0.97` |
| Average | `0.98` |
## Hugging Face Space
This repository is configured for a **Docker Space**.
- front matter in `README.md` sets `sdk: docker`
- app serves on port `8000`
- `GET /health` and `POST /reset` support deployment checks
## OpenEnv Files
Core submission files:
- [openenv.yaml](./openenv.yaml)
- [inference.py](./inference.py)
- [Dockerfile](./Dockerfile)
- [support_queue_env/models.py](./support_queue_env/models.py)
- [support_queue_env/server/support_queue_environment.py](./support_queue_env/server/support_queue_environment.py)
## Submission Checklist
- typed action, observation, and state models included
- `reset()`, `step()`, and `state()` implemented
- three graded tasks included
- reward bounded to `[0.0, 1.0]`
- Dockerfile included
- Hugging Face Docker Space compatible
- root `inference.py` included
|