File size: 2,817 Bytes
88f7703
 
 
 
 
 
 
 
 
 
f7c3585
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88f7703
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
---
license: apache-2.0
title: OpenEnv EmailOps
sdk: docker
emoji: 💻
colorFrom: blue
colorTo: indigo
pinned: false
short_description: 'A complete, real-world OpenEnv simulation for email '
---
# OpenEnv - Email Triage & Operations (EmailOps)

This repository contains a real-world task simulation environment for AI agents built according to the **OpenEnv specification**. The environment simulates a mock email inbox where agents perform triage capabilities including moving emails, reading, replying, deleting, and flagging.

This is explicitly a **non-toy, real-world task design**, mirroring workflows that humans complete in corporate business operations or customer support roles.

## Architecture

* **Framework Support:** OpenEnv (Python 3.10+)
* **Typing Interface:** Pydantic (Strong contracts via `Observation`, `Action`, and `RewardInfo`)
* **Deployment:** Hugging Face Spaces Docker / Gradio UI

## Task Scenarios (Easy, Medium, Hard)

The environment supports deterministic tasks with partial progression signals:

1. **Easy (`easy`)**: Move the email with the subject "Invoice" to the "Finance" folder. (Score: 0.0 or 1.0)
2. **Medium (`medium`)**: Find the unread email from the boss, read it, and reply with "Will do.". (Partial reward given for reading the email).
3. **Hard (`hard`)**: Inbox Triage. Agent must delete all spam (from `spam@scam.com`), move Support emails to the 'Support' folder, and flag any email with 'Urgent' in the subject. Includes a severe penalty for deleting non-spam emails (e.g., boss emails).

## Action Space

The action space consists of strongly typed functions:
- `open_email(email_id)`
- `close_email()`
- `move_email(email_id, folder_name)`
- `reply(email_id, reply_body)`
- `delete_email(email_id)`
- `flag_email(email_id)`
- `submit()`

## Observation Space

The observation space exposes:
- **`inbox_summary`**: A view of the emails situated in the *current viewed folder* (list of ids, senders, subjects, unread status).
- **`current_folder`**: String representing currently focused folder.
- **`opened_email`**: The full content of an email, if currently open.
- **`last_action_status`**: Feedback from the previous step.

## Setup Instructions

### Local Development
```bash
pip install -r requirements.txt
```

### Running the Baseline Agent
You can test the environment against an OpenAI model (e.g., GPT-4o-mini).

```bash
export OPENAI_API_KEY="sk-..."
python inference.py --model gpt-4o-mini
```
The script will sequentially invoke the `easy`, `medium`, and `hard` tasks.

### Running with Docker / HF Spaces
This environment is containerized for Hugging Face Spaces using the Gradio interactive interface wrapper.

```bash
docker build -t openenv-emailops .
docker run -p 7860:7860 openenv-emailops
```
Go to `http://localhost:7860` in your browser.