Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0b15865
Test workflow
zkwentz Oct 18, 2025
e04a79a
refactor: migrate from dataclasses to Pydantic models
rycerzes Nov 17, 2025
f15fbdf
fix: specify type for state in get_state
rycerzes Nov 17, 2025
522b2ae
refactor: migrate echo_env to use Pydantic
rycerzes Nov 17, 2025
ff1bd7c
feat: endpoints to retrieve JSON schemas actions, observations, and s…
rycerzes Nov 18, 2025
82acaf2
feat: request and response models for reset and step endpoints
rycerzes Nov 18, 2025
04eb97b
feat: extra fields in reset and step request models for custom params
rycerzes Nov 18, 2025
4078161
chore: API docs and metadata extraction for action fields
rycerzes Nov 19, 2025
a9038dc
feat: env metadata
rycerzes Nov 19, 2025
3ec13a3
delete envs directory
burtenshaw Nov 25, 2025
0d59dc3
delete src/core
burtenshaw Nov 25, 2025
75af090
delete src/openenv_cli
burtenshaw Nov 25, 2025
3b5c245
add openenv cli
burtenshaw Nov 25, 2025
b4785a3
add openenv core
burtenshaw Nov 25, 2025
701e07a
add init shims
burtenshaw Nov 25, 2025
83dda10
move envs to root
burtenshaw Nov 25, 2025
3597636
update tests
burtenshaw Nov 25, 2025
2251f3a
grep update examples
burtenshaw Nov 25, 2025
d196fc1
update scripts with new envs path
burtenshaw Nov 25, 2025
f66f189
update gh actions
burtenshaw Nov 25, 2025
916dc30
update rfcs
burtenshaw Nov 25, 2025
0659195
update readme
burtenshaw Nov 25, 2025
1e7e398
update docs for restructure
burtenshaw Nov 25, 2025
a784df9
update project toml
burtenshaw Nov 25, 2025
7bd8559
simplify all optional group in toml
burtenshaw Nov 25, 2025
bbf9252
feat: serialization utilities and route config
rycerzes Nov 25, 2025
c4f20d7
chore: types
rycerzes Nov 25, 2025
e612a1b
Merge pull request #225 from meta-pytorch/restructure-package
burtenshaw Dec 3, 2025
c4b0e6d
Merge branch 'main' into release
burtenshaw Dec 3, 2025
e58eb83
Merge branch 'main' into release
burtenshaw Dec 3, 2025
b254e20
Merge branch 'release' into pr/217-with-release
burtenshaw Dec 3, 2025
cd8b057
Merge pull request #217 from rycerzes/pydantic-migration
burtenshaw Dec 3, 2025
4a1578f
Merge branch 'main' into release
burtenshaw Dec 11, 2025
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 .github/workflows/deploy-hf-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
# Check which specific environments changed
changed_envs=()
for env in echo_env coding_env chat_env atari_env openspiel_env; do
if git diff --name-only HEAD~1 HEAD | grep -E "^src/envs/$env/" > /dev/null; then
if git diff --name-only HEAD~1 HEAD | grep -E "^envs/$env/" > /dev/null; then
changed_envs+=("$env")
fi
done
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ jobs:
matrix:
image:
- name: echo-env
dockerfile: src/envs/echo_env/server/Dockerfile
dockerfile: envs/echo_env/server/Dockerfile
- name: chat-env
dockerfile: src/envs/chat_env/server/Dockerfile
dockerfile: envs/chat_env/server/Dockerfile
- name: coding-env
dockerfile: src/envs/coding_env/server/Dockerfile
dockerfile: envs/coding_env/server/Dockerfile
- name: sumo-rl-env
dockerfile: src/envs/sumo_rl_env/server/Dockerfile
dockerfile: envs/sumo_rl_env/server/Dockerfile
- name: atari-env
dockerfile: src/envs/atari_env/server/Dockerfile
dockerfile: envs/atari_env/server/Dockerfile
- name: git-env
dockerfile: src/envs/git_env/server/Dockerfile
dockerfile: envs/git_env/server/Dockerfile
- name: my-env # Add your environment here
dockerfile: src/envs/connect4_env/server/Dockerfile
dockerfile: envs/connect4_env/server/Dockerfile
- name: textarena-env
dockerfile: src/envs/textarena_env/server/Dockerfile
dockerfile: envs/textarena_env/server/Dockerfile
- name: browsergym-env
dockerfile: src/envs/browsergym_env/server/Dockerfile
dockerfile: envs/browsergym_env/server/Dockerfile
- name: snake-env
dockerfile: src/envs/snake_env/server/Dockerfile
dockerfile: envs/snake_env/server/Dockerfile

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openspiel_base_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: src/envs/openspiel_env/server/Dockerfile.openspiel-base
file: envs/openspiel_env/server/Dockerfile.openspiel-base
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta-openspiel-base.outputs.tags }}
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

