File size: 3,953 Bytes
73602ec
 
1e9ae09
73602ec
2f5702c
9832af6
fbd053c
 
 
 
 
522b79d
a637d38
324635d
522b79d
4268103
 
324635d
ba02a58
 
4268103
fbd053c
a637d38
fbd053c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a637d38
fbd053c
 
c06b6e2
 
 
 
da7a4c5
441541d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
license: apache-2.0
sdk: static
---

# OpenEnv: Agentic Execution Environments

[![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)
[![Docs](https://img.shields.io/badge/Docs-Explore-blue?logo=readthedocs&logoColor=white)](https://meta-pytorch.org/OpenEnv/)

An e2e framework for creating, deploying and using isolated execution environments for agentic RL training, built using Gymnasium style simple APIs. A community driven collection of OpenEnv-spec Environments composed of a **Hub** and a **Standardized spec** to ensure environment compatibility. 

<a href="https://rdi.berkeley.edu/agentx-agentbeats.html" style="text-decoration: none; color: inherit; width: 100%; height: 120px; margin-bottom: 10px; margin-top: 10px;">
      <div style="padding: 5px; padding-left: 20px; border-radius: 8px; background-color: whitesmoke; color: black; box-shadow: 1px 1px 3px rgba(0,0,0,0.1); border: 2px solid #3498db; height: 100%; transition: all 0.3s ease;" onmouseover="this.style.transform='scale(1.02)'; this.style.boxShadow='2px 2px 8px rgba(0,0,0,0.2)'; this.style.backgroundImage='linear-gradient(to bottom, #d6f0ff, #b8daff)';" onmouseout="this.style.transform='scale(1)'; this.style.boxShadow='1px 1px 3px rgba(0,0,0,0.1)'; this.style.backgroundImage='linear-gradient(to bottom, #e6f7ff, #cce5ff)';">
<p> Join the Hackathon! </p>
<p>Additionally, we’re thrilled to announce a new AgentBeats custom track: the <strong><a href="https://drive.google.com/file/d/1NASall4R84xAhoDdcaMwwJ78Ao3B-EK4/view?usp=sharing" rel="">OpenEnv Challenge: SOTA Environments to Drive General Intelligence</a></strong>, sponsored by the <a href="https://pytorch.org/" rel="">PyTorch</a> team at <a href="https://www.meta.com/" rel="">Meta</a>, <a href="https://huggingface.co/" rel="">Hugging Face</a>, and <a href="https://unsloth.ai/" rel="">Unsloth</a>. Participants will compete to develop innovative, open-source RL environments that push the frontiers of agent learning, with a prize pool of <strong>$10K in Hugging Face credits</strong>, and the chance to be published on the <a href="https://pytorch.org/blog/" rel="">PyTorch blog</a></p>
<a href="https://rdi.berkeley.edu/agentx-agentbeats.html">Sign up here</a>
</div>
</a>

## Quick Start

You can install Hugging Face spaces for client code:

```bash
pip install git+https://huggingface.co/spaces/openenv/echo_env
```

Then use the environment hosted on spaces:

```python
import asyncio
from echo_env import EchoAction, EchoEnv

async def main():
    # Connect to a running Space (async context manager)
    async with EchoEnv(base_url="https://openenv-echo-env.hf.space") as client:
        # Reset the environment
        result = await client.reset()
        print(result.observation.echoed_message)  # "Echo environment ready!"

        # Send messages
        result = await client.step(EchoAction(message="Hello, World!"))
        print(result.observation.echoed_message)  # "Hello, World!"
        print(result.reward)  # 1.3 (based on message length)

asyncio.run(main())
```

To pull the environments locally from Spaces as docker containers, you can do this:

```python
import asyncio
from echo_env import EchoEnv

async def main():
    # Pulls from Hugging Face and starts a container
    client = await EchoEnv.from_env("openenv/echo_env")
    async with client:
        result = await client.reset()
        print(result.observation)

asyncio.run(main())
``` 

## Hugging Face x Meta-PyTorch

Hugging Face, Meta-PyTorch and many other [supporters](https://github.com/meta-pytorch/OpenEnv?tab=readme-ov-file#community-support--acknowledgments) are committed to democratizing RL post training with environmnets. 

![Sponsor Logos](https://huggingface.co/spaces/openenv/README/resolve/main/openenv-sponsors.png)