Palak6106/email-sorting-openenv
0
Email Sorting OpenEnv ๐ง
A real-world OpenEnv environment where an AI agent learns to classify emails as spam, important, or promotion. Built for the Meta x PyTorch OpenEnv Hackathon.
What This Project Does
In today's world, people receive hundreds of emails daily. This environment trains an AI agent to automatically sort emails by reading the subject, body, and sender โ just like a smart inbox.
The agent learns:
- Correct classification = reward
- Wrong classification = penalty
- Harder emails = higher reward (to encourage learning)
Environment Details
Action Space
The agent can take exactly one of these actions per step:
Observation Space
Each step the agent receives:
{
"email": {
"subject": "You won $1,000,000!",
"body": "Click here to claim your prize.",
"sender": "prize@randomsite.xyz"
},
"step": 1,
"max_steps": 10,
"total_reward": 0.0,
"done": false,
"valid_actions": ["spam", "important", "promotion"]
}Tasks
Reward Function
Baseline Scores
Scores achieved by the rule-based baseline agent (baseline_agent in graders.py):
Setup & Usage
Local
pip install -r requirements.txt
python server.py # starts server at http://localhost:7860
python graders.py # run graders with baseline agent
python inference.py # run inference loopDocker
docker build -t email-sorting-openenv .
docker run -p 7860:7860 email-sorting-openenvAPI
curl -X POST http://localhost:7860/reset
curl -X POST http://localhost:7860/step -H "Content-Type: application/json" -d '{"action":"spam"}'
curl http://localhost:7860/state
curl http://localhost:7860/graders