anvisinghh commited on
Commit
0010678
·
verified ·
1 Parent(s): 5e05a3c

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +26 -15
models.py CHANGED
@@ -1,15 +1,26 @@
1
- from pydantic import Field
2
- from typing import Optional, List
3
- from openenv.core.env_server import Action, Observation
4
-
5
- class MyEnvV4Observation(Observation):
6
- """What the Agent sees."""
7
- sender: str
8
- subject: str
9
- body: str
10
- headers: List[str]
11
- echoed_message: str = "" # Required by sample inference script contract
12
-
13
- class MyEnvV4Action(Action):
14
- """What the Agent chooses."""
15
- message: str = Field(..., description="Action string: 'INBOX', 'SPAM', or 'QUARANTINE'")
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pydantic import Field, BaseModel
2
+ from typing import Optional, List, Dict
3
+ from openenv.core.env_server import Action, Observation
4
+
5
+ class URLInfo(BaseModel):
6
+ url: str
7
+ is_shortened: bool
8
+ domain_age_days: int
9
+ has_ssl: bool
10
+ reputation_score: float # 0.0 (Malicious) to 1.0 (Safe)
11
+
12
+ class MyEnvV4Observation(Observation):
13
+ """Enhanced Observation Space for the Security Agent."""
14
+ sender: str
15
+ subject: str
16
+ body: str
17
+ raw_headers: str
18
+ hop_count: int
19
+ auth_results: Dict[str, str] # e.g., {"SPF": "pass", "DKIM": "fail"}
20
+ urls: List[URLInfo]
21
+ echoed_message: str = ""
22
+
23
+ class MyEnvV4Action(Action):
24
+ """Enhanced Action Space with Explainability."""
25
+ message: str = Field(..., description="Classification: 'INBOX', 'SPAM', or 'QUARANTINE'")
26
+ reasoning: str = Field(..., description="Justification for the triage decision (e.g., 'Suspicious URL and failed SPF')")