Skip to the entry
AgenticRLEnvironments.com

How to build environments for training and testing AI agents with RL: state and actions, app clones, task generators, graders, rewards and versioning.

How to version agent environments so runs can be reproduced

At a glance

Version an agent environment as one id that pins everything that can change a reward: code, container image by digest, data, task set, grader and step limit. Bump it whenever any of them changes, record it and the seed with every trajectory, and test that a seed replays to the same state.

Compiled by
First recorded
Last revised
Reading time
7 min

To version an agent environment, give one identifier to the full set of things that decide a reward, pin each of them to an exact copy, and change the identifier whenever any of them changes. Results without that identifier cannot be compared, and training data without it cannot be trusted later.

What has to be versioned in an agent environment?

Everything that can change the reward for the same sequence of actions has to be versioned.

Table: What to pin in an agent environment, and how

ComponentPin it byExample of a change that needs a new version
Environment codeA commit hashA tool now returns more fields
Container imageIts digestA rebuilt image picks up a new library release
DataA hash of the dump or loader plus its seedA generator library update changes names
Task setA hash of the sorted task listTasks added, removed or reworded
GraderA commit hash, and its test setA new assertion on unchanged state
LimitsValues in the registrationmax_episode_steps raised from 30 to 50
ClockThe start date the app seesTasks that say "last week"

How do I name environment versions?

Name them the way Gymnasium does: namespace/Name-vN. Gymnasium's registry documents the id syntax [namespace/](env_name)[-v(version)], with namespace and version optional, and has a find_highest_version() helper that "Finds the highest registered version of the environment given the namespace and name in the registry" (Gymnasium registry API, read 2026-11-26). Its custom environment guide recommends the full form, such as gymnasium_env/GridWorld-v0, for clarity (Gymnasium custom environment guide, read 2026-11-26).

Keep old versions registered. A result reported against -v2 should still be checkable after -v3 ships.

How do I pin and verify an environment in one step?

Build the environment once, run a check you choose against it, and store it under a name derived from its contents only if the check passes. That joins pinning and testing into one step.

On a hosted service, Promigence does this with one command: it builds a snapshot from an image, setup commands and a verify command, and stores the snapshot only when the verify command exits zero, according to its quickstart (read 2026-11-26). The quickstart's command, adapted here to an environment repository pinned at one commit, with the replay tests described in Step 5 below as the verify step (the repository, the script name and the alias are our example):

promigence snapshot create \
  --image python:3.12 \
  --setup "git clone https://github.com/<you>/<env-repo> /work/env && git -C /work/env checkout <40-char sha>" \
  --setup "cd /work/env && pip install -r requirements.txt" \
  --verify "cd /work/env && python3 replay_tests.py" \
  --tier small --alias orders-env --wait --wait-timeout 10m

Its FAQ adds that a Promigence snapshot is named by a hash of its contents, that every sandbox started from it begins with the same files, and that it is kept until you delete it, so an evaluation can be re-run later against the same starting point. Its CLI reference turns two of the pins in the first table into rules: --image takes a tag, "which is pinned to its digest for you", or an image already given by digest, and --commit takes "a full 40-character SHA; a branch name is refused". For each episode, --verify-each will "Re-run the snapshot's verify command in each sandbox before CMD runs" (all read 2026-11-26).

The other named providers document how they build, check, pin and keep a reusable environment, each on its own pages, all read 2026-11-26.

Table: How AWS, Daytona, E2B, Google Cloud and Modal build and pin a reusable environment (read 2026-11-26)

ProviderHow the environment is built and checkedHow a version is pinned and keptSource
AWS (Amazon Bedrock AgentCore Runtime)Deployed from your code directly or from a container imageEvery update creates a new version, immutable once created, and an endpoint can point at a specific versionRuntime versioning
DaytonaA snapshot is built from an image or a Dockerfile, and any number of sandboxes can start from itThe image must carry a tag or a digest, and the latest, lts and stable tags are not accepted; a snapshot becomes inactive after 2 weeks without useSnapshots
E2BA template build runs the start command, waits for the ready command, which repeats until it exits 0, then snapshots the sandboxTags version a template, and a build ID pins a sandbox to one exact buildHow it works, Start and ready commands, Tags and versioning
Google Cloud (Gemini Enterprise Agent Platform sandboxes)A sandbox template names the container image; changing the image means deleting the template and creating a new oneA snapshot saves files, installed libraries and memory and is kept for its ttl; it cannot be restored into a sandbox with a different architecture, runtime version or container imageManage templates, Manage snapshots
ModalNamed Images are built with Image.build; an exec readiness probe passes when its command exits 0External image tags are treated as immutable once pulled; filesystem snapshots are Images kept for 30 days by default, which you can changeSandboxes guide, Snapshots

