Aswini-Kumar commited on
Commit
12d9933
·
verified ·
1 Parent(s): 01a32ee

feat: models.py - OpenEnv 5-step structure

Browse files
Files changed (1) hide show
  1. models.py +73 -0
models.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ models.py — Step 1: Define Types
3
+
4
+ Action, Observation dataclasses for the Cross-Session Continuity environment.
5
+ These extend openenv.core types so the framework can serialize/deserialize them.
6
+ """
7
+
8
+ from openenv.core.env_server.types import Action, Observation
9
+ from pydantic import Field
10
+
11
+
12
+ class ContinuityAction(Action):
13
+ """
14
+ Action for the Cross-Session Continuity environment.
15
+
16
+ The agent specifies which tool to call and its arguments.
17
+ """
18
+ tool: str = Field(..., description="Tool name: read_file | write_file | run_tests | write_handoff | parse_handoff | submit")
19
+ path: str = Field(default="", description="File path (for read_file / write_file)")
20
+ content: str = Field(default="", description="File content (for write_file) or handoff note (for write_handoff)")
21
+
22
+
23
+ class ContinuityObservation(Observation):
24
+ """
25
+ Observation returned after each action.
26
+
27
+ Provides the agent with rich feedback about the current episode state,
28
+ session, test results, and any errors or warnings.
29
+ """
30
+ output: str = Field(
31
+ default="",
32
+ description="Primary text output of the tool call",
33
+ )
34
+ session: int = Field(
35
+ default=1,
36
+ description="Current session number (1 or 2)",
37
+ )
38
+ passed: int = Field(
39
+ default=0,
40
+ description="Number of tests passed (run_tests only)",
41
+ )
42
+ total: int = Field(
43
+ default=0,
44
+ description="Total number of tests (run_tests only)",
45
+ )
46
+ auxiliary_reward: float = Field(
47
+ default=0.0,
48
+ description="Shaped reward for this step (training signal only)",
49
+ )
50
+ error: str = Field(
51
+ default="",
52
+ description="Error message if action was invalid or rejected",
53
+ )
54
+ warning: str = Field(
55
+ default="",
56
+ description="Warning message (e.g. approaching step limit)",
57
+ )
58
+ message: str = Field(
59
+ default="",
60
+ description="Informational message (e.g. session transition)",
61
+ )
62
+ retries_left: int = Field(
63
+ default=3,
64
+ description="Remaining retry budget for invalid actions",
65
+ )
66
+ done: bool = Field(
67
+ default=False,
68
+ description="Whether the episode has ended",
69
+ )
70
+ reward: float = Field(
71
+ default=0.0,
72
+ description="Final reward (only set when done=True)",
73
+ )