Skip to content

Commit 67d731f

Browse files
committed
move core env server code into env_server dir from env dir
1 parent 54ca108 commit 67d731f

File tree

5 files changed

+24
-47
lines changed

5 files changed

+24
-47
lines changed

src/core/env/__init__.py renamed to src/core/env_server/__init__.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,34 @@
66

77
"""Core environment interfaces and types."""
88

9-
from .interfaces import Environment, Transform, Tool, ToolRegistry
10-
from .types import (
11-
Action, CodeAction, Observation, CodeObservation,
12-
State, CodeState, ExecutionResult
13-
)
149
from .base_transforms import CompositeTransform, NullTransform
1510
from .code_execution_environment import CodeExecutionEnvironment
11+
from .interfaces import Environment, Transform
12+
from .types import (
13+
Action,
14+
CodeAction,
15+
CodeObservation,
16+
CodeState,
17+
ExecutionResult,
18+
Observation,
19+
State,
20+
)
1621

1722
__all__ = [
1823
# Core interfaces
19-
"Environment", "Transform", "Tool", "ToolRegistry",
20-
24+
"Environment",
25+
"Transform",
2126
# Types
22-
"Action", "CodeAction", "Observation", "CodeObservation",
23-
"State", "CodeState", "ExecutionResult",
24-
27+
"Action",
28+
"CodeAction",
29+
"Observation",
30+
"CodeObservation",
31+
"State",
32+
"CodeState",
33+
"ExecutionResult",
2534
# Base transforms
26-
"CompositeTransform", "NullTransform",
27-
35+
"CompositeTransform",
36+
"NullTransform",
2837
# Base environment implementation
29-
"CodeExecutionEnvironment"
30-
]
38+
"CodeExecutionEnvironment",
39+
]
File renamed without changes.

src/core/env/interfaces.py renamed to src/core/env_server/interfaces.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __call__(self, observation: Observation) -> Observation:
3232

3333

3434
class Environment(ABC):
35-
"""Base class for all environments following Gym/Gymnasium API.
35+
"""Base class for all environment servers following Gym/Gymnasium API.
3636
3737
Args:
3838
transform: Optional transform to apply to observations
@@ -62,35 +62,3 @@ def _apply_transform(self, observation: Observation) -> Observation:
6262
if self.transform is not None:
6363
return self.transform(observation)
6464
return observation
65-
66-
67-
class Tool(ABC):
68-
"""Base class for tools that can be used in code execution."""
69-
70-
@abstractmethod
71-
def __call__(self, *args, **kwargs) -> Any:
72-
"""Execute the tool."""
73-
pass
74-
75-
76-
class ToolRegistry:
77-
"""Registry for managing tools available to code execution."""
78-
79-
def __init__(self):
80-
self._tools: dict[str, Any] = {}
81-
82-
def register(self, name: str, tool: Any):
83-
"""Register a tool with a name."""
84-
self._tools[name] = tool
85-
86-
def get(self, name: str) -> Any | None:
87-
"""Get a tool by name."""
88-
return self._tools.get(name)
89-
90-
def get_all(self) -> dict[str, Any]:
91-
"""Get all registered tools."""
92-
return self._tools.copy()
93-
94-
def get_names(self) -> list[str]:
95-
"""Get all tool names."""
96-
return list(self._tools.keys())
File renamed without changes.

0 commit comments

Comments
 (0)