Done by hand, the same result takes the five steps below: pin the image by digest, pin data and tasks by hash, seed every random choice, record the identifiers with each trajectory, and gate each version on replay tests.

Step 1: How do I pin the container image?

Pin the image by digest in every place the environment is started.

Docker's documentation says that "When pulling an image by digest, you specify exactly which version of an image to pull", and that doing so "pins" an image to a specific version in time; the digest "takes the place of the tag" (docker image pull, read 2026-11-26):

docker pull ubuntu@sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30

Record the digest next to the environment version, and build images from pinned base images and pinned package versions so a rebuild is a deliberate act.

Step 2: How do I pin data and tasks?

Pin data and tasks with content hashes, so any change is visible.

  1. Generate data from a seed with pinned generator versions. Faker's documentation warns that its datasets change, so the same seed can give different output across patch versions; it advises pinning the exact version (Faker documentation, read 2026-11-26).
  2. Store the task list as a file with one task per line, sorted, and record its SHA-256.
  3. Store the evaluation seeds the same way, separate from training seeds.

A short way to fingerprint a task set and data dump on a Linux machine:

sort tasks.jsonl | sha256sum
sha256sum seed-data.sql

Step 3: How do I make seeds replay the same episode start?

Make every random choice in the environment come from the seed passed to reset.

Gymnasium's reset(seed=...) initialises the environment's generator, and "If you pass an integer, the PRNG will be reset even if it already exists" (Gymnasium Env API, read 2026-11-26). Draw task parameters and data from self.np_random, never from Python's global random or the wall clock. Our Gymnasium example checks that two resets with the same seed give the same task.

Published environments rely on this. AndroidWorld initialises task parameters "based on a controlled random seed" (AndroidWorld, arXiv 2405.14573, read 2026-11-26), and TextWorld's game generator takes a --seed (TextWorld repository, read 2026-11-26).

Step 4: What should I record with every trajectory?

Record enough to rebuild the episode's starting point and to explain its score:

  1. The environment id and version, such as toolenv/Orders-v3, and the snapshot name or image digest it runs on.
  2. The image digest, code commit and grader commit.
  3. The seed and the task id.
  4. The model name and version, sampling settings, and the agent harness version.
  5. The full trajectory, the reward, and whether the episode was terminated or truncated.

Item 4 matters because the environment is only half of an episode. The seed fixes the environment's side; the model's sampling varies on its own.

Step 5: How do I test that a version is reproducible?

Test it by replaying fixed scripts and comparing state.

  1. Write a few scripted action sequences per task family, including one that solves the task.
  2. For each, start the pinned environment twice with the same seed, run the script, and dump the state the grader reads.
  3. The two dumps and the two rewards must match. Run this test in CI for every change to the environment.
  4. Run the same scripts against the previous version. If rewards differ and you did not bump the version, bump it.

When is a change big enough for a new version?

A change needs a new version when the same actions can now earn a different reward. That includes fixing a grader bug: the old scores were measured with the bug, so they belong to the old version.

Table: Version bump decisions

ChangeNew version?
Grader now also checks unchanged stateYes
Tool output gains a new fieldYes, the observation changed
Image rebuilt with a new library releaseYes, unless replay tests show identical state and rewards
Tasks reworded for clarityYes
Code refactor, all replay tests identicalNo
Faster reset, same state afterwardsNo

What we read for this article

Field questions

Why is a container tag not enough to pin an environment?

A tag can point to a new image after a rebuild. A digest identifies one exact image. Docker's documentation describes pulling by digest as the way to pin an image to a specific version in time.

What should make me bump an environment's version?

Any change that can change a reward for the same actions: the app or its data, the task list, the grader, the tools offered, the observation format or the step limit. A pure refactor that leaves every reward the same can keep the version.

Does seeding make an LLM agent's episode reproducible?

It makes the environment's side reproducible: the same seed gives the same task and the same starting state. The model's sampling and any hosted model updates are separate sources of variation, so record them too.

How does Gymnasium name environment versions?

With ids of the form namespace/Name-vN, where the namespace and version are optional but recommended. Gymnasium's registry can also find the highest registered version of an environment name.