File size: 914 Bytes
0010678
 
 
 
 
fa9da6b
0010678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import Field, BaseModel
from typing import Optional, List, Dict
from openenv.core.env_server import Action, Observation

class URLInfo(BaseModel):
    url:str
    is_shortened: bool
    domain_age_days: int
    has_ssl: bool
    reputation_score: float # 0.0 (Malicious) to 1.0 (Safe)

class MyEnvV4Observation(Observation):
    """Enhanced Observation Space for the Security Agent."""
    sender: str
    subject: str
    body: str
    raw_headers: str
    hop_count: int
    auth_results: Dict[str, str] # e.g., {"SPF": "pass", "DKIM": "fail"}
    urls: List[URLInfo]
    echoed_message: str = ""

class MyEnvV4Action(Action):
    """Enhanced Action Space with Explainability."""
    message: str = Field(..., description="Classification: 'INBOX', 'SPAM', or 'QUARANTINE'")
    reasoning: str = Field(..., description="Justification for the triage decision (e.g., 'Suspicious URL and failed SPF')")