File size: 3,448 Bytes
8697ae6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""Pydantic models for the HR Productivity Environment OpenEnv interface."""

from __future__ import annotations

from typing import Any, Dict, List, Literal, Optional

from openenv.core.env_server.types import Action, Observation, State
from pydantic import Field


class HRAction(Action):
    """Action space for the HR Productivity Environment.

    The agent selects an action_type and provides relevant parameters.
    Actions are gated by the current HCM:21 phase.
    """

    action_type: Literal[
        # Scanning phase
        "query_department",
        "query_employees",
        "calculate_metric",
        "review_financials",
        # Planning phase
        "set_hiring_target",
        "set_training_budget",
        "set_compensation_policy",
        "set_retention_program",
        # Producing phase
        "execute_hiring",
        "execute_promotion",
        "execute_transfer",
        "execute_training",
        "execute_termination",
        # Phase/quarter control
        "advance_phase",
        "advance_quarter",
        "submit_report",
    ]
    department: Optional[str] = Field(default=None, description="Target department name")
    employee_ids: Optional[List[str]] = Field(default=None, description="Target employee IDs")
    metric_name: Optional[str] = Field(
        default=None,
        description="Metric to calculate: hcva, hcroi, qips, five_indexes, employee_value",
    )
    amount: Optional[float] = Field(default=None, description="Dollar amount or percentage")
    count: Optional[int] = Field(default=None, description="Headcount or quantity")
    parameters: Optional[Dict[str, Any]] = Field(default=None, description="Additional action parameters")
    rationale: Optional[str] = Field(default=None, description="Agent's reasoning for this action")


class HRObservation(Observation):
    """Observation returned after each step."""

    message: str = Field(description="Human-readable result of the action")
    data: Optional[Dict[str, Any]] = Field(default=None, description="Structured response data")
    available_actions: List[str] = Field(default_factory=list, description="Valid action_types in current phase")
    current_phase: str = Field(default="scanning", description="Current HCM:21 phase")
    current_quarter: int = Field(default=1, description="Current quarter (1-6)")
    step_in_quarter: int = Field(default=0, description="Steps taken in current quarter")
    warnings: List[str] = Field(default_factory=list, description="Budget alerts, attrition spikes, etc.")


class HRState(State):
    """Full environment state exposed via the state endpoint."""

    current_quarter: int = Field(default=1, description="Current quarter (1-6)")
    current_phase: str = Field(default="scanning", description="Current HCM:21 phase")
    total_steps: int = Field(default=0, description="Total steps across all quarters")
    company_snapshot: Dict[str, Any] = Field(default_factory=dict, description="Aggregated company data")
    metric_history: List[Dict[str, Any]] = Field(
        default_factory=list, description="Per-quarter metric snapshots"
    )
    budget_remaining: Dict[str, float] = Field(default_factory=dict, description="Remaining budget allocations")
    active_initiatives: List[Dict[str, Any]] = Field(default_factory=list, description="In-progress programs")
    recent_events: List[str] = Field(default_factory=list, description="Recent stochastic events")