Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ When building a new environment, create the following structure:
```
src/envs/your_env/
├── __init__.py # Export YourAction, YourObservation, YourEnv
├── models.py # Define Action, Observation, State dataclasses
├── types.py # Define Action, Observation, State dataclasses
├── client.py # Implement YourEnv(HTTPEnvClient)
├── README.md # Document your environment
└── server/
Expand Down
2 changes: 1 addition & 1 deletion src/core/env_server/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def create_fastapi_app(

Example:
>>> from envs.coding_env.server import CodeExecutionEnvironment
>>> from envs.coding_env.models import CodeAction, CodeObservation
>>> from envs.coding_env.types import CodeAction, CodeObservation
>>>
>>> env = CodeExecutionEnvironment()
>>> app = create_fastapi_app(env, CodeAction, CodeObservation)
Expand Down
2 changes: 1 addition & 1 deletion src/core/http_env_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def from_docker_image(

Example:
>>> from envs.coding_env.client import CodingEnv
>>> from envs.coding_env.models import CodeAction
>>> from envs.coding_env.types import CodeAction
>>>
>>> # Create environment from image
>>> env = CodingEnv.from_docker_image("coding-env:latest")
Expand Down
12 changes: 6 additions & 6 deletions src/envs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Creating an environment involves five main steps:
Create your action, observation, and state models using Python dataclasses:

```python
# models.py
# types.py
from dataclasses import dataclass
from core.env_server import Action, Observation, State

Expand Down Expand Up @@ -48,7 +48,7 @@ Implement the three core methods: `reset()`, `step()`, and `state`:
# server/my_environment.py
import uuid
from core.env_server import Environment
from ..models import MyAction, MyObservation, MyState
from ..types import MyAction, MyObservation, MyState

