Veer15/openenv-distributed-systems-debugging
0
1from typing import Any2 3from pydantic import BaseModel, Field, field_validator4 5 6class SystemMetrics(BaseModel):7 gateway_success_rate: float = Field(..., ge=0.0, le=1.0)8 gateway_p99_latency_ms: float = Field(..., ge=0.0)9 queue_depth: int = Field(..., ge=0)10 worker_restart_count: int = Field(..., ge=0)11 consumer_stall_count: int = Field(..., ge=0)12 13 14class Observation(BaseModel):15 command_output: str = Field(16 ..., description="stdout+stderr from the last executed command"17 )18 metrics: SystemMetrics19 process_status: dict[str, str] = Field(default_factory=dict)20 21 22class Action(BaseModel):23 command: str = Field(..., description="Single bash command to execute")24 25 @field_validator("command")26 @classmethod27 def command_must_not_be_empty(cls, value: str) -> str:28 if not value.strip():29 raise ValueError("command must not be empty")30 return value31 32 33class Reward(BaseModel):34 value: float = Field(..., ge=0.0, le=1.0)35 36 37class StepResult(BaseModel):38 observation: Observation39 reward: float = Field(..., ge=0.0, le=1.0)40 done: bool41 info: dict[str, Any] = Field(default_factory=dict)42 