openenv 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {openenv-0.2.0/src/openenv.egg-info → openenv-0.2.1}/PKG-INFO +91 -31
  2. {openenv-0.2.0 → openenv-0.2.1}/README.md +89 -30
  3. {openenv-0.2.0 → openenv-0.2.1}/pyproject.toml +10 -1
  4. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/__init__.py +4 -1
  5. openenv-0.2.1/src/openenv/auto/__init__.py +39 -0
  6. openenv-0.2.1/src/openenv/auto/_discovery.py +584 -0
  7. openenv-0.2.1/src/openenv/auto/auto_action.py +276 -0
  8. openenv-0.2.1/src/openenv/auto/auto_env.py +886 -0
  9. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/_validation.py +6 -4
  10. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/commands/build.py +11 -3
  11. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/commands/serve.py +94 -94
  12. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/__init__.py +9 -3
  13. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/containers/runtime/providers.py +8 -2
  14. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_client.py +28 -5
  15. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/__init__.py +25 -0
  16. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/exceptions.py +105 -105
  17. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/http_server.py +1076 -935
  18. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/interfaces.py +194 -194
  19. openenv-0.2.1/src/openenv/core/env_server/mcp_environment.py +386 -0
  20. openenv-0.2.1/src/openenv/core/env_server/mcp_types.py +166 -0
  21. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/route_config.py +57 -57
  22. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/serialization.py +137 -137
  23. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/types.py +2 -0
  24. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/web_interface.py +193 -156
  25. openenv-0.2.1/src/openenv/core/generic_client.py +167 -0
  26. openenv-0.2.1/src/openenv/core/mcp_client.py +292 -0
  27. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/utils.py +27 -27
  28. {openenv-0.2.0 → openenv-0.2.1/src/openenv.egg-info}/PKG-INFO +91 -31
  29. {openenv-0.2.0 → openenv-0.2.1}/src/openenv.egg-info/SOURCES.txt +10 -1
  30. {openenv-0.2.0 → openenv-0.2.1}/src/openenv.egg-info/requires.txt +1 -0
  31. {openenv-0.2.0 → openenv-0.2.1}/src/openenv_core/__init__.py +1 -1
  32. openenv-0.2.1/tests/test_line_endings.py +207 -0
  33. {openenv-0.2.0 → openenv-0.2.1}/LICENSE +0 -0
  34. {openenv-0.2.0 → openenv-0.2.1}/setup.cfg +0 -0
  35. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/__init__.py +0 -0
  36. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/__main__.py +0 -0
  37. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/_cli_utils.py +0 -0
  38. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/commands/__init__.py +0 -0
  39. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/commands/init.py +0 -0
  40. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/commands/push.py +0 -0
  41. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/commands/validate.py +0 -0
  42. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/__init__.py +0 -0
  43. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/README.md +0 -0
  44. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/__init__.py +0 -0
  45. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/client.py +0 -0
  46. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/models.py +0 -0
  47. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/openenv.yaml +0 -0
  48. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/pyproject.toml +0 -0
  49. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/server/Dockerfile +0 -0
  50. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/server/__ENV_NAME___environment.py +0 -0
  51. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/server/__init__.py +0 -0
  52. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/server/app.py +0 -0
  53. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/cli/templates/openenv_env/server/requirements.txt +0 -0
  54. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/client_types.py +0 -0
  55. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/containers/__init__.py +0 -0
  56. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/containers/runtime/__init__.py +0 -0
  57. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/containers/runtime/uv_provider.py +0 -0
  58. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/containers/test_local_docker_provider.py +0 -0
  59. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/env_server/base_transforms.py +0 -0
  60. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/tools/__init__.py +0 -0
  61. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/tools/git_server_client.py +0 -0
  62. {openenv-0.2.0 → openenv-0.2.1}/src/openenv/core/tools/local_python_executor.py +0 -0
  63. {openenv-0.2.0 → openenv-0.2.1}/src/openenv.egg-info/dependency_links.txt +0 -0
  64. {openenv-0.2.0 → openenv-0.2.1}/src/openenv.egg-info/entry_points.txt +0 -0
  65. {openenv-0.2.0 → openenv-0.2.1}/src/openenv.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openenv
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A unified framework for reinforcement learning environments
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -17,6 +17,7 @@ Requires-Dist: openai>=2.7.2
17
17
  Requires-Dist: tomli>=2.3.0