class MyEnvironment(Environment):
def __init__(self):
Expand Down Expand Up @@ -77,7 +77,7 @@ Use the `create_fastapi_app` helper to create your HTTP server:
```python
# server/app.py
from core.env_server import create_fastapi_app
from ..models import MyAction, MyObservation
from ..types import MyAction, MyObservation
from .my_environment import MyEnvironment

env = MyEnvironment()
Expand Down Expand Up @@ -140,7 +140,7 @@ Create a client that extends `HTTPEnvClient`:
# client.py
from core.http_env_client import HTTPEnvClient
from core.types import StepResult
from .models import MyAction, MyObservation, MyState
from .types import MyAction, MyObservation, MyState

class MyEnv(HTTPEnvClient[MyAction, MyObservation]):
def _step_payload(self, action: MyAction) -> dict:
Expand Down Expand Up @@ -203,7 +203,7 @@ Organize your environment following this structure:
```
src/envs/my_env/
├── __init__.py # Export MyAction, MyObservation, MyState, MyEnv
├── models.py # Action, Observation, State definitions
├── types.py # Action, Observation, State definitions
├── client.py # MyEnv client implementation
├── README.md # Environment documentation
└── server/
Expand Down Expand Up @@ -282,7 +282,7 @@ Test your environment before containerization:
```python
# test_my_environment.py
from envs.my_env.server.my_environment import MyEnvironment
from envs.my_env.models import MyAction
from envs.my_env.types import MyAction

def test_environment():
env = MyEnvironment()
Expand Down
2 changes: 1 addition & 1 deletion src/envs/atari_env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"""

from .client import AtariEnv
from .models import AtariAction, AtariObservation, AtariState
from .types import AtariAction, AtariObservation, AtariState

__all__ = ["AtariEnv", "AtariAction", "AtariObservation", "AtariState"]
2 changes: 1 addition & 1 deletion src/envs/atari_env/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from core.http_env_client import HTTPEnvClient
from core.types import StepResult

from .models import AtariAction, AtariObservation, AtariState
from .types import AtariAction, AtariObservation, AtariState

if TYPE_CHECKING:
from core.containers.runtime import ContainerProvider
Expand Down
2 changes: 1 addition & 1 deletion src/envs/atari_env/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

from core.env_server import create_fastapi_app

from ..models import AtariAction, AtariObservation
from ..types import AtariAction, AtariObservation
from .atari_environment import AtariEnvironment

# Get configuration from environment variables
Expand Down
2 changes: 1 addition & 1 deletion src/envs/atari_env/server/atari_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from core.env_server import Action, Environment, Observation

from ..models import AtariAction, AtariObservation, AtariState
from ..types import AtariAction, AtariObservation, AtariState

# Import ALE
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

"""
Data models for Atari Environment.
Data types for Atari Environment.

This module defines the Action, Observation, and State types for Atari games
via the Arcade Learning Environment (ALE).
Expand Down
2 changes: 1 addition & 1 deletion src/envs/chat_env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ chat_env/
├── __init__.py # Module exports (ChatEnv, ChatAction, etc.)
├── README.md # This file
├── client.py # ChatEnv HTTP client
├── models.py # ChatAction, ChatObservation, ChatState
├── types.py # ChatAction, ChatObservation, ChatState
└── server/
├── __init__.py # Server module exports
├── chat_environment.py # Core ChatEnvironment implementation
Expand Down
2 changes: 1 addition & 1 deletion src/envs/chat_env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"""Chat Environment - A chat-based environment for LLMs with tokenization support."""

from .client import ChatEnv
from .models import ChatAction, ChatObservation, ChatState
from .types import ChatAction, ChatObservation, ChatState

__all__ = ["ChatAction", "ChatObservation", "ChatState", "ChatEnv"]
2 changes: 1 addition & 1 deletion src/envs/chat_env/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from core.http_env_client import HTTPEnvClient
from core.types import StepResult

from .models import ChatAction, ChatObservation, ChatState
from .types import ChatAction, ChatObservation, ChatState


class ChatEnv(HTTPEnvClient[ChatAction, ChatObservation]):
Expand Down
2 changes: 1 addition & 1 deletion src/envs/chat_env/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from core.env_server import create_fastapi_app

from ..models import ChatAction, ChatObservation
from ..types import ChatAction, ChatObservation
from .chat_environment import ChatEnvironment


Expand Down
2 changes: 1 addition & 1 deletion src/envs/chat_env/server/chat_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from core.env_server.interfaces import Environment, Message, ModelTokenizer, Transform

from ..models import ChatAction, ChatObservation, ChatState
from ..types import ChatAction, ChatObservation, ChatState


class ChatEnvironment(Environment):
Expand Down
2 changes: 1 addition & 1 deletion src/envs/chat_env/server/test_chat_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from core.env_server.interfaces import Message

from ..models import ChatAction
from ..types import ChatAction
from .chat_environment import ChatEnvironment


Expand Down
2 changes: 1 addition & 1 deletion src/envs/chat_env/models.py → src/envs/chat_env/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

"""
Data models for the Chat Environment.
Data types for the Chat Environment.

The Chat environment provides a chat-based interface for LLMs with support
for tokenization and message history management.
Expand Down
2 changes: 1 addition & 1 deletion src/envs/coding_env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ This example shows:
```
coding_env/
├── README.md # This file
├── models.py # Action, Observation, and State models
├── types.py # Action, Observation, and State types
├── client/
│ ├── coding_env_client.py # CodingEnv client implementation
│ └── example_usage.py # Usage examples
Expand Down
2 changes: 1 addition & 1 deletion src/envs/coding_env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"""Coding Environment - A Python code execution environment."""

from .coding_env_client import CodingEnv
from .models import CodeAction, CodeObservation, CodeState
from .types import CodeAction, CodeObservation, CodeState

__all__ = ["CodeAction", "CodeObservation", "CodeState", "CodingEnv"]
2 changes: 1 addition & 1 deletion src/envs/coding_env/coding_env_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from core.http_env_client import HTTPEnvClient
from core.types import StepResult

from .models import CodeAction, CodeObservation, CodeState
from .types import CodeAction, CodeObservation, CodeState

if TYPE_CHECKING:
from core.containers.runtime import ContainerProvider
Expand Down
2 changes: 1 addition & 1 deletion src/envs/coding_env/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from core.env_server import create_fastapi_app

from ..models import CodeAction, CodeObservation
from ..types import CodeAction, CodeObservation
from .python_codeact_env import PythonCodeActEnv

