Your First Environment#
Note
Coming Soon — this page will contain a streamlined guide to building your first OpenEnv environment. For now, see the full environment builder guide.
Overview#
Building an OpenEnv environment involves:
Define your models - Action, Observation, and State types
Implement the environment - Core logic in a Python class
Create the server - FastAPI wrapper for HTTP access
Package for deployment - Docker container and manifest
Quick Example#
Here’s a minimal environment that echoes back messages:
from pydantic import BaseModel
from openenv.core import Environment
class EchoAction(BaseModel):
message: str
class EchoObservation(BaseModel):
echo: str
class EchoState(BaseModel):
last_message: str = ""
class EchoEnvironment(Environment[EchoAction, EchoObservation, EchoState]):
def reset(self) -> EchoObservation:
self.state = EchoState()
return EchoObservation(echo="Ready!")
def step(self, action: EchoAction) -> tuple[EchoObservation, float, bool]:
self.state.last_message = action.message
return EchoObservation(echo=action.message), 0.0, False
Next Steps#
Environment Anatomy - Deep dive into structure
Deployment - Deploy to Docker and HF Spaces
Full Guide - Complete documentation