# OpenEnv

> A unified open-source framework for building, deploying, and interacting with isolated execution environments for agentic reinforcement learning, using Gymnasium-style APIs.

OpenEnv is an open-source framework from Hugging Face for creating, deploying, and using isolated execution environments designed for agentic RL training. It provides a standard Gymnasium-style interface—`step()`, `reset()`, and `state()`—that makes it straightforward to integrate with existing RL frameworks. The project is currently in an experimental stage, with active development coordinated through a public technical committee.

## What It Is

OpenEnv sits at the intersection of reinforcement learning infrastructure and agentic AI tooling. Its core job is to standardize how RL agents interact with execution environments—whether those environments involve code generation, web browsing, game playing, or financial simulation. Rather than each RL framework inventing its own environment protocol, OpenEnv provides a shared contract: environments expose HTTP/WebSocket endpoints, agents call familiar `step()` and `reset()` methods, and everything runs inside isolated Docker containers for reproducibility and security.

The framework is governed by a technical committee that the project page lists as including representatives from Meta-PyTorch, Reflection, Unsloth, Modal, Prime Intellect, Nvidia, Mercor, Fleet AI, Microsoft, Hugging Face, and RadixArk.

## Architecture and Core Components

OpenEnv is built around four main layers:

- **Environment (server-side)**: A base class implementing `reset()`, `step(action)`, and `state()`, served via FastAPI over WebSocket inside a Docker container.
- **EnvClient (client-side)**: A base class that handles WebSocket connections to the environment server, with both async (recommended) and sync (`.sync()` wrapper) usage patterns.
- **Container Providers**: Pluggable backends for running containers—`LocalDockerProvider`, `DockerSwarmProvider`, `UVProvider`, `DaytonaProvider`, `ACASandboxProvider`, and a planned `KubernetesProvider`.
- **CLI (`openenv`)**: Commands for scaffolding (`init`), deploying (`push`), serving locally (`serve`), building images (`build`), forking Spaces (`fork`), and validating configurations (`validate`).

The web interface, conditionally enabled via `ENABLE_WEB_INTERFACE=true`, provides a two-pane layout with real-time WebSocket updates, dynamically generated action forms, and a full action history log.

## Pre-Built Environment Library

OpenEnv ships with several ready-to-use environments:

- **Echo Environment** — Echoes messages with metadata; useful for testing infrastructure and learning the framework.
- **Coding Environment** — Sandboxed Python code execution via smolagents, capturing stdout/stderr/exit codes with persistent episode context.
- **Chess Environment** — Full chess rules with configurable opponents for RL training.
- **Atari Environment** — Classic Arcade Learning Environment tasks for RL benchmarking.
- **FinRL Environment** — Financial market simulations for algorithmic trading experiments.

Community environments are browsable at the Hugging Face OpenEnv docs page.

## RL Framework Integrations

OpenEnv is designed to plug into a growing ecosystem of RL training frameworks:

- **TRL** — GRPO training integration documented in the TRL docs.
- **torchforge** (Meta-PyTorch) — Featured BlackJack GRPO training example.
- **Unsloth** — 2048 game training example via Colab notebook.
- **SkyRL** (UC Berkeley) — Documented integration for training on OpenEnv environments.
- **ART** (OpenPipe) — Integration for model training with ART.
- **Oumi** — GRPO with TRL notebook.
- **Lightning AI** — Featured templates.

## Update: v0.3.1

The latest release is v0.3.1, published on June 2, 2026. The repository shows active development with 2,376 stars and 403 forks as of late June 2026. Active RFCs include support for MCP (Model Context Protocol) environments, delayed rewards for trajectory-based scoring, agentic harness integration, and an env-token world modeling proposal (ECHO). The project explicitly notes it is in an experimental stage and that APIs may change in future versions.

## Features
- Gymnasium-style step(), reset(), state() APIs
- Container-first design with Docker packaging
- HTTP/WebSocket-native environment serving
- Secure sandboxed execution for untrusted agent code
- Pre-built environments: Echo, Coding, Chess, Atari, FinRL
- CLI for environment scaffolding, deployment, and management
- Async and sync client APIs
- Built-in web interface for interactive debugging
- MCP (Model Context Protocol) environment support
- Delayed rewards for trajectory-based scoring
- Auto-discovery of environment tools by agents
- Deploy environments to Hugging Face Spaces
- Multiple container providers: Local Docker, Docker Swarm, UV, Daytona, ACA Sandbox
- Type-safe action/observation models via Pydantic
- RL framework integrations: TRL, torchforge, Unsloth, SkyRL, ART, Oumi, Lightning AI

## Integrations
TRL, torchforge (Meta-PyTorch), Unsloth, SkyRL, ART (OpenPipe), Oumi, Lightning AI, Hugging Face Spaces, Docker, FastAPI, smolagents, BrowserGym, Inspect AI, Axolotl AI, SGLang, vLLM

## Platforms
WEB, API, VSC_EXTENSION, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
v0.3.1

## Links
- Website: https://huggingface.co/docs/openenv/index
- Documentation: https://huggingface.co/docs/openenv/index
- Repository: https://github.com/huggingface/OpenEnv
- EveryDev.ai: https://www.everydev.ai/tools/openenv