# Create the environment instance
Expand Down
2 changes: 1 addition & 1 deletion src/envs/coding_env/server/python_codeact_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from core.env_server import Action, Environment, Observation, Transform
from core.tools import PyExecutor

from ..models import CodeAction, CodeObservation, CodeState
from ..types import CodeAction, CodeObservation, CodeState
from .transforms import create_safe_coding_transform

class PythonCodeActEnv(Environment):
Expand Down
2 changes: 1 addition & 1 deletion src/envs/coding_env/server/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from core.env_server.interfaces import Transform
from core.env_server.types import Observation

from ..models import CodeObservation
from ..types import CodeObservation


class CodeSafetyTransform(Transform):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
envs/coding_env/models.py
envs/coding_env/types.py
--------------------------------
Action/Observation types for the Coding environment.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/envs/echo_env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ echo_env/
├── __init__.py # Module exports
├── README.md # This file
├── client.py # EchoEnv client implementation
├── models.py # Action and Observation models
├── types.py # Action and Observation types
└── server/
├── __init__.py # Server module exports
├── echo_environment.py # Core environment logic
Expand Down
2 changes: 1 addition & 1 deletion src/envs/echo_env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"""Echo Environment - A simple test environment for HTTP server."""

from .client import EchoEnv
from .models import EchoAction, EchoObservation
from .types import EchoAction, EchoObservation

__all__ = ["EchoAction", "EchoObservation", "EchoEnv"]
2 changes: 1 addition & 1 deletion src/envs/echo_env/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from core.http_env_client import HTTPEnvClient
from core.types import StepResult

from .models import EchoAction, EchoObservation
from .types import EchoAction, EchoObservation


class EchoEnv(HTTPEnvClient[EchoAction, EchoObservation]):
Expand Down
2 changes: 1 addition & 1 deletion src/envs/echo_env/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from core.env_server import create_fastapi_app

from ..models import EchoAction, EchoObservation
from ..types import EchoAction, EchoObservation
from .echo_environment import EchoEnvironment

# Create the environment instance
Expand Down
2 changes: 1 addition & 1 deletion src/envs/echo_env/server/echo_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from core.env_server.interfaces import Environment
from core.env_server.types import State

from ..models import EchoAction, EchoObservation
from ..types import EchoAction, EchoObservation


class EchoEnvironment(Environment):
Expand Down
2 changes: 1 addition & 1 deletion src/envs/echo_env/models.py → src/envs/echo_env/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

"""
Data models for the Echo Environment.
Data types for the Echo Environment.

The Echo environment is a simple test environment that echoes back messages.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/envs/openspiel_env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"""

from .client import OpenSpielEnv
from .models import OpenSpielAction, OpenSpielObservation, OpenSpielState
from .types import OpenSpielAction, OpenSpielObservation, OpenSpielState

__all__ = ["OpenSpielEnv", "OpenSpielAction", "OpenSpielObservation", "OpenSpielState"]
2 changes: 1 addition & 1 deletion src/envs/openspiel_env/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from core.http_env_client import HTTPEnvClient
from core.types import StepResult

from .models import OpenSpielAction, OpenSpielObservation, OpenSpielState
from .types import OpenSpielAction, OpenSpielObservation, OpenSpielState

if TYPE_CHECKING:
from core.containers.runtime import ContainerProvider
Expand Down
2 changes: 1 addition & 1 deletion src/envs/openspiel_env/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from core.env_server import create_fastapi_app

from ..models import OpenSpielAction, OpenSpielObservation
from ..types import OpenSpielAction, OpenSpielObservation
from .openspiel_environment import OpenSpielEnvironment

# Get game configuration from environment variables
Expand Down
2 changes: 1 addition & 1 deletion src/envs/openspiel_env/server/openspiel_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from core.env_server import Action, Environment, Observation

from ..models import OpenSpielAction, OpenSpielObservation, OpenSpielState
from ..types import OpenSpielAction, OpenSpielObservation, OpenSpielState
from .opponent_policies import get_opponent_policy, OpponentPolicy

# Import OpenSpiel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

"""
Data models for OpenSpiel Environment.
Data types for OpenSpiel Environment.

This module defines the Action, Observation, and State types for OpenSpiel games.
"""
Expand Down