abhisathwika/openenv-realworld
0
OpenEnv Email Triage Environment
An OpenEnv-compliant environment simulating real-world email triage tasks. Agents must classify, prioritize, route, and respond to emails across three difficulty levels.
Motivation
Email triage is a universal real-world task. Knowledge workers spend ~28% of their workday managing email. This environment tests an AI agent's ability to:
- Understand context — distinguish spam from urgent requests
- Make decisions — prioritize and route appropriately
- Communicate — draft professional responses
- Manage resources — work within a time budget
Tasks
Observation Space
Action Space
Reward Function
Rewards are provided incrementally at each step:
- ✅ Correct classification: +0.10
- ✅ Accurate priority: +0.08 (partial credit for close answers)
- ✅ Correct routing: +0.08
- ✅ Quality response: +0.05
- ✅ Correctly flagging urgent: +0.06
- ❌ Wrong classification: +0.02 (attempt credit)
- ❌ Unnecessary flagging: -0.02
- ❌ Nonexistent email: -0.05
- ❌ Time expired: -0.10
- ❌ Too many steps (loop detection): -0.20
Final score (0.0–1.0) is computed by the task-specific grader upon done.
Setup
# Install dependencies
pip install -r requirements.txt
# Or install as package
pip install -e .Usage
Python API
from email_triage import EmailTriageEnv
from email_triage.models import Action, ActionType, EmailCategory
env = EmailTriageEnv(task_id="easy_classify")
obs = env.reset()
# Classify an email
action = Action(
action_type=ActionType.CLASSIFY,
email_id="e1",
category=EmailCategory.SPAM,
)
obs, reward, done, info = env.step(action)
print(f"Reward: {reward.score}, Message: {reward.message}")
# Finish
obs, reward, done, info = env.step(Action(action_type=ActionType.DONE))
print(f"Final score: {info['final_score']}")Inference Script
export HF_TOKEN="your_huggingface_token"
export MODEL_ID="meta-llama/Llama-3.1-8B-Instruct" # optional, this is default
python scripts/inference.pyDocker
docker build -t email-triage-env .
docker run -e HF_TOKEN=$HF_TOKEN email-triage-envOpenEnv Validation
openenv validateBaseline Performance
Scores may vary based on model and API conditions.
Project Structure
openenv-email-triage/
├── openenv.yaml # OpenEnv metadata
├── Dockerfile # Container config
├── requirements.txt # Python dependencies
├── setup.py # Package setup
├── README.md # This file
├── email_triage/
│ ├── __init__.py # Package exports
│ ├── models.py # Pydantic models (Observation, Action, Reward)
│ ├── data.py # Email datasets for each difficulty
│ ├── graders.py # Programmatic graders (0.0–1.0)
│ └── env.py # Main environment (step/reset/state)
└── scripts/
└── inference.py # Baseline inference with OpenAI APILicense
MIT
