Skip to content
Open
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 .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
18 changes: 9 additions & 9 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ 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

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
18 changes: 9 additions & 9 deletions .github/workflows/pr-new-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- reopened
- synchronize
paths:
- 'src/envs/**'
- 'envs/**'

permissions:
contents: read
Expand Down Expand Up @@ -46,24 +46,24 @@ jobs:
run: |
set -euo pipefail
if [ ! -d base/src/envs ]; then
echo "Base repository missing src/envs directory."
if [ ! -d base/envs ]; then
echo "Base repository missing envs directory."
echo "has_new_envs=false" >> "$GITHUB_OUTPUT"
echo "new_envs=" >> "$GITHUB_OUTPUT"
echo "new_envs_json=[]" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ ! -d pr/src/envs ]; then
echo "PR repository missing src/envs directory."
if [ ! -d pr/envs ]; then
echo "PR repository missing envs directory."
echo "has_new_envs=false" >> "$GITHUB_OUTPUT"
echo "new_envs=" >> "$GITHUB_OUTPUT"
echo "new_envs_json=[]" >> "$GITHUB_OUTPUT"
exit 0
fi
mapfile -t BASE_ENVS < <(cd base/src/envs && find . -maxdepth 1 -mindepth 1 -type d | sed 's|^\./||' | sort)
mapfile -t PR_ENVS < <(cd pr/src/envs && find . -maxdepth 1 -mindepth 1 -type d | sed 's|^\./||' | sort)
mapfile -t BASE_ENVS < <(cd base/envs && find . -maxdepth 1 -mindepth 1 -type d | sed 's|^\./||' | sort)
mapfile -t PR_ENVS < <(cd pr/envs && find . -maxdepth 1 -mindepth 1 -type d | sed 's|^\./||' | sort)
declare -A BASE_SET=()
for env in "${BASE_ENVS[@]}"; do
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
shell: bash
run: |
set -u -o pipefail
env_dir="src/envs/${{ matrix.environment }}"
env_dir="envs/${{ matrix.environment }}"
if [ ! -d "$env_dir" ]; then
echo "Environment directory not found: $env_dir" >&2
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
? 'Your env passes the vibe check. However, most environments should go straight to the hub, they will automatically be added to the official Env Hub collection on a nightly basis. Environments in the official specification repo are only meant to demonstrate usage of a specific spec feature for educational purposes. Re-run locally with:'
: 'Validation reported issues. Review the log and re-run locally with `openenv validate --verbose`. Please note, we recently changed the standard template, your environment might pre-date this standard, follow the conversion guide https://github.com/meta-pytorch/OpenEnv/blob/main/scripts/CONVERT.md to convert your environment to the new standard.';
const envDir = 'src/envs/' + envName;
const envDir = 'envs/' + envName;
const rawLog = process.env.VALIDATION_LOG || '';
const trimmedLog = rawLog.trim();
const maxLength = 6000;
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) **← Try the Interactive Tutorial!**

Expand Down Expand Up @@ -82,7 +82,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 @@ -175,7 +175,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 @@ -275,7 +275,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 @@ -284,7 +284,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/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
Loading