Spaces:
Sleeping
Sleeping
| from pydantic import BaseModel, Field | |
| from typing import List, Optional | |
| class Resource(BaseModel): | |
| id: str = Field(description="Unique resource identifier") | |
| type: str = Field(description="Instance type (e.g., t3.small, m5.large)") | |
| cpu_usage: float = Field(description="CPU usage percentage") | |
| mem_usage: float = Field(description="Memory usage percentage") | |
| monthly_cost: float = Field(description="Monthly cost in USD") | |
| class Metrics(BaseModel): | |
| avg_latency_ms: float = Field(description="Average latency in milliseconds") | |
| error_rate: float = Field(description="Error rate (0-1)") | |
| throughput_rps: float = Field(description="Requests per second") | |
| class SLA(BaseModel): | |
| max_latency_ms: float = Field(description="Maximum allowed latency") | |
| max_budget: float = Field(description="Maximum monthly budget in USD") | |
| min_uptime_pct: float = Field(description="Minimum uptime percentage") | |
| class Observation(BaseModel): | |
| inventory: List[Resource] = Field(description="List of active cloud resources") | |
| metrics: Metrics = Field(description="Current system metrics") | |
| sla: SLA = Field(description="Service Level Agreement requirements") | |
| echoed_message: str = Field(default="System ready", description="Feedback from last action") | |
| task_id: str = Field(default="easy", description="Current task identifier") | |
| task_name: str = Field(default="Right-Sizing", description="Human-readable task name") | |
| difficulty: str = Field(default="easy", description="Task difficulty level") | |
| step: int = Field(default=0, description="Current step number") | |
| class Action(BaseModel): | |
| message: str = Field(description="Agent's command to modify infrastructure") | |
| class Reward(BaseModel): | |
| value: float = Field(description="Reward value between 0 and 1") | |
| reason: str = Field(default="", description="Explanation of the reward") | |
| cost_change_pct: float = Field(default=0.0, description="Percentage change in cost") | |
| latency_change_pct: float = Field(default=0.0, description="Percentage change in latency") | |
| ObservationModel = Observation | |
| ActionModel = Action | |
| RewardModel = Reward |