18
18
  Requires-Dist: tomli-w>=1.2.0
19
19
  Requires-Dist: websockets>=15.0.1
20
+ Requires-Dist: fastmcp>=2.0.0
20
21
  Provides-Extra: core
21
22
  Requires-Dist: fastapi>=0.104.0; extra == "core"
22
23
  Requires-Dist: pydantic>=2.0.0; extra == "core"
@@ -49,10 +50,49 @@ An e2e framework for creating, deploying and using isolated execution environmen
49
50
 
50
51
  **🚀 Featured Example:** Train LLMs to play BlackJack using [torchforge](https://github.com/meta-pytorch/torchforge) (PyTorch's agentic RL framework): [`examples/grpo_blackjack/`](examples/grpo_blackjack/)
51
52
 
53
+ **🔥 GPU Mode Tutorial:** End to end tutorial from [GPU Mode](gpu-mode-tutorial/README.md) blog post.
54
+
55
+ ## Quick Start
56
+
57
+ Install the OpenEnv core package:
58
+
59
+ ```bash
60
+ pip install openenv
61
+ ```
62
+
63
+ Install an environment client (e.g., Echo):
64
+
65
+ ```bash
66
+ pip install git+https://huggingface.co/spaces/openenv/echo_env
67
+ ```
68
+
69
+ Then use the environment:
70
+
71
+ ```python
72
+ from echo_env import EchoAction, EchoEnv
73
+
74
+ # Connect to a running Space
75
+ client = EchoEnv(base_url="https://openenv-echo-env.hf.space")
76
+
77
+ # Reset the environment
78
+ result = client.reset()
79
+ print(result.observation.echoed_message) # "Echo environment ready!"
80
+
81
+ # Send messages
82
+ result = client.step(EchoAction(message="Hello, World!"))
83
+ print(result.observation.echoed_message) # "Hello, World!"
84
+ print(result.reward) # 1.3 (based on message length)
85
+
86
+ # Cleanup
87
+ client.close()
88
+ ```
89
+
90
+ For a detailed quick start, check out the [docs page](https://meta-pytorch.org/OpenEnv/quickstart/).
91
+
52
92
  ## OpenEnv on partner platforms:
53
93
 
54
94
  - [Lightning AI Studio](https://lightning.ai/environments?section=featured)
55
- - [TRL example](https://huggingface.co/docs/trl/main/en/openenv)
95
+ - [TRL example](https://huggingface.co/docs/trl/openenv)
56
96
  - [Unsloth Google Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb)
57
97
  - [ART example](https://art.openpipe.ai/integrations/openenv-integration)
58
98
  - [Oumi example](https://github.com/oumi-ai/oumi/blob/main/notebooks/Oumi%20-%20OpenEnv%20GRPO%20with%20trl.ipynb)
@@ -87,10 +127,10 @@ Below is a list of active and historical RFCs for OpenEnv. RFCs are proposals fo
87
127
  │ Client Application │
88
128
  │ ┌────────────────┐ ┌──────────────────┐ │
89
129
  │ │ EchoEnv │ │ CodingEnv │ │
90
- │ │ (HTTPEnvClient)│ │ (HTTPEnvClient) │ │
130
+ │ │ (EnvClient) │ │ (EnvClient) │ │
91
131
  │ └────────┬───────┘ └────────┬─────────┘ │
92
132
  └───────────┼───────────────────────────────┼─────────────┘
93
- │ HTTP │ HTTP
133
+ │ WebSocket │ WebSocket
94
134
  │ (reset, step, state) │
95
135
  ┌───────────▼───────────────────────────────▼─────────────┐
96
136
  │ Docker Containers (Isolated) │
@@ -137,9 +177,9 @@ Base class for implementing environment logic:
137
177
  - **`step(action)`**: Execute an `Action`, returns resulting `Observation`
138
178
  - **`state()`**: Access episode metadata (`State` with episode_id, step_count, etc.)
139
179
 
140
- #### 3. HTTPEnvClient (Client-Side)
141
- Base class for HTTP communication:
142
- - Handles HTTP requests to environment server
180
+ #### 3. EnvClient (Client-Side)
181
+ Base class for environment communication:
182
+ - Handles WebSocket connections to environment server
143
183
  - Contains a utility to spin up a docker container locally for the corresponding environment
144
184
  - Type-safe action/observation parsing
145
185
 
@@ -172,7 +212,7 @@ my_env/
172
212
  ├── .dockerignore # Docker build exclusions
173
213
  ├── __init__.py # Export YourAction, YourObservation, YourEnv
174
214
  ├── models.py # Define Action, Observation, State dataclasses
175
- ├── client.py # Implement YourEnv(HTTPEnvClient)
215
+ ├── client.py # Implement YourEnv(EnvClient)
176
216
  ├── README.md # Document your environment
177
217
  ├── openenv.yaml # Environment manifest
178
218
  ├── pyproject.toml # Dependencies and package configuration
@@ -219,10 +259,11 @@ See [`envs/README.md`](envs/README.md) for a complete guide on building environm
219
259
  ### For Environment Users
220
260
 
221
261
  To use an environment:
222
- 1. Import from `envs.your_env`: `from envs.echo_env import EchoAction, EchoEnv`
223
- 2. Create client: `client = EchoEnv.from_docker_image("echo-env:latest")`
224
- 3. Interact: `client.reset()`, `client.step(action)`, `client.state()`
225
- 4. Cleanup: `client.close()`
262
+ 1. Install the client: `pip install git+https://huggingface.co/spaces/openenv/echo-env`
263
+ 2. Import: `from echo_env import EchoAction, EchoEnv`
264
+ 3. Create client: `client = EchoEnv(base_url="https://openenv-echo-env.hf.space")`
265
+ 4. Interact: `client.reset()`, `client.step(action)`, `client.state()`
266
+ 5. Cleanup: `client.close()`
226
267
 
227
268
  See example scripts in `examples/` directory.
228
269
 
@@ -253,37 +294,56 @@ For detailed options: `openenv init --help` and `openenv push --help`.
253
294
  3. **Container Isolation**: Each environment runs in its own container
254
295
  4. **Simple APIs**: Minimal, intuitive interfaces
255
296
 
256
- ## Quick Start
297
+ ## Development
257
298
 
258
- ### Using the Echo Environment(Example)
299
+ ### Installation
259
300
 
260
- ```python
261
- from envs.echo_env import EchoAction, EchoEnv
301
+ ```bash
302
+ # Clone the repository
303
+ git clone https://github.com/meta-pytorch/OpenEnv.git
304
+ cd OpenEnv
262
305
 
263
- # Automatically start container and connect
264
- client = EchoEnv.from_docker_image("echo-env:latest")
306
+ # Install core package in editable mode
307
+ pip install -e .
308
+ # Or using uv (faster)
309
+ uv pip install -e .
310
+ ```
265
311
 
266
- # Reset the environment
267
- result = client.reset()
268
- print(result.observation.echoed_message) # "Echo environment ready!"
312
+ ### Running Tests
269
313
 
270
- # Send messages
271
- result = client.step(EchoAction(message="Hello, World!"))
272
- print(result.observation.echoed_message) # "Hello, World!"
273
- print(result.reward) # 1.3 (based on message length)
314
+ OpenEnv uses a modular dependency structure: the core package is minimal, and each environment has its own dependencies. This means some tests require environment-specific packages.
274
315
 
275
- # Cleanup
276
- client.close() # Stops and removes container
316
+ ```bash
317
+ # Install pytest (required for running tests)
318
+ uv pip install pytest
319
+
320
+ # Run all tests (skips tests requiring uninstalled dependencies)
321
+ PYTHONPATH=src:envs uv run pytest tests/ -v --tb=short
322
+
323
+ # Run a specific test file
324
+ PYTHONPATH=src:envs uv run pytest tests/envs/test_echo_environment.py -v
277
325
  ```
278
326
 
327
+ **To run environment-specific tests**, install that environment's dependencies:
328
+
329
+ ```bash
330
+ # Example: Install coding_env with dev dependencies (includes smolagents + pytest)
331
+ uv pip install -e "envs/coding_env[dev]"
332
+
333
+ # Then run coding_env tests
334
+ PYTHONPATH=src:envs uv run pytest tests/envs/test_python_codeact_rewards.py -v
335
+ ```
336
+
337
+ Tests will be automatically skipped if their required dependencies aren't installed.
338
+
279
339
  ## Requirements
280
340
 
281
- - Python 3.11+
341
+ - Python 3.10+
282
342
  - Docker Desktop or Docker Engine
283
343
  - FastAPI >= 0.104.0
284
344
  - Uvicorn >= 0.24.0
285
345
  - Requests >= 2.25.0
286
- - smolagents (for coding environment)
346
+ - Environment-specific dependencies (e.g., smolagents for coding_env)
287
347
 
288
348
  ## Supported RL Tools
289
349
  The goal of this project is to support a broad set of open and closed tools to help standardize the agentic RL community. If you have a project that supports OpenEnv environments, please put up a PR to add your tool name along with a link to your documentation.
@@ -292,7 +352,7 @@ The goal of this project is to support a broad set of open and closed tools to h
292
352
  See GRPO BlackJack training example: [`examples/grpo_blackjack/`](examples/grpo_blackjack/)
293
353
 
294
354
  ### TRL
295
- See the [TRL example](https://huggingface.co/docs/trl/main/en/openenv) on how to integrate OpenEnv environments with GRPO training.
355
+ See the [TRL example](https://huggingface.co/docs/trl/openenv) on how to integrate OpenEnv environments with GRPO training.
296
356
 
297
357
  ### Unsloth
298
358
  See the 2048 game example based on gpt-oss: [Colab notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb)
@@ -328,7 +388,7 @@ See: [`envs/coding_env/README.md`](envs/coding_env/README.md)
328
388
  ## Community Support & Acknowledgments
329
389
  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!!
330
390
 
331
- Supporters include: Meta-PyTorch, Hugging Face, [Patronus AI](https://patronus.ai), [Surge AI](https://surgehq.ai), [LastMile AI](https://www.lastmileai.dev), Unsloth AI, Reflection AI, vLLM, SkyRL (UC-Berkeley), LightningAI, Axolotl AI, Stanford Scaling Intelligence Lab, Mithril, [OpenMined](https://openmined.org/), [Fleet AI](https://fleetai.com), [Halluminate](https://halluminate.ai/), [Turing](https://www.turing.com/) ..
391
+ Supporters include: Meta-PyTorch, Hugging Face, [Scaler AI Labs](https://scalerailabs.com), [Patronus AI](https://patronus.ai), [Surge AI](https://surgehq.ai), [LastMile AI](https://www.lastmileai.dev), Unsloth AI, Reflection AI, vLLM, SkyRL (UC-Berkeley), LightningAI, Axolotl AI, Stanford Scaling Intelligence Lab, Mithril, [OpenMined](https://openmined.org/), [Fleet AI](https://fleetai.com), [Halluminate](https://halluminate.ai/), [Turing](https://www.turing.com/), [Scale AI](https://scale.com/) ..
332
392
 
333
393
  And we'd also like to acknowledge the team at Farama Foundation as the OpenEnv API was heavily inspired by the work you all have done on Gymnasium. Cheers!
334
394
 
@@ -11,10 +11,49 @@ An e2e framework for creating, deploying and using isolated execution environmen
11
11
 
12
12
  **🚀 Featured Example:** Train LLMs to play BlackJack using [torchforge](https://github.com/meta-pytorch/torchforge) (PyTorch's agentic RL framework): [`examples/grpo_blackjack/`](examples/grpo_blackjack/)
13
13
 
14
+ **🔥 GPU Mode Tutorial:** End to end tutorial from [GPU Mode](gpu-mode-tutorial/README.md) blog post.
15
+
16
+ ## Quick Start
17
+
18
+ Install the OpenEnv core package:
19
+
20
+ ```bash
21
+ pip install openenv
22
+ ```
23
+
24
+ Install an environment client (e.g., Echo):
25
+
26
+ ```bash
27
+ pip install git+https://huggingface.co/spaces/openenv/echo_env
28
+ ```
29
+
30
+ Then use the environment:
31
+
32
+ ```python
33
+ from echo_env import EchoAction, EchoEnv
34
+
35
+ # Connect to a running Space
36
+ client = EchoEnv(base_url="https://openenv-echo-env.hf.space")
37
+
38
+ # Reset the environment
39
+ result = client.reset()
40
+ print(result.observation.echoed_message) # "Echo environment ready!"
41
+
42
+ # Send messages
43
+ result = client.step(EchoAction(message="Hello, World!"))
44
+ print(result.observation.echoed_message) # "Hello, World!"
45
+ print(result.reward) # 1.3 (based on message length)
46
+
47
+ # Cleanup
48
+ client.close()
49
+ ```
50
+
51
+ For a detailed quick start, check out the [docs page](https://meta-pytorch.org/OpenEnv/quickstart/).
52
+
14
53
  ## OpenEnv on partner platforms:
15
54
 
16
55
  - [Lightning AI Studio](https://lightning.ai/environments?section=featured)
17
- - [TRL example](https://huggingface.co/docs/trl/main/en/openenv)
56
+ - [TRL example](https://huggingface.co/docs/trl/openenv)
18
57
  - [Unsloth Google Colab](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb)
19
58
  - [ART example](https://art.openpipe.ai/integrations/openenv-integration)
20
59
  - [Oumi example](https://github.com/oumi-ai/oumi/blob/main/notebooks/Oumi%20-%20OpenEnv%20GRPO%20with%20trl.ipynb)
@@ -49,10 +88,10 @@ Below is a list of active and historical RFCs for OpenEnv. RFCs are proposals fo
49
88
  │ Client Application │
50
89
  │ ┌────────────────┐ ┌──────────────────┐ │
51
90
  │ │ EchoEnv │ │ CodingEnv │ │
52
- │ │ (HTTPEnvClient)│ │ (HTTPEnvClient) │ │
91
+ │ │ (EnvClient) │ │ (EnvClient) │ │
53
92
  │ └────────┬───────┘ └────────┬─────────┘ │
54
93
  └───────────┼───────────────────────────────┼─────────────┘
55
- │ HTTP │ HTTP
94
+ │ WebSocket │ WebSocket
56
95
  │ (reset, step, state) │
57
96
  ┌───────────▼───────────────────────────────▼─────────────┐
58
97
  │ Docker Containers (Isolated) │
@@ -99,9 +138,9 @@ Base class for implementing environment logic:
99
138
  - **`step(action)`**: Execute an `Action`, returns resulting `Observation`
100
139
  - **`state()`**: Access episode metadata (`State` with episode_id, step_count, etc.)
101
140
 
102
- #### 3. HTTPEnvClient (Client-Side)
103
- Base class for HTTP communication:
104
- - Handles HTTP requests to environment server
141
+ #### 3. EnvClient (Client-Side)
142
+ Base class for environment communication:
143
+ - Handles WebSocket connections to environment server
105
144
  - Contains a utility to spin up a docker container locally for the corresponding environment
106
145
  - Type-safe action/observation parsing
107
146
 
@@ -134,7 +173,7 @@ my_env/
134
173
  ├── .dockerignore # Docker build exclusions
135
174
  ├── __init__.py # Export YourAction, YourObservation, YourEnv
136
175
  ├── models.py # Define Action, Observation, State dataclasses
137
- ├── client.py # Implement YourEnv(HTTPEnvClient)
176
+ ├── client.py # Implement YourEnv(EnvClient)
138
177
  ├── README.md # Document your environment
139
178
  ├── openenv.yaml # Environment manifest
140
179
  ├── pyproject.toml # Dependencies and package configuration
@@ -181,10 +220,11 @@ See [`envs/README.md`](envs/README.md) for a complete guide on building environm
181
220
  ### For Environment Users
182
221
 
183
222
  To use an environment:
184
- 1. Import from `envs.your_env`: `from envs.echo_env import EchoAction, EchoEnv`
185
- 2. Create client: `client = EchoEnv.from_docker_image("echo-env:latest")`
186
- 3. Interact: `client.reset()`, `client.step(action)`, `client.state()`
187
- 4. Cleanup: `client.close()`
223
+ 1. Install the client: `pip install git+https://huggingface.co/spaces/openenv/echo-env`
224
+ 2. Import: `from echo_env import EchoAction, EchoEnv`
225
+ 3. Create client: `client = EchoEnv(base_url="https://openenv-echo-env.hf.space")`
226
+ 4. Interact: `client.reset()`, `client.step(action)`, `client.state()`
227
+ 5. Cleanup: `client.close()`
188
228
 
189
229
  See example scripts in `examples/` directory.
190
230
 
@@ -215,37 +255,56 @@ For detailed options: `openenv init --help` and `openenv push --help`.
215
255
  3. **Container Isolation**: Each environment runs in its own container
216
256
  4. **Simple APIs**: Minimal, intuitive interfaces
217
257
 
218
- ## Quick Start
258
+ ## Development
219
259
 
220
- ### Using the Echo Environment(Example)
260
+ ### Installation
221
261
 
222
- ```python
223
- from envs.echo_env import EchoAction, EchoEnv
262
+ ```bash
263
+ # Clone the repository
264
+ git clone https://github.com/meta-pytorch/OpenEnv.git
265
+ cd OpenEnv
224
266
 
225
- # Automatically start container and connect
226
- client = EchoEnv.from_docker_image("echo-env:latest")
267
+ # Install core package in editable mode
268
+ pip install -e .
269
+ # Or using uv (faster)
270
+ uv pip install -e .
271
+ ```
227
272
 
228
- # Reset the environment
229
- result = client.reset()
230
- print(result.observation.echoed_message) # "Echo environment ready!"
273
+ ### Running Tests
231
274
 
232
- # Send messages
233
- result = client.step(EchoAction(message="Hello, World!"))
234
- print(result.observation.echoed_message) # "Hello, World!"
235
- print(result.reward) # 1.3 (based on message length)
275
+ OpenEnv uses a modular dependency structure: the core package is minimal, and each environment has its own dependencies. This means some tests require environment-specific packages.
236
276
 
237
- # Cleanup
238
- client.close() # Stops and removes container
277
+ ```bash
278
+ # Install pytest (required for running tests)
279
+ uv pip install pytest
280
+
281
+ # Run all tests (skips tests requiring uninstalled dependencies)
282
+ PYTHONPATH=src:envs uv run pytest tests/ -v --tb=short
283
+
284
+ # Run a specific test file
285
+ PYTHONPATH=src:envs uv run pytest tests/envs/test_echo_environment.py -v
239
286
  ```
240
287
 
288
+ **To run environment-specific tests**, install that environment's dependencies:
289
+
290
+ ```bash
291
+ # Example: Install coding_env with dev dependencies (includes smolagents + pytest)
292
+ uv pip install -e "envs/coding_env[dev]"
293
+
294
+ # Then run coding_env tests
295
+ PYTHONPATH=src:envs uv run pytest tests/envs/test_python_codeact_rewards.py -v
296
+ ```
297
+
298
+ Tests will be automatically skipped if their required dependencies aren't installed.
299
+
241
300
  ## Requirements
242
301
 
243
- - Python 3.11+
302
+ - Python 3.10+
244
303
  - Docker Desktop or Docker Engine
245
304
  - FastAPI >= 0.104.0
246
305
  - Uvicorn >= 0.24.0
247
306
  - Requests >= 2.25.0
248
- - smolagents (for coding environment)
307
+ - Environment-specific dependencies (e.g., smolagents for coding_env)
249
308
 
250
309
  ## Supported RL Tools
251
310
  The goal of this project is to support a broad set of open and closed tools to help standardize the agentic RL community. If you have a project that supports OpenEnv environments, please put up a PR to add your tool name along with a link to your documentation.
@@ -254,7 +313,7 @@ The goal of this project is to support a broad set of open and closed tools to h
254
313
  See GRPO BlackJack training example: [`examples/grpo_blackjack/`](examples/grpo_blackjack/)
255
314
 
256
315
  ### TRL
257
- See the [TRL example](https://huggingface.co/docs/trl/main/en/openenv) on how to integrate OpenEnv environments with GRPO training.
316
+ See the [TRL example](https://huggingface.co/docs/trl/openenv) on how to integrate OpenEnv environments with GRPO training.
258
317
 
259
318
  ### Unsloth
260
319
  See the 2048 game example based on gpt-oss: [Colab notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb)
@@ -290,7 +349,7 @@ See: [`envs/coding_env/README.md`](envs/coding_env/README.md)
290
349
  ## Community Support & Acknowledgments
291
350
  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!!
292
351
 
293
- Supporters include: Meta-PyTorch, Hugging Face, [Patronus AI](https://patronus.ai), [Surge AI](https://surgehq.ai), [LastMile AI](https://www.lastmileai.dev), Unsloth AI, Reflection AI, vLLM, SkyRL (UC-Berkeley), LightningAI, Axolotl AI, Stanford Scaling Intelligence Lab, Mithril, [OpenMined](https://openmined.org/), [Fleet AI](https://fleetai.com), [Halluminate](https://halluminate.ai/), [Turing](https://www.turing.com/) ..
352
+ Supporters include: Meta-PyTorch, Hugging Face, [Scaler AI Labs](https://scalerailabs.com), [Patronus AI](https://patronus.ai), [Surge AI](https://surgehq.ai), [LastMile AI](https://www.lastmileai.dev), Unsloth AI, Reflection AI, vLLM, SkyRL (UC-Berkeley), LightningAI, Axolotl AI, Stanford Scaling Intelligence Lab, Mithril, [OpenMined](https://openmined.org/), [Fleet AI](https://fleetai.com), [Halluminate](https://halluminate.ai/), [Turing](https://www.turing.com/), [Scale AI](https://scale.com/) ..
294
353
 
295
354
  And we'd also like to acknowledge the team at Farama Foundation as the OpenEnv API was heavily inspired by the work you all have done on Gymnasium. Cheers!
296
355
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "openenv"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "A unified framework for reinforcement learning environments"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -25,6 +25,8 @@ dependencies = [
25
25
  "tomli>=2.3.0",
26
26
  "tomli-w>=1.2.0",
27
27
  "websockets>=15.0.1",
28
+ # MCP support
29
+ "fastmcp>=2.0.0",
28
30
  ]
29
31
 
30
32
  [project.optional-dependencies]
@@ -78,3 +80,10 @@ exclude_lines = [
78
80
  "if __name__ == .__main__.:",
79
81
  "if TYPE_CHECKING:",
80
82
  ]
83
+
84
+ [tool.pytest.ini_options]
85
+ markers = [
86
+ "docker: Tests that require Docker to be running",
87
+ "network: Tests that require network access (HuggingFace, etc.)",
88
+ "integration: Integration tests with external resources",
89
+ ]
@@ -4,7 +4,10 @@ Unified OpenEnv package bundling the CLI and core runtime.
4
4
 
5
5
  from importlib import metadata
6
6
 
7
- __all__ = ["core", "cli"]
7
+ from .auto import AutoAction, AutoEnv
8
+ from .core import GenericEnvClient, GenericAction
9
+
10
+ __all__ = ["core", "cli", "AutoEnv", "AutoAction", "GenericEnvClient", "GenericAction"]
8
11
 
9
12
  try:
10
13
  __version__ = metadata.version("openenv") # type: ignore[arg-type]
@@ -0,0 +1,39 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ """
8
+ OpenEnv Auto Module
9
+ ===================
10
+
11
+ Provides HuggingFace-style auto-discovery API for OpenEnv environments.
12
+
13
+ This module enables automatic environment and action class loading without
14
+ manual imports:
15
+
16
+ >>> from openenv import AutoEnv, AutoAction
17
+ >>>
18
+ >>> # Load environment from installed package or HuggingFace Hub
19
+ >>> env = AutoEnv.from_name("coding-env")
20
+ >>>
21
+ >>> # Get action class
22
+ >>> CodeAction = AutoAction.from_name("coding")
23
+ >>> action = CodeAction(code="print('Hello!')")
24
+
25
+ Classes:
26
+ AutoEnv: Automatic environment client selection and instantiation
27
+ AutoAction: Automatic action class selection
28
+
29
+ The auto-discovery system works by:
30
+ 1. Discovering installed openenv-* packages via importlib.metadata
31
+ 2. Loading environment manifests (openenv.yaml) from package resources
32
+ 3. Supporting HuggingFace Hub repositories for remote environments
33
+ 4. Caching discovery results for performance
34
+ """
35
+
36
+ from .auto_action import AutoAction
37
+ from .auto_env import AutoEnv
38
+
39
+ __all__ = ["AutoEnv", "AutoAction"]