environments/, a uv workspace member with its own pyproject.toml. demo is the minimal shape. math is the full worked example.
Package shape
Register the loader as an entry point:splits(), grade(), fingerprint(), and the optional install() and verify_install().
Rules that bite
- Never depend on
monte. Declaringmontein yourpyproject.tomlcycles the uv workspace graph. And the resources server runs in its own venv with nomonteinstalled, so a top-levelimport montecrashes it. Importmontelazily inside functions, never at module top. - The prompt template is yours, and it is frozen. The Environment owns its prompt file, and the prompt bytes are part of the fingerprint. An edit to the prompt is a Measurement change, not a tweak.
- One name, once. A duplicate Environment name across installed packages refuses at discovery. A broken
load_environment()raises a Refusal that names the distribution.
Frozen data
Real task data lives on the durable data root, never in the repo. It is seeded by a manifest-verified copy and never derived on a box. Yourinstall() checks the files against manifest.json and registers the Gym benchmark configs. Install must be idempotent.
The two twins
Two different things get called a twin. Keep them apart:- The Gym row twin: the
*.gym.jsonlfiles, re-derived from the frozen source through the current prompt renderer. These are the rows Gym consumes. - The resources-server plant: your FastAPI grading app plus its configs, copied to a name-derived Gym path. Training and eval both grade through this one server.
Test what you wrote
uv run pytest: thetest_env_*files cover grader and install-hook behavior.gym env test --resources-server <name>exercises the resources server.gym env startplus a POST to/verifychecks the live plant. These are Gym commands, not monte ones.monte env listconfirms discovery.monte env install <name>on the box verifies the data.- A smoke eval against a scratch Measurement closes the loop.
Related pages
Environment
The concept: what an Environment is and guarantees.
Quickstart
See the loop run against the demo Environment.

