File size: 1,167 Bytes
5567ff6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""OpsGate data models — Pydantic v2 for OpenEnv compatibility."""
from pydantic import BaseModel, Field
from typing import Optional


class ToolCall(BaseModel):
    tool: str = ""
    action: str = ""
    parameters: dict = Field(default_factory=dict)


class ToolResult(BaseModel):
    success: bool = False
    data: dict = Field(default_factory=dict)
    error: Optional[str] = None
    reward: float = 0.0
    done: bool = False
    step_count: int = 0
    task_description: str = ""
    tools_available: list = Field(default_factory=lambda: ["crm", "billing", "calendar", "email"])


class AuditEvent(BaseModel):
    event_type: str = ""
    action: str = ""
    title: str = ""
    detail: str = ""
    severity: str = "info"
    step: int = 0


class EpisodeState(BaseModel):
    task_id: str = ""
    task_description: str = ""
    target_state: dict = Field(default_factory=dict)
    current_db_snapshot: dict = Field(default_factory=dict)
    tool_calls_made: int = 0
    invalid_calls: int = 0
    policy_violations: int = 0
    completed: bool = False
    verdict: dict = Field(default_factory=dict)
    audit_trail: list = Field(default_factory=list)