File size: 2,210 Bytes
397249e
 
d26a747
397249e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Customer Support AI API
emoji: ๐Ÿค–
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
---

# ๐ŸŽฎ AI Customer Support Simulator

A strict, deterministic RL-style environment for training and evaluating AI agents on customer support tasks.

## ๐Ÿ—๏ธ Architecture

```
โ”œโ”€โ”€ models.py              # Core data models (Episode, StepResult, Task)
โ”œโ”€โ”€ environment.py         # Strict step enforcement + fail logic
โ”œโ”€โ”€ inference.py           # Rule-based agent + CLI runner
โ”œโ”€โ”€ app.py                 # Gradio UI
โ”œโ”€โ”€ tasks/
โ”‚   โ”œโ”€โ”€ easy_task.py       # Delayed delivery complaint
โ”‚   โ”œโ”€โ”€ medium_task.py     # Billing double-charge
โ”‚   โ””โ”€โ”€ hard_task.py       # Angry VIP threatening legal action
โ”œโ”€โ”€ graders/
โ”‚   โ””โ”€โ”€ base_grader.py     # BaseGrader + HardTaskGrader
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_cases.py      # 4 mandatory test scenarios
```

## ๐ŸŽฏ Step Flow

**Empathy โ†’ Collect Info โ†’ Investigate โ†’ Resolution**

Each step must be completed correctly before advancing.

## ๐Ÿ“Š Reward Formula

```
reward = base_score + step_bonus โˆ’ penalty
```

| Component     | Value  |
|---------------|--------|
| Base (correct)| 1.00   |
| Base (wrong)  | 0.20   |
| Step bonus    | 0.20   |
| Max per step  | **1.20** |
| Episode max   | **4.80** |

## โš ๏ธ Penalties

| Trigger                        | Penalty |
|-------------------------------|---------|
| Wrong action in step           | โˆ’0.30   |
| Repeated response              | โˆ’0.20   |
| Early solution                 | โˆ’0.25   |
| Angry customer ignored         | โˆ’0.25   |
| Generic / too-short response   | โˆ’0.15   |
| Wrong assumption               | โˆ’0.20   |
| Skipped step                   | โˆ’0.30   |

## ๐Ÿ’ฅ Fail Conditions

- More than **3 wrong steps** across episode
- Total reward below **1.5**
- Agent stuck in loop: **3 consecutive failures** at same step
- Single-step penalty โ‰ฅ 0.80

## ๐Ÿš€ Local Setup

```bash
pip install -r requirements.txt
python inference.py --task all --agent rule   # CLI test
python app.py                                  # Gradio UI
python tests/test_cases.py                    # Run tests
```