An e2e framework for creating, deploying and using isolated execution environments for agentic RL training, built using Gymnasium style simple APIs.

[![PyPI](https://img.shields.io/pypi/v/openenv-core?color=blue)](https://pypi.org/project/openenv-core/)
[![PyPI](https://img.shields.io/pypi/v/openenv?color=blue)](https://pypi.org/project/openenv/)
[![Discord](https://img.shields.io/badge/Discord-OpenEnv-7289da?style=flat&logo=discord&logoColor=white)](https://discord.gg/YsTYBh6PD9)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/meta-pytorch/OpenEnv/blob/main/examples/OpenEnv_Tutorial.ipynb)
[![Docs](https://img.shields.io/badge/Docs-Explore-blue?logo=readthedocs&logoColor=white)](https://meta-pytorch.org/OpenEnv/)
Expand Down Expand Up @@ -83,7 +83,7 @@ The web interface is **conditionally enabled** based on environment variables:
To use the web interface:

```python
from core.env_server import create_web_interface_app
from openenv.core.env_server import create_web_interface_app
from your_env.models import YourAction, YourObservation
from your_env.server.your_environment import YourEnvironment

Expand Down Expand Up @@ -176,7 +176,7 @@ uv run server --host 0.0.0.0 --port 8000
- ✅ **Flexible workflows**: Use pip, uv, or Docker for different scenarios
- ✅ **CI/CD ready**: Automated dependency generation and validation

See [`src/envs/README.md`](src/envs/README.md) for a complete guide on building environments.
See [`envs/README.md`](envs/README.md) for a complete guide on building environments.

### For Environment Users

Expand Down Expand Up @@ -276,7 +276,7 @@ A simple environment that echoes back messages with metadata. Perfect for:
- Learning the framework basics
- Verifying container deployment

See: [`src/envs/echo_env/README.md`](src/envs/echo_env/README.md)
See: [`envs/echo_env/README.md`](envs/echo_env/README.md)

### Coding Environment
Executes arbitrary Python code in a sandboxed environment. Features:
Expand All @@ -285,7 +285,7 @@ Executes arbitrary Python code in a sandboxed environment. Features:
- Persistent execution context within episodes
- Error handling with detailed messages

See: [`src/envs/coding_env/README.md`](src/envs/coding_env/README.md)
See: [`envs/coding_env/README.md`](envs/coding_env/README.md)

## Community Support & Acknowledgments
This is an open and community-centric project. If you would like to add your name here, please put up a pull request and tag @jspisak for review. Ty!!
Expand Down
18 changes: 9 additions & 9 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# CLI (`openenv_cli`)
# CLI (`openenv.cli`)

The `openenv` CLI provides a set of commands for building, validating, and pushing environments to Hugging Face Spaces or a custom Docker registry. For an end-to-end tutorial on building environments with OpenEnv, see the [building an environment](environment-builder.md) guide.

## `openenv init`

::: openenv_cli.commands.init
::: openenv.cli.commands.init

## `openenv build`

::: openenv_cli.commands.build
::: openenv.cli.commands.build

## `openenv validate`

::: openenv_cli.commands.validate
::: openenv.cli.commands.validate

## `openenv push`

::: openenv_cli.commands.push
::: openenv.cli.commands.push

## `openenv serve`

::: openenv_cli.commands.serve
::: openenv.cli.commands.serve

# API Reference

## Entry point

::: openenv_cli.__main__
::: openenv.cli.__main__

## CLI helpers

::: openenv_cli._cli_utils
::: openenv.cli._cli_utils

## Validation utilities

::: openenv_cli._validation
::: openenv.cli._validation
14 changes: 7 additions & 7 deletions docs/core.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Core API Reference

The `openenv-core` package provides the core abstractions for building and running environments. For an end-to-end tutorial on building environments with OpenEnv, see the [building an environment](environment-builder.md) guide.
The `openenv.core` package provides the core abstractions for building and running environments. For an end-to-end tutorial on building environments with OpenEnv, see the [building an environment](environment-builder.md) guide.

## Core runtime (`core`)

### Environment server primitives

::: core.env_server.interfaces
::: openenv.core.env_server.interfaces

### HTTP server utilities

::: core.env_server.http_server
::: openenv.core.env_server.http_server

### Web interface helpers

::: core.env_server.web_interface
::: openenv.core.env_server.web_interface

### Client contracts

::: core.http_env_client
::: openenv.core.http_env_client

### Shared dataclasses

::: core.client_types
::: openenv.core.client_types

### Container providers

::: core.containers.runtime.providers
::: openenv.core.containers.runtime.providers
30 changes: 15 additions & 15 deletions docs/environment-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Let's walk through the process of building a custom environment with OpenEnv.
openenv init my_env

# Optionally choose an output directory
openenv init my_env --output-dir /Users/you/src/envs
openenv init my_env --output-dir /Users/you/envs
```

The command creates a fully-typed template with `openenv.yaml`, `pyproject.toml`, `uv.lock`, Docker assets, and stub implementations. If you're working inside this repo, move the generated folder under `src/envs/`.
The command creates a fully-typed template with `openenv.yaml`, `pyproject.toml`, `uv.lock`, Docker assets, and stub implementations. If you're working inside this repo, move the generated folder under `envs/`.

Typical layout:

Expand Down Expand Up @@ -67,7 +67,7 @@ Edit `models.py` to describe your action, observation, and state dataclasses:
```python
# models.py
from dataclasses import dataclass
from core.env_server import Action, Observation, State
from openenv.core.env_server import Action, Observation, State

@dataclass
class MyAction(Action):
Expand All @@ -94,7 +94,7 @@ Customize `server/my_environment.py` by extending `Environment`:
```python
# server/my_environment.py
import uuid
from core.env_server import Environment
from openenv.core.env_server import Environment
from ..models import MyAction, MyObservation, MyState

class MyEnvironment(Environment):
Expand Down Expand Up @@ -123,7 +123,7 @@ class MyEnvironment(Environment):

```python
# server/app.py
from core.env_server import create_fastapi_app
from openenv.core.env_server import create_fastapi_app
from ..models import MyAction, MyObservation
from .my_environment import MyEnvironment

Expand All @@ -137,8 +137,8 @@ app = create_fastapi_app(env, MyAction, MyObservation)

```python
# client.py
from core.http_env_client import HTTPEnvClient
from core.types import StepResult
from openenv.core.http_env_client import HTTPEnvClient
from openenv.core.types import StepResult
from .models import MyAction, MyObservation, MyState

class MyEnv(HTTPEnvClient[MyAction, MyObservation]):
Expand Down Expand Up @@ -176,7 +176,7 @@ Keep building from the `openenv-base` image so shared tooling stays available:
# Multi-stage build using openenv-base
# This Dockerfile is flexible and works for both:
# - In-repo environments (with local src/core)
# - Standalone environments (with openenv-core from pip)
# - Standalone environments (with openenv from pip)
# The build script (openenv build) handles context detection and sets appropriate build args.

ARG BASE_IMAGE=openenv-base:latest
Expand All @@ -191,8 +191,8 @@ ARG ENV_NAME=__ENV_NAME__
# Copy environment code (always at root of build context)
COPY . /app/env

# For in-repo builds, openenv-core is already in the pyproject.toml dependencies
# For standalone builds, openenv-core will be installed from pip via pyproject.toml
# For in-repo builds, openenv is already in the pyproject.toml dependencies
# For standalone builds, openenv will be installed from pip via pyproject.toml
WORKDIR /app/env

# Install dependencies using uv sync
Expand Down Expand Up @@ -247,7 +247,7 @@ If you introduced extra dependencies in the Dockerfile, you should install them
From the environment directory:

```bash
cd src/envs/my_env
cd envs/my_env
openenv build # Builds Docker image (auto-detects context)
openenv validate --verbose
```
Expand Down Expand Up @@ -299,13 +299,13 @@ strategy:
matrix:
image:
- name: echo-env
dockerfile: src/envs/echo_env/server/Dockerfile
dockerfile: envs/echo_env/server/Dockerfile
- name: chat-env
dockerfile: src/envs/chat_env/server/Dockerfile
dockerfile: envs/chat_env/server/Dockerfile
- name: coding-env
dockerfile: src/envs/coding_env/server/Dockerfile
dockerfile: envs/coding_env/server/Dockerfile
- name: my-env # Add your environment here
dockerfile: src/envs/my_env/server/Dockerfile
dockerfile: envs/my_env/server/Dockerfile
```

### Use Your Environment
Expand Down
2 changes: 1 addition & 1 deletion docs/environments/atari.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/atari_env/README.md"
--8<-- "../../envs/atari_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/chat.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/chat_env/README.md"
--8<-- "../../envs/chat_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/coding.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/coding_env/README.md"
--8<-- "../../envs/coding_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/dipg.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/dipg_safety_env/README.md"
--8<-- "../../envs/dipg_safety_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/echo.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/echo_env/README.md"
--8<-- "../../envs/echo_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/finrl.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/finrl_env/README.md"
--8<-- "../../envs/finrl_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/git.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/git_env/README.md"
--8<-- "../../envs/git_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/openspiel.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/openspiel_env/README.md"
--8<-- "../../envs/openspiel_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/sumo.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/sumo_rl_env/README.md"
--8<-- "../../envs/sumo_rl_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/textarena.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/textarena_env/README.md"
--8<-- "../../envs/textarena_env/README.md"

2 changes: 1 addition & 1 deletion docs/environments/websearch.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--8<-- "../../src/envs/websearch_env/README.md"
--8<-- "../../websearch_env/README.md"

2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div>
<a href="https://discord.gg/YsTYBh6PD9"><img src="https://camo.githubusercontent.com/aa8bf380611b9abd47f42596a15b4842eaf01af84c86cc97001d2d5d166ef8c0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446973636f72642d4f70656e456e762d3732383964613f7374796c653d666c6174266c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465"></a>
<a href="https://pypi.org/project/openenv-core/"><img src="https://img.shields.io/pypi/v/openenv-core?color=blue"></a>
<a href="https://pypi.org/project/openenv/"><img src="https://img.shields.io/pypi/v/openenv?color=blue"></a>
<a href="https://colab.research.google.com/github/meta-pytorch/OpenEnv/blob/main/examples/OpenEnv_Tutorial.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg"></a>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ markdown_extensions:
- meta

watch:
- ../src/core
- ../src/openenv_cli
- ../src/openenv/core
- ../src/openenv/cli

nav:
- Get Started:
Expand Down
8 changes: 2 additions & 6 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ To install the OpenEnv package, you can use the following command:
pip install https://github.com/meta-pytorch/OpenEnv.git
```

!!! warning
This will install the `openenv` cli and not the `openenv-core` package. If you want to install the `openenv-core` package, you can use the following command:

```bash
pip install openenv-core
```
!!! note
This installs both the `openenv` CLI and the `openenv.core` runtime. Environment projects can depend on `openenv[core]` if they only need the server/client libraries.

### Using the Echo Environment (Example)

Expand Down
Loading