Spaces:
Build error
03. Building Environments
Source:
Main idea
This page describes the standard OpenEnv project structure and how to build a custom environment from scratch.
Standard project layout
The docs show a layout like:
my_game/
βββ __init__.py
βββ models.py
βββ client.py
βββ openenv.yaml
βββ README.md
βββ server/
βββ __init__.py
βββ environment.py
βββ app.py
βββ Dockerfile
βββ requirements.txt
Responsibilities by file
models.py
Defines typed:
- actions
- observations
- state-related payloads
This is the contract layer.
client.py
Defines the client used by agents and evaluation scripts.
This should:
- convert actions into payloads
- parse observations from responses
- expose a clean local Python API
server/environment.py
Defines the actual environment logic:
- reset behavior
- step behavior
- state tracking
This is the heart of the environment.
server/app.py
Exposes the environment through FastAPI/OpenEnv.
This is the transport layer, not the logic layer.
server/Dockerfile
Defines how the environment runs reproducibly in a container.
openenv.yaml
Defines the environment manifest and deployment metadata.
Key lesson
The docs separate:
- contracts
- logic
- transport
- packaging
That separation is what makes environments maintainable and deployable.
What this means for python_env
Your repo already follows this pattern reasonably well:
models.pyclient.pyserver/code_review_environment.pyserver/app.pyserver/Dockerfileopenenv.yaml
The main thing to protect is that no single file should try to do everything.
For hackathon quality, this page matters because judges will look for clean structure, not just working behavior.