File size: 1,906 Bytes
753b5ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
models.py — Typed Action / Observation models for the Email Triage environment.

Real-world task: An AI agent reads incoming emails and must:
  1. Classify the email category
  2. Assign a priority level
  3. Route to the correct department + draft an appropriate reply

Action Space:
  - category   : spam | billing | technical | hr | general
  - priority   : low | medium | high | urgent
  - department : support | finance | engineering | hr | management
  - reply      : free-text reply draft (required for medium/hard tasks)

Observation Space:
  - email_id       : unique ID for the current email
  - subject        : email subject line
  - body           : email body text
  - sender         : sender address
  - task_level     : easy | medium | hard
  - feedback       : natural-language feedback on the last action
  - score          : 0.0-1.0 cumulative task score
  - done           : episode finished flag
  - reward         : step reward
  - emails_remaining: how many emails are left in the episode
"""

from typing import Literal, Optional
from openenv.core.env_server.types import Action, Observation

Category   = Literal["spam", "billing", "technical", "hr", "general"]
Priority   = Literal["low", "medium", "high", "urgent"]
Department = Literal["support", "finance", "engineering", "hr", "management"]


class TriageAction(Action):
    """Agent's triage decision for one email."""
    category:   Category
    priority:   Priority
    department: Department
    reply:      str = ""          # Required for medium / hard tasks


class TriageObservation(Observation):
    """What the agent sees after each step."""
    email_id:          str
    subject:           str
    body:              str
    sender:            str
    task_level:        Literal["easy", "medium", "hard"]
    feedback:          str   = ""
    score:             float = 0.0
    emails_remaining:  int   = 0