File size: 1,618 Bytes
e12d96c
 
 
 
 
 
 
 
 
 
22d90ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Invoice Exception Handler
emoji: 🧾
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---

# Invoice Exception Handler — OpenEnv

> An AI agent learning environment that simulates accounts payable exception handling.
> The agent acts as an AP analyst: receives flagged invoices, investigates root causes,
> makes decisions, and closes cases. Built for the OpenEnv hackathon.

---

## Quick Start

```bash
pip install -r requirements.txt
python app.py
# Visit http://localhost:7860
```

## Tasks

| Task | Difficulty | Description |
|------|-----------|-------------|
| task1_price_variance | Easy | Invoice 3.08% above PO, verbal approval from procurement |
| task2_duplicate_tax | Medium | Duplicate invoice with hidden GST error correction |
| task3_compound_fraud | Hard | 4 simultaneous fraud signals including BEC attack |

## API

```
POST /reset    — Start new episode
POST /step     — Execute action
GET  /state    — Current state
POST /grade    — Grade episode
GET  /health   → {"status": "ok"}
```

## Action Space

| Action | Params |
|--------|--------|
| inspect_field | document, field |
| cross_check | field, doc_a, doc_b |
| run_check | check_name |
| query_supplier | question, channel |
| query_internal | department, question |
| apply_rule | rule_id |
| make_decision | decision, reason |
| route_to | team, notes |
| close_case | summary |

## Environment Variables

| Variable | Default |
|----------|---------|
| API_BASE_URL | https://router.huggingface.co/v1 |
| MODEL_NAME | Qwen/Qwen2.5-72B-Instruct |
| HF_TOKEN | (required for inference) |