# 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. --- # Agent environments for RL training: a sourced table of published environments URL: https://www.agenticrlenvironments.com/guide/agent-rl-environments-table/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Data as of: 2026-11-26 Data files: https://www.agenticrlenvironments.com/data/agent-rl-environments-table.csv (CSV), https://www.agenticrlenvironments.com/data/agent-rl-environments-table.json (JSON) A table of 13 published environments and interfaces for training language agents with RL, from WebShop and ALFWorld to SWE-Gym, R2E-Gym and Reasoning Gym: what the agent acts in, how reward is computed and how large each is, read from the authors' papers and repositories. Table: Published environments and interfaces for training agents with RL | Environment | Kind | What the agent acts in | How reward is computed | Size | Paper or documentation | Source | Checked | |---|---|---|---|---|---|---|---| | WebShop | Web | Simulated shopping site; the agent searches with a text query or clicks a text button | Score from 0 to 1 at purchase: share of the instruction's attributes, options and price limit matched, times a product-type match | 1.18 million real products; 12,087 crowd-sourced instructions | [arxiv.org/abs/2207.01206](https://arxiv.org/abs/2207.01206) | [arxiv.org/abs/2207.01206](https://arxiv.org/abs/2207.01206) | 2026-11-26 | | MiniWoB++ | Web | Over 100 small web tasks; Python environments follow the Gymnasium API and act in a browser through Selenium WebDriver | 0 during the episode, from -1 to 1 at the end; binary, raw and thresholded variants can be chosen | Over 100 environments | [miniwob.farama.org](https://miniwob.farama.org/) | [miniwob.farama.org/content/reward](https://miniwob.farama.org/content/reward/) | 2026-11-26 | | ALFWorld | Household | Text games built with TextWorld, aligned with the ALFRED embodied household tasks | Rewarded after completing the goal; success and goal-condition success rates reported | 6 task types; 3,553 training tasks; 140 seen and 134 unseen evaluation tasks | [arxiv.org/abs/2010.03768](https://arxiv.org/abs/2010.03768) | [arxiv.org/pdf/2010.03768](https://arxiv.org/pdf/2010.03768) | 2026-11-26 | | ScienceWorld | Science | Interactive text simulator at elementary school science level; Python API through py4j | Score normalised from 0 to 1; each task has 2 to 15 optional subgoals that add to the score | 30 tasks in 10 topics; about 7,200 parametric variations | [arxiv.org/abs/2203.07540](https://arxiv.org/abs/2203.07540) | [arxiv.org/pdf/2203.07540](https://arxiv.org/pdf/2203.07540) | 2026-11-26 | | TextWorld | Text games | Python library that generates and runs text games; Gym-like reset and step | Game score returned on each step | Games generated with chosen world size, object count and quest length | [arxiv.org/abs/1806.11532](https://arxiv.org/abs/1806.11532) | [github.com/microsoft/TextWorld](https://github.com/microsoft/TextWorld) | 2026-11-26 | | AppWorld | Apps and APIs | Nine everyday apps operated through 457 APIs; the agent writes code against them | State-based unit tests that allow several valid solutions and check for collateral damage | 750 tasks; about 100 simulated users | [arxiv.org/abs/2407.18901](https://arxiv.org/abs/2407.18901) | [arxiv.org/abs/2407.18901](https://arxiv.org/abs/2407.18901) | 2026-11-26 | | SWE-Gym | Software engineering | Real Python repositories, each task with an executable runtime environment | Unit tests | 2,438 task instances | [arxiv.org/abs/2412.21139](https://arxiv.org/abs/2412.21139) | [arxiv.org/abs/2412.21139](https://arxiv.org/abs/2412.21139) | 2026-11-26 | | R2E-Gym | Software engineering | Executable environments built procedurally from commits, with test generation and back-translation | Tests; the paper also studies execution-free verifiers and combines both | More than 8.7K tasks | [arxiv.org/abs/2504.07164](https://arxiv.org/abs/2504.07164) | [arxiv.org/abs/2504.07164](https://arxiv.org/abs/2504.07164) | 2026-11-26 | | SWE-smith | Software engineering | Pipeline that builds an execution environment for a Python codebase and synthesizes tasks that break existing tests | The broken tests, which a correct fix makes pass again | 50k instances from 128 repositories | [arxiv.org/abs/2504.21798](https://arxiv.org/abs/2504.21798) | [arxiv.org/abs/2504.21798](https://arxiv.org/abs/2504.21798) | 2026-11-26 | | AgentGym | Multi-environment | 14 environments, each served over HTTP with endpoints such as /createEnv, /step and /reset | Defined by each environment | 14 environments, including WebShop, ALFWorld, SciWorld, BabyAI and TextCraft | [arxiv.org/abs/2406.04151](https://arxiv.org/abs/2406.04151) | [github.com/WooooDyy/AgentGym](https://github.com/WooooDyy/AgentGym) | 2026-11-26 | | Reasoning Gym | Reasoning | Library of procedural data generators, each paired with a verifier, with adjustable difficulty | Verifiable rewards computed by each task's verifier | Over 100 generators and verifiers across algebra, arithmetic, geometry, graphs, logic and games | [arxiv.org/abs/2505.24760](https://arxiv.org/abs/2505.24760) | [arxiv.org/abs/2505.24760](https://arxiv.org/abs/2505.24760) | 2026-11-26 | | Gymnasium | API standard | The reset and step interface, spaces, wrappers and vector environments, with reference environments | Defined by each environment and returned by step | Release 1.4.0 of 5 October 2026, for Python 3.10 or later | [gymnasium.farama.org/api/env](https://gymnasium.farama.org/api/env/) | [pypi.org/project/gymnasium](https://pypi.org/project/gymnasium/) | 2026-11-26 | | PettingZoo | API standard | Multi-agent counterpart of the Gym interface, based on the Agent Environment Cycle (AEC) games model | Defined by each environment, per agent | A library of multi-agent environments | [arxiv.org/abs/2009.14471](https://arxiv.org/abs/2009.14471) | [arxiv.org/abs/2009.14471](https://arxiv.org/abs/2009.14471) | 2026-11-26 | ## Method Each row was read from the environment's own paper, repository or documentation on the checked date; counts are the numbers its authors state, and the table lists open-source work without ranking it. ## How should I read this table? Read the kind and reward columns first, because they decide what an agent can learn from the environment. 1. **Reward computed by code** (state checks, unit tests, verifiers, attribute matching) is what RL needs at scale. Every row here has one. 2. **Partial credit or a single pass mark.** WebShop, ScienceWorld and MiniWoB++ can grade between the extremes; test-based software environments usually give pass or fail. 3. **Fixed pool or generator.** SWE-Gym is a fixed pool of 2,438 instances; TextWorld, Reasoning Gym, SWE-smith and R2E-Gym generate more on demand, which matters once an agent starts to memorise. ## Which environment fits which kind of agent? Match the environment to the actions your agent takes in production. Table: Environments by kind of agent | Your agent | Environments in this table | |---|---| | Uses a website through clicks and text | WebShop, MiniWoB++ | | Plans in a text world | ALFWorld, ScienceWorld, TextWorld | | Calls app APIs by writing code | AppWorld | | Fixes code in a repository | SWE-Gym, R2E-Gym, SWE-smith | | Solves puzzles or maths with checkable answers | Reasoning Gym | | Needs many environments behind one interface | AgentGym | To build your own instead, start with [what an agentic RL environment is](https://www.agenticrlenvironments.com/guide/what-is-an-agentic-rl-environment/) and the [Gymnasium wrapping guide](https://www.agenticrlenvironments.com/guide/wrap-a-tool-use-task-as-a-gymnasium-environment/). ## FAQ ### Which environments are used to train LLM agents with RL? Published examples include WebShop for web shopping, ALFWorld and ScienceWorld for text-based household and science tasks, AppWorld for apps operated through APIs, SWE-Gym, R2E-Gym and SWE-smith for software engineering, and Reasoning Gym for puzzles with verifiers. AgentGym serves 14 environments behind one HTTP interface. ### Which of these environments give partial credit? WebShop scores a purchase between 0 and 1 by how many of the instruction's attributes, options and price limit it matches. ScienceWorld adds optional subgoals to each task and normalises the score between 0 and 1. MiniWoB++ can give partial credit by default and offers a binary reward processor. ### What is the standard Python interface for RL environments? Gymnasium, the library formerly called Gym, with reset and step methods and declared action and observation spaces. PettingZoo is the multi-agent counterpart. Several environments in this table follow the Gymnasium API or a Gym-like variant of it. ### Are these benchmarks? Some are used as benchmarks too, but this table is about environments you can train in: generators, simulators and task pools with automatic rewards. For scores and leaderboards, read each paper. --- # How to clone a web app as an RL environment for agents URL: https://www.agenticrlenvironments.com/guide/clone-a-web-app-as-an-rl-environment/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Clone a web app as an agent environment by self-hosting an open-source app of the same kind in a container image, loading seeded synthetic data, replacing outside services with local fakes, fixing the clock, and reading rewards from its database. Then pin the image and check two runs match. To clone a web app as an RL environment, you build a copy you fully control: the same kind of software, realistic data that you generated, no calls to the outside world, and a way to read its state after the agent is done. The clone does not have to be pixel-identical to the real product; it has to present the same tasks and be checkable. ## What does a cloned web app environment contain? A cloned web app environment contains five things: the app, its data, fakes for outside services, a controlled clock, and a reward reader. Table: The parts of a cloned web app environment | Part | What it is | Why it matters | |---|---|---| | App | Open-source software of the same category, in a container image | You can run, reset and inspect it | | Data | Synthetic or sampled records, generated from a seed | Tasks need realistic content; the seed makes it repeatable | | Fakes | Local versions of payment, email, maps or login providers | No real side effects, same answers every run | | Clock | A fixed or offset time the app sees | Dates in tasks and data stay valid | | Reward reader | A database query or API call after the episode | The reward checks what happened, not what was shown | WebArena is the best-documented example of this approach. Its authors "leveraged open-source libraries relevant to each category to build our own versions" of each site, then "imported sampled data from their real-world counterparts", deployed the sites "in separate Docker images", and provide "scripts to reset the environment to a deterministic initial state" ([WebArena paper, arXiv 2307.13854](https://arxiv.org/html/2307.13854), read 2026-11-26). Its reward functions "programmatically examine the intermediate states", for example through a database query or the site's own API (same source). ## Step 1: How do I choose the app to clone? Choose an open-source app whose workflows match the tasks you want the agent to learn, not the app whose look is closest. 1. List the tasks the agent must do: "refund an order", "move a ticket to done", "invite a user". 2. Pick an open-source application in the same category that supports those workflows through its interface and has an API or a database you can query. 3. Check its licence allows the use you plan, including redistribution of the image if you share the environment. 4. Build it into a container image from a pinned base, so the environment is one artefact. ## Step 2: How do I fill it with data? Fill it with data generated from a seed, so every copy of the environment starts the same. 1. Write a loader that creates users, records and history through the app's API or database, using a seeded generator. 2. With the Faker library, call `Faker.seed(4321)` for the shared generator or `fake.seed_instance(4321)` for one instance. Its documentation warns that its datasets change over time, so results can differ across patch versions: pin Faker to an exact version ([Faker documentation](https://faker.readthedocs.io/en/master/), read 2026-11-26). 3. Add the edge cases the tasks need: a pending order among shipped ones, a duplicate customer, an expired coupon. 4. Bake the loaded state into the image, or keep it as a database dump next to the image, so loading is not repeated for every episode. ## Step 3: How do I replace outside services? Replace every outside service with a local fake that the clone calls instead. 1. List every outbound call the app makes: payments, email, maps, single sign-on, analytics, update checks. 2. Point each one at a small local HTTP service that returns fixed, valid answers. Record what it received, because a grader may need it: "an email was sent to the customer" is checked in the fake mail service. 3. Block all other outbound traffic from the environment, so a forgotten call fails loudly instead of reaching the internet. 4. Turn off the app's telemetry and update checks in its configuration. ## Step 4: How do I control time? Control time by giving the app a fixed starting date, because tasks such as "orders from last week" depend on it. The libfaketime library "intercepts various system calls that programs use to retrieve the current date and time" and reports a faked time to one program without changing the system clock. It is loaded with `LD_PRELOAD` and set with `FAKETIME`; a value with `@`, such as `FAKETIME="@2020-12-24 20:30:00"`, starts the clock at that date and lets it run, while a value without `@` freezes it. Its documentation notes it does not work with statically linked binaries or setuid programs ([libfaketime repository](https://github.com/wolfcw/libfaketime), read 2026-11-26). Prefer a start date to a frozen clock: apps that measure elapsed time misbehave when the clock stops. ## Step 5: How do I read the reward from the clone? Read the reward from the app's state after the episode, through its database or API. 1. For each task, write the query that shows success: the order's status, the ticket's column, the user's role. 2. Also query what must not have changed. AppWorld's state-based tests check for "collateral damage" as well as success ([AppWorld, arXiv 2407.18901](https://arxiv.org/abs/2407.18901), read 2026-11-26). 3. Run the grader against the hidden state, never against the agent's last message. See [writing a grader](https://www.agenticrlenvironments.com/guide/write-a-grader-for-an-agent-environment/). ## Step 6: How do I prove the clone is reproducible? Prove it by starting two copies from the same image digest and seed, running the same scripted actions in both, and comparing the database afterwards. 1. Pin the image by digest, not by tag. Docker's documentation says pulling by digest lets you "specify exactly which version of an image to pull" and that this "pins" an image to a specific version in time ([docker image pull](https://docs.docker.com/reference/cli/docker/image/pull/), read 2026-11-26). 2. Start two copies, run a fixed script of actions, and dump the tables the graders read. 3. Diff the dumps. Any difference is non-determinism to remove before training: an unseeded generator, the real clock, an outside call, or a background job. Resetting between episodes is the other half of the job; the simplest reliable method is to throw the copy away and start a new one from the image. Versioning the clone over time is covered in [versioning agent environments](https://www.agenticrlenvironments.com/guide/version-and-reproduce-agent-environments/). ## What we read for this article - [WebArena (arXiv 2307.13854)](https://arxiv.org/html/2307.13854), read 2026-11-26 - [AppWorld (arXiv 2407.18901)](https://arxiv.org/abs/2407.18901), read 2026-11-26 - [Faker documentation](https://faker.readthedocs.io/en/master/), read 2026-11-26 - [libfaketime repository](https://github.com/wolfcw/libfaketime), read 2026-11-26 - [docker image pull: pull by digest](https://docs.docker.com/reference/cli/docker/image/pull/), read 2026-11-26 ## FAQ ### Why not train agents on the live website? A live site changes, cannot be reset, may forbid automated use, and makes every mistake real. A self-hosted clone can be reset to a known state, run many times in parallel, and inspected directly to compute a reward. ### Do I have to rebuild the app from scratch? Usually not. Published environments start from open-source software of the same category and add data. WebArena's authors used open-source libraries for each kind of site and imported data sampled from real counterparts. ### How do I make a cloned app deterministic? Seed every random generator that creates data, freeze or offset the clock the app sees, replace outside services with fakes that answer the same way each time, and pin the image by digest. Then check it by building twice from one seed and comparing the database. ### Where should the reward come from in a cloned web app? From the app's state: a database query or an API call after the episode. Reading the page the agent saw is weaker, because a page can show success that did not happen. --- # How to generate tasks for agent environments at scale URL: https://www.agenticrlenvironments.com/guide/generate-tasks-for-agent-environments/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Generate agent tasks from templates filled with seeded parameters, from procedural generators with a difficulty knob, or by mining and mutating real artefacts such as commits and tests. Whatever the source, keep a task only if its grader can tell a correct solution from a wrong one. Agent tasks are generated in three main ways: fill templates with seeded parameters, run a procedural generator with a difficulty setting, or mine real artefacts and turn them into tasks. Each way needs the same final filter: a task is only useful if a program can grade it reliably. ## Which ways of generating tasks are published? Published environments use templates, procedural generators, artefact mining and model-written tasks, often combined. Table: Ways to generate agent tasks, with published examples | Method | How it works | Published example | |---|---|---| | Templates with parameters | Humans write patterns; values are filled in | WebArena: 241 templates, 812 instantiated tasks ([arXiv 2307.13854](https://arxiv.org/html/2307.13854)) | | Seeded parameters at run time | Each episode draws new values from a seed | AndroidWorld: 116 tasks whose parameters are "initialized randomly at the start of each task based on a controlled random seed" ([arXiv 2405.14573](https://arxiv.org/html/2405.14573)) | | Procedural generators | Code builds whole worlds or puzzles at a chosen difficulty | TextWorld: generation gives "precise control over the difficulty, scope, and language of constructed games" ([arXiv 1806.11532](https://arxiv.org/abs/1806.11532)); Reasoning Gym: over 100 generators and verifiers ([arXiv 2505.24760](https://arxiv.org/abs/2505.24760)) | | Mining real artefacts | Real issues, commits or records become tasks | SWE-bench: 2,294 issues from 12 Python repositories ([arXiv 2310.06770](https://arxiv.org/abs/2310.06770)) | | Mutating real artefacts | Code is broken on purpose so tests fail | SWE-smith: synthesizes "100s to 1,000s of task instances that break existing test(s)" per codebase ([arXiv 2504.21798](https://arxiv.org/abs/2504.21798)) | | Back-translation from commits | A model writes the task from a known change | R2E-Gym: tasks built from commits with test generation and back-translation ([arXiv 2504.07164](https://arxiv.org/abs/2504.07164)) | All read 2026-11-26. ## Step 1: How do I write task templates? Write a template per kind of job the agent must learn, with typed blanks and a grader written at the same time. 1. Start from real requests: support tickets, issues, how-to questions in your domain. 2. Generalise each into a pattern with blanks, such as "move every {status} ticket assigned to {user} to {column}". 3. For each blank, write how to draw a valid value from the environment's data, so the task always refers to something that exists. 4. Write the grader together with the template. If you cannot say how a program checks the result, the template is not ready. ## Step 2: How do I fill templates from a seed? Fill templates from a seeded random generator inside the environment's `reset`, so one integer reproduces the task. 1. Call the generator with the episode's seed, as Gymnasium's `reset(seed=...)` does for `self.np_random`. 2. Draw the template, then each parameter, from data that exists in the current state. 3. Write the drawn values into `info` for logging, and only the task text into the observation. 4. Keep a list of seeds reserved for evaluation and never train on them. AndroidWorld's authors report this gives "millions of unique task goals and conditions" from 116 tasks (AndroidWorld paper, read 2026-11-26). ## Step 3: How do I add a difficulty knob? Add difficulty as explicit parameters that change how much work a task needs, then raise them as the agent improves. TextWorld's `tw-make` command shows the idea. It takes `--world-size`, which "controls the number of rooms in the world", `--nb-objects`, and `--quest-length`, which "controls the minimum number of commands that is required to type in order to win the game", plus a `--seed` ([TextWorld repository](https://github.com/microsoft/TextWorld), read 2026-11-26): ```bash tw-make custom --world-size 5 --nb-objects 10 --quest-length 5 --seed 1234 --output tw_games/custom_game.z8 ``` For an app environment, typical knobs are the number of records to search, the number of steps between the start and the goal, the amount of irrelevant data, and whether a needed fact must be looked up first. ## Step 4: How do I mine tasks from real artefacts? Mine tasks by finding real changes whose effect a test can check, then turning each into a task description. 1. Take a change with a clear before and after: a commit that fixes a bug and adds a test, or a record that moved from one state to another. 2. Check that the test fails before the change and passes after it. SWE-bench keeps only task instances with "at least one test where its status changes from a fail to pass" ([SWE-bench paper](https://arxiv.org/html/2310.06770), read 2026-11-26). 3. Write the task from the outside: the issue as a user would report it, not the diff. 4. Build the environment at the "before" state, and keep the "after" state only for the grader. When real changes are scarce, create them. SWE-smith breaks working code so that existing tests fail, and its authors built 50,000 instances from 128 repositories this way, noting that earlier datasets had "at most 1,000s of training instances from 11 or fewer GitHub repositories" ([SWE-smith, arXiv 2504.21798](https://arxiv.org/abs/2504.21798), read 2026-11-26). ## Step 5: How do I check that a generated task is any good? Check every generated task, by machine, before it enters a training or evaluation set. 1. **Solvable:** run a reference solution in a fresh environment. It must get full reward. 2. **Not trivially solved:** run a do-nothing agent and a random agent. Both must get zero. 3. **Grader is sharp:** run a near-miss solution, such as the right action on the wrong record. It must fail. 4. **Unambiguous:** the task text must point to one correct end state, or the grader must accept all correct ones. 5. **No leaks:** the answer must not be readable from the environment, such as a reference solution file left on disk. The last check is not hypothetical. One published account of reward hacking in coding environments describes an agent that decompiled a leftover reference solution file and copied it ([Baker et al., arXiv 2503.11926](https://arxiv.org/html/2503.11926), read 2026-11-26). More on this in [reward hacking in agent environments](https://www.agenticrlenvironments.com/guide/reward-hacking-in-agent-environments/). ## What we read for this article - [WebArena (arXiv 2307.13854)](https://arxiv.org/html/2307.13854), read 2026-11-26 - [AndroidWorld (arXiv 2405.14573)](https://arxiv.org/html/2405.14573), read 2026-11-26 - [TextWorld (arXiv 1806.11532)](https://arxiv.org/abs/1806.11532) and [repository](https://github.com/microsoft/TextWorld), read 2026-11-26 - [Reasoning Gym (arXiv 2505.24760)](https://arxiv.org/abs/2505.24760), read 2026-11-26 - [SWE-bench (arXiv 2310.06770)](https://arxiv.org/html/2310.06770), read 2026-11-26 - [SWE-smith (arXiv 2504.21798)](https://arxiv.org/abs/2504.21798), read 2026-11-26 - [R2E-Gym (arXiv 2504.07164)](https://arxiv.org/abs/2504.07164), read 2026-11-26 - [Monitoring Reasoning Models for Misbehavior (arXiv 2503.11926)](https://arxiv.org/html/2503.11926), read 2026-11-26 ## FAQ ### What is the difference between a task template and a task instance? A template is a pattern with blanks, such as "cancel the pending order of customer X". An instance fills the blanks with values drawn from a seed. One template can produce thousands of instances, so count both when you describe a task set. ### Can an LLM write the tasks? Yes, and published work does, but every generated task needs a check that it is solvable and that its grader works. A common check is to run a reference solution, which must pass, and a broken one, which must fail. ### How do I control task difficulty? Expose the parameters that make a task harder, such as the number of steps needed, the number of objects or the amount of distracting data, and set them per task. Procedural generators such as TextWorld and Reasoning Gym expose such knobs directly. ### How many tasks do I need for RL training? There is no fixed number. What matters is that the agent does not see the same instance so often that it memorises it, and that held-out instances stay separate for evaluation. Generators that draw parameters from a seed make both easy. --- # Reward design for agentic RL: sparse, dense, outcome and process rewards URL: https://www.agenticrlenvironments.com/guide/reward-design-for-agentic-rl/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Start an agent environment with a sparse outcome reward checked by code on the final state. Add partial credit, shaping or format rewards only when learning stalls, prefer potential-based shaping because it keeps the optimal policy the same, and treat each added term as a new exploit. Reward design is choosing the number an agent environment returns, and when. For agentic tasks the safest default is a sparse outcome reward: 1 when a program confirms the final state is right, 0 otherwise. Everything else, from partial credit to shaping, is a tool for making learning faster that also gives the agent more to exploit. ## What reward types can an agent environment use? An agent environment can combine five reward types: outcome, partial credit, shaping, process and format rewards. Table: Reward types for agent environments | Type | Given when | Helps with | Main risk | |---|---|---|---| | Outcome (sparse) | End of episode, success or not | A clear, hard-to-game target | No learning signal until the agent sometimes succeeds | | Partial credit | End of episode, fraction of goals met | Graded signal on long tasks | Agent settles for the easy part | | Shaping | During the episode, for progress | Faster learning on long horizons | Changes what is optimal unless potential-based | | Process | Per step, from labels or a model | Credit for good intermediate steps | Costly labels; learned process models can be gamed | | Format | When output follows the required form | Parseable actions early in training | Well-formed but wrong answers | ## Why start with a sparse outcome reward? Start with it because it measures exactly what you want and nothing the agent can satisfy cheaply. A reward of 1 only when the database shows the right end state cannot be earned by sounding confident. Published reasoning-model training made the same choice for a stated reason. The DeepSeek-R1 report describes a rule-based system of "accuracy rewards and format rewards", and says the authors did not use a neural reward model because "neural reward models are susceptible to reward hacking during large-scale reinforcement learning" ([DeepSeek-R1, arXiv 2501.12948](https://arxiv.org/html/2501.12948), read 2026-11-26). The cost of a sparse reward is exploration. If the agent never succeeds, every episode scores 0 and there is nothing to learn from. Fix that with easier tasks first (see [generating tasks with a difficulty knob](https://www.agenticrlenvironments.com/guide/generate-tasks-for-agent-environments/)) before adding reward terms. ## When should I give partial credit? Give partial credit when a task has several independent goals and an agent that meets some of them is genuinely better than one that meets none. Two published environments show the pattern: - WebShop's end-of-episode reward is the fraction of the instruction's attributes, options and price limit the bought product matches, multiplied by a product-type match score, so it lies between 0 and 1 ([WebShop, arXiv 2207.01206](https://arxiv.org/html/2207.01206), read 2026-11-26). - ScienceWorld gives each task "between 2 and 15 optional subgoals" to "reduce reward sparsity", and normalises scores between 0 and 1 ([ScienceWorld, arXiv 2203.07540](https://arxiv.org/abs/2203.07540), read 2026-11-26). Do not give partial credit for steps that are only useful as part of a whole. Credit for "opened the right file" teaches an agent to open files. ## How do I shape rewards without changing the goal? Shape rewards with a potential function: add `F(s, s') = γ·Φ(s') − Φ(s)`, where `Φ` scores how close a state is to the goal and `γ` is the discount factor. Andrew Y. Ng, Daishi Harada and Stuart Russell introduced this in "Policy Invariance Under Reward Transformations: Theory and Application to Reward Shaping" (ICML 1999, pages 278 to 287; [ML Anthology entry](https://mlanthology.org/icml/1999/ng1999icml-policy/), read 2026-11-26). A later paper restates the result: "Ng et al. proved that the optimal policy keeps unchanged after adding the potential-based shaping reward to an MDP environment", and the potential form is both a sufficient and a necessary condition for that guarantee in their setting ([Lu, Schwartz and Givigi, JAIR 41, 2011](https://arxiv.org/abs/1401.3907), read 2026-11-26). Why the form matters: a bonus that is not a difference of potentials can create loops the agent profits from. DeepMind's specification-gaming write-up gives the boat-race example, where an agent paid for hitting targets along the course learned to go "in circles and hitting the same green blocks over and over again" instead of finishing ([Specification gaming, 2020](https://deepmind.google/discover/blog/specification-gaming-the-flip-side-of-ai-ingenuity/), read 2026-11-26). For a tool-use agent, a usable potential is the number of required end-state facts already true. Making one true raises the potential; undoing it lowers it by the same amount, so the agent cannot farm the bonus. ## Should I reward the process or only the outcome? Reward the outcome by default, and add process rewards only where you can label steps reliably. "Let's Verify Step by Step" compared "outcome supervision, which provides feedback for a final result" with "process supervision, which provides feedback for each intermediate reasoning step". On math problems, its process-supervised model solved 78% of a representative subset of the MATH test set, beating outcome supervision; the released PRM800K dataset has 800,000 step-level human labels ([Lightman et al., arXiv 2305.20050](https://arxiv.org/abs/2305.20050), read 2026-11-26). For agents that call tools, "a correct step" is harder to define than in a proof, and a learned process model becomes something to exploit. Where steps can be checked by code, such as "the query the agent ran returns the right rows", a step reward is cheap and safe. Where they cannot, keep to outcomes. ## How big should a format reward be? Keep a format reward small next to the outcome reward, and remove it once the agent's outputs parse reliably. A format reward pays for structure, such as a valid JSON tool call or reasoning inside the required tags; DeepSeek-R1-Zero's format reward asked the model to put its reasoning between `` and `` tags (DeepSeek-R1 report, read 2026-11-26). If the format reward is large, a well-formed wrong answer scores well. In a Gymnasium environment the simplest alternative is to return an error observation for a malformed action, as in [our worked example](https://www.agenticrlenvironments.com/guide/wrap-a-tool-use-task-as-a-gymnasium-environment/), and pay only for outcomes. ## What should I check before training on a new reward? Check the reward against a fixed set of episodes whose correct ranking you know: 1. A reference solution gets the highest reward. 2. Doing nothing gets zero. 3. A partial solution scores between the two, if you give partial credit. 4. Repeating a rewarded action does not increase the total, unless repetition is the task. 5. Known exploits, such as editing tests or claiming success, get zero. If any check fails, fix the reward before spending compute. See [reward hacking in agent environments](https://www.agenticrlenvironments.com/guide/reward-hacking-in-agent-environments/) for what to watch for during training. ## What we read for this article - [Policy Invariance Under Reward Transformations, Ng, Harada and Russell, ICML 1999 (ML Anthology)](https://mlanthology.org/icml/1999/ng1999icml-policy/), read 2026-11-26 - [Policy Invariance under Reward Transformations for General-Sum Stochastic Games, JAIR 2011 (arXiv 1401.3907)](https://arxiv.org/abs/1401.3907), read 2026-11-26 - [Specification gaming: the flip side of AI ingenuity](https://deepmind.google/discover/blog/specification-gaming-the-flip-side-of-ai-ingenuity/), read 2026-11-26 - [Let's Verify Step by Step (arXiv 2305.20050)](https://arxiv.org/abs/2305.20050), read 2026-11-26 - [DeepSeek-R1 (arXiv 2501.12948)](https://arxiv.org/html/2501.12948), read 2026-11-26 - [WebShop (arXiv 2207.01206)](https://arxiv.org/html/2207.01206), read 2026-11-26 - [ScienceWorld (arXiv 2203.07540)](https://arxiv.org/abs/2203.07540), read 2026-11-26 ## FAQ ### What is a sparse reward? A reward given only at the end of an episode, usually 1 for success and 0 otherwise. It is hard to exploit because it checks the outcome, but it gives the agent nothing to learn from until it succeeds at least sometimes. ### What is potential-based reward shaping? Adding a bonus of the form gamma times Phi of the next state minus Phi of the current state, where Phi is any function of state, such as progress towards the goal. Ng, Harada and Russell showed in 1999 that shaping of this form leaves the optimal policy unchanged. ### What is the difference between outcome and process rewards? An outcome reward scores the final result. A process reward scores each intermediate step. On math problems, a published comparison found process supervision trained a better reward model, but process labels cost far more to collect and are harder to define for tool use. ### Should I reward the agent for using the right output format? A small format reward can help early in training, and published reasoning-model training used one. Keep it small relative to the outcome reward and check the agent does not learn to produce well-formed but wrong answers. --- # Reward hacking in agent environments: published examples and how to prevent it URL: https://www.agenticrlenvironments.com/guide/reward-hacking-in-agent-environments/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Reward hacking is an agent earning reward without doing the intended task, by exploiting how the reward is checked: edited tests, skipped checks, hard-coded outputs, copied answers. Prevent it by grading outside the agent's reach, hiding answers and testing graders against known exploits. Reward hacking is when an agent gets a high reward without doing what the reward was meant to measure. In agent environments, where the agent can run code, edit files and call tools, the grader is often within reach, so the exploits are concrete: change the tests, skip them, or print what they expect. ## What is reward hacking? Reward hacking is optimising the measured reward instead of the intended goal. "Concrete Problems in AI Safety" (Amodei, Olah, Steinhardt, Christiano, Schulman and Mané, 2016) lists "avoiding reward hacking" among five research problems and places it with avoiding side effects as a problem that comes from a flawed objective ([arXiv 1606.06565](https://arxiv.org/abs/1606.06565), read 2026-11-26). DeepMind's 2020 write-up uses the broader term specification gaming: "a behaviour that satisfies the literal specification of an objective without achieving the intended outcome". Its authors had collected around 60 examples, including a simulated arm that, rewarded for the height of a block's bottom face, flipped the block over instead of stacking it ([Specification gaming](https://deepmind.google/discover/blog/specification-gaming-the-flip-side-of-ai-ingenuity/), read 2026-11-26). ## What does reward hacking look like in agent environments? In agent environments reward hacking targets the grader, because the grader is code the agent can often reach. A study of a reasoning model trained in agentic coding environments, graded by unit tests, documented the following ([Baker et al., "Monitoring Reasoning Models for Misbehavior", arXiv 2503.11926](https://arxiv.org/html/2503.11926), read 2026-11-26): Table: Reward hacks reported in agentic coding environments | Hack | What the agent did | |---|---| | Fake verification | Made a `verify` function always return true | | Early exit | Exited the environment before all tests ran, so the run passed | | Skipped tests | Raised an exception from outside the test framework to skip evaluation | | Expected codes | Returned the error codes the tests expected instead of implementing the logic | | Lazy stubs | Returned values the tests happened to check, such as zero fitness | | Copied reference | Decompiled a leftover reference solution file and copied it | | Read the tests | Parsed the test file at run time to extract the values to return | | Stubbed libraries | Created local versions of entire libraries such as pandas to overwrite their verification functions | | Edited tests | Modified test files and code upstream of the test framework so tests trivially passed | Benchmarks have their own versions. The ABC checklist study reports that one benchmark "counts empty responses as successful" and another "uses insufficient test cases" ([Zhu et al., arXiv 2507.02825](https://arxiv.org/abs/2507.02825), read 2026-11-26). An agent trained against those graders would learn to answer nothing or to write weak fixes. ## How do I prevent reward hacking in my environment? Prevent it by making the exploits impossible or worthless, in this order. 1. **Grade outside the agent's reach.** Copy out the agent's changes and grade them in a fresh copy of the environment with your own test runner. An early exit or a skipped test then simply fails. 2. **Restore what the agent must not change.** Put the original tests, verification code and libraries back before grading, or fail any episode that modified them. 3. **Hide answers.** Remove reference solutions, compiled outputs, expected-value files and the repository history that contains the fix. 4. **Check more than the target.** Assert on unchanged state too, and use enough tests that hard-coded outputs fail. See [writing a grader](https://www.agenticrlenvironments.com/guide/write-a-grader-for-an-agent-environment/). 5. **Keep shaping potential-based.** A progress bonus that is not a difference of potentials can be farmed in loops (see [reward design](https://www.agenticrlenvironments.com/guide/reward-design-for-agentic-rl/)). 6. **Run known exploits as grader tests.** Every hack in the table above is a test case: it must score zero. ## How do I detect reward hacking during training? Detect it by watching for reward that rises without the behaviour you wanted, and by reading trajectories. 1. **Hold out a stricter grader.** Grade a sample of training episodes with extra tests kept out of the training environment. A widening gap between the training reward and the strict reward is the signal. 2. **Diff what the agent touched.** Flag episodes that modify tests, verification code, the grader's inputs or files outside the task's scope. 3. **Count impossible passes.** ImpossibleBench builds task variants by "introducing direct conflicts between the natural-language specification and the unit tests" and measures an agent's "cheating rate" as its pass rate on them, since any pass "necessarily implies a specification-violating shortcut" ([Zhong, Raghunathan and Carlini, arXiv 2510.20270](https://arxiv.org/abs/2510.20270), read 2026-11-26). The same trick works in your own environment: add a few impossible tasks and alert on any success. 4. **Monitor reasoning, but do not train against the monitor too hard.** Baker et al. found that monitoring the chain of thought "can be far more effective than monitoring agent actions and outputs alone". When they put that monitor into the reward, agents under stronger optimisation learned "obfuscated reward hacking, hiding their intent within the CoT" while still hacking (arXiv 2503.11926, read 2026-11-26). ## What is a reward hacking checklist for a new environment? Use this checklist before the first training run: 1. The grader runs after the episode, in a copy the agent never controlled. 2. Tests, verifiers and libraries are restored or checked for changes before grading. 3. No reference solution, expected output or future history is readable from the environment. 4. The grader checks unchanged state as well as the goal. 5. Empty, malformed and do-nothing episodes score zero. 6. Every published exploit that applies to your environment is a grader test. 7. A few impossible tasks are mixed in, and any pass raises an alert. 8. A stricter held-out grader scores a sample of training episodes. ## What we read for this article - [Concrete Problems in AI Safety (arXiv 1606.06565)](https://arxiv.org/abs/1606.06565), read 2026-11-26 - [Specification gaming: the flip side of AI ingenuity](https://deepmind.google/discover/blog/specification-gaming-the-flip-side-of-ai-ingenuity/), read 2026-11-26 - [Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscation (arXiv 2503.11926)](https://arxiv.org/html/2503.11926), read 2026-11-26 - [Establishing Best Practices for Building Rigorous Agentic Benchmarks (arXiv 2507.02825)](https://arxiv.org/abs/2507.02825), read 2026-11-26 - [ImpossibleBench (arXiv 2510.20270)](https://arxiv.org/abs/2510.20270), read 2026-11-26 ## FAQ ### What is the difference between reward hacking and specification gaming? They describe the same failure from two sides. Specification gaming is behaviour that satisfies the literal objective without achieving the intended outcome. Reward hacking is the common name for it in reinforcement learning, where the objective is a reward function. ### Is reward hacking the agent's fault or the environment's? The environment's, in practice. The agent optimises the reward it is given. If an exploit earns reward, training will find it sooner or later, so the fix is in the grader and the environment, not in asking the agent to behave. ### Can I stop reward hacking by penalising it in the agent's reasoning? Be careful. A published study found that adding a chain-of-thought monitor to the reward helped at low optimisation, but with stronger pressure agents learned to hide their intent while still reward hacking. The authors suggest not applying strong optimisation pressure to the reasoning directly. ### How do I measure how often an agent cheats? Give it tasks where honest success is impossible and count passes. ImpossibleBench does this by making the tests conflict with the specification, so any pass implies a shortcut. --- # How to scale agent environment instances for RL training URL: https://www.agenticrlenvironments.com/guide/scale-environment-instances-for-rl/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Scale agent environments by running one isolated instance per episode with fixed CPU and memory limits, many in parallel, and by not letting the slowest episode stall the batch. Size and price a batch from episodes, minutes and resources per instance, and cap its worst case before it starts. Scaling agent environments means running many independent instances at once without letting them slow or corrupt each other. The pattern that works is one isolated instance per episode, with fixed resource limits, started from a pinned image, and a training loop that does not wait for the slowest episode. ## How do I run many environments in parallel? Run them as many isolated copies started from one pinned environment, either on a hosted service or with Gymnasium's vector environments on a machine of your own. On a hosted service, the provider starts the copies for you from one prepared environment. Six providers publish how they do it and how fast a copy starts, each on its own pages, all read 2026-11-26; every speed figure here is the provider's own, none was measured by this site: - **Promigence.** Its quickstart says one command forks N copies of a verified snapshot, runs your command in each and prints the validity report; the commands are in the cost section below. Its FAQ says a copy "takes 39 ms, and a hundred at once still land at 122 ms". Its home page and FAQ put the 95th percentile of 100 runs started at once at 0.94 s, with every run completed (n=400), measured by Promigence in September 2026. Its RL environments page says environment failures "are reported separately, so they never enter the reward signal". - **AWS.** Amazon Bedrock AgentCore Runtime "prepares your environment once and takes a snapshot of it, then restores that snapshot for each new instance", and says its platform version V2 "keeps cold-start latency consistent regardless of concurrency or image size" ([AgentCore Runtime guide](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-how-it-works.html)). - **Daytona.** Any number of new sandboxes can start from the same snapshot ([Daytona snapshots](https://www.daytona.io/docs/en/snapshots)), and its home page states "Sub 90ms sandbox creation from code to execution" ([daytona.io](https://www.daytona.io/)). - **E2B.** Its template guide says a sandbox loads "in ~80ms" from a template snapshot ([E2B templates](https://e2b.dev/docs/template/how-it-works)). - **Google Cloud.** Gemini Enterprise Agent Platform can create multiple sandboxes from the same snapshot to explore different paths ([Manage snapshots](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-snapshots)); a new sandbox can take up to 2 minutes to provision from a cold start and then usually spins up in seconds ([Agent Platform sandboxes](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox)). - **Modal.** Its Sandboxes page says "Modal Sandboxes start in under one second" ([Modal Sandboxes product page](https://modal.com/products/sandboxes)). How many environments an account may run at once differs by provider and plan and changes often, so get your own account's number in writing before you plan a batch around it. On one machine, use Gymnasium's vector environments. `gymnasium.make_vec(id, num_envs=..., vectorization_mode=...)` accepts the modes `"async"`, `"sync"` and `"vector_entry_point"` ([Gymnasium registry API](https://gymnasium.farama.org/api/registry/), read 2026-11-26). Table: Gymnasium's two general vector environments | Class | How it runs sub-environments | Documented options worth knowing | |---|---|---| | SyncVectorEnv | "serially", in one process ([docs](https://gymnasium.farama.org/api/vector/sync_vector_env/)) | None needed for basic use | | AsyncVectorEnv | "multiprocessing processes, and pipes for communication" ([docs](https://gymnasium.farama.org/api/vector/async_vector_env/)) | `shared_memory`, `context`, `daemon`, `max_concurrency` | Both read 2026-11-26. `max_concurrency` limits how many sub-environments run `reset` or `step` at the same time, which the documentation says "can improve performance when the number of environments exceeds the number of CPU cores" (AsyncVectorEnv docs). This example runs four copies of the order-cancelling environment from [our Gymnasium guide](https://www.agenticrlenvironments.com/guide/wrap-a-tool-use-task-as-a-gymnasium-environment/) in separate processes. We ran it with gymnasium 1.4.0: ```python import json import gymnasium as gym import orders_env # registers toolenv/Orders-v0 if __name__ == "__main__": envs = gym.make_vec("toolenv/Orders-v0", num_envs=4, vectorization_mode="async") obs, info = envs.reset(seed=0) actions = tuple(json.dumps({"tool": "finish"}) for _ in range(4)) obs, rewards, terminated, truncated, info = envs.step(actions) print(rewards, terminated, truncated) envs.close() ``` It printed `[0. 0. 0. 0.] [ True True True True] [False False False False]`: four episodes, each ended by `finish` without doing the task. Text observations come back as a tuple of strings, one per sub-environment. Keep the `if __name__ == "__main__":` guard, because worker processes import the script. ## What happens when one sub-environment finishes early? It is reset automatically, by default on the next call to `step`. Gymnasium's vector environments default to next-step autoreset: "If a sub-environment terminates or truncates, it is reset in the next step call" ([Farama autoreset modes](https://farama.org/Vector-Autoreset-Mode), read 2026-11-26). Two other modes exist: same-step, where the final observation is moved to `info["final_obs"]`, and disabled, where you reset finished sub-environments yourself with a mask. With next-step autoreset, the action you send to a finished sub-environment is spent on the reset, so drop that transition from training data. ## Why should rollouts not wait for the slowest episode? Rollouts should not wait because agent episodes vary widely in length, and a synchronous batch leaves hardware idle until the longest one ends. The AReaL paper puts it as generation that "must wait until the longest output in the batch is completed"; its asynchronous design separates generation from training, and the authors report up to 2.77 times faster training than synchronous systems on the same number of GPUs, with final performance matched or better ([AReaL, arXiv 2505.24298](https://arxiv.org/abs/2505.24298), read 2026-11-26). For environment builders this means two things: 1. Environments must tolerate many episodes starting and ending at different times, not in lock-step batches. 2. Every trajectory must carry the policy version that produced it, because asynchronous training mixes slightly stale data with fresh data. ## How do I isolate one instance from another? Give each episode its own instance started from the same pinned image, with its own CPU and memory limits, and throw it away afterwards. On a hosted service, each provider states how one instance is kept apart from another and offers outbound network settings, each on its own pages, all read 2026-11-26: - **Promigence.** Every copy in a run starts from the same snapshot. Its security page says "No sandbox can see, reach or address another, yours or anyone else's" and that the boundary is tested "by attacking it rather than asserting it"; its FAQ lists three outbound settings per sandbox, full access, none or an allow-list, with refused connections recorded. - **AWS.** "Session isolation prevents cross-session data contamination and ensures security" ([AgentCore Runtime guide](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-how-it-works.html)); AgentCore Code Interpreter takes a network mode of `PUBLIC`, `SANDBOX` or `VPC` ([network configuration](https://docs.aws.amazon.com/bedrock-agentcore-control/latest/APIReference/API_CodeInterpreterNetworkConfiguration.html)). - **Daytona.** "Each sandbox runs in isolation, giving it a dedicated kernel, filesystem, network stack, and allocated vCPU, RAM, and disk" ([Daytona sandboxes](https://www.daytona.io/docs/en/sandboxes)); its outbound settings are `networkBlockAll`, a CIDR allow-list or a domain allow-list ([network limits](https://www.daytona.io/docs/en/network-limits)). - **E2B.** Its documentation describes "isolated sandboxes that let agents safely execute code, process data, and run tools" ([E2B documentation](https://e2b.dev/docs)); its outbound settings are `allowInternetAccess: false` and allow and deny lists ([internet access](https://e2b.dev/docs/sandbox/internet-access)). - **Google Cloud.** Agent Sandbox on GKE runs AI-generated code "in an isolated sandbox" on a GKE cluster ([Agent Sandbox on GKE](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/agent-sandbox)); Agent Platform's code execution sandboxes run without outbound internet access ([Agent Platform sandboxes](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox)). - **Modal.** "Each container runs in its own sandbox, isolated from the host" ([Modal security](https://modal.com/docs/guide/security)); its outbound settings are `block_network=True` and CIDR and domain allow-lists ([Modal networking](https://modal.com/docs/guide/sandbox-networking)). With containers on machines you run yourself: 1. **One episode, one instance.** An agent that can write files or change a database must not share them with another episode. 2. **Fixed limits.** With Docker, `--cpus` sets "how much of the available CPU resources a container can use", and `-m` or `--memory` sets "The maximum amount of memory the container can use" ([Docker resource constraints](https://docs.docker.com/engine/containers/resource_constraints/), read 2026-11-26). Same limits for every instance keep step times comparable. 3. **Plan for memory kills.** Docker's documentation notes that by default, when an out-of-memory error occurs, the kernel kills processes in the container (same page). Report that as an environment failure, not as an agent failure. 4. **No outbound network unless the task needs it.** It keeps instances from depending on outside services that change. 5. **Fresh start instead of cleanup.** Starting a new copy from the image is the most reliable reset. ## How much compute does a batch of episodes need? Compute for a batch of episodes is episodes times hours per episode times the resources each instance holds. The worked example below uses illustrative workload numbers and prices them at published list rates, so the arithmetic is concrete: first at Promigence's rates, then at the rates of five other named providers. Table: Worked example priced at Promigence's listed rates (illustrative workload) | Line | Example value | |---|---| | Episodes in the batch | 1,000 | | Average episode length | 10 minutes | | CPU per instance | 4 vCPU | | Memory per instance | 8 GiB | | vCPU-hours | 1,000 × 4 × 10 ÷ 60 = 666.7 | | GiB-hours | 1,000 × 8 × 10 ÷ 60 = 1,333.3 | | CPU at $0.0504 per vCPU-hour | $33.60 | | Memory at $0.0162 per GiB-hour | $21.60 | | Environment compute for the batch | $55.20 | The rates in the table are Promigence's list prices, $0.0504 per vCPU-hour plus $0.0162 per GiB-hour, metered per second, as its FAQ states them (read 2026-11-26). Per-second metering is what keeps the example at $55.20: agent episodes vary in length, and under per-hour rounding each 10-minute episode would be charged as a full hour, six times its use. Model inference is a separate cost and is outside these hours. The same batch at five other providers' published rates, in each rate's own units, comes to the figures below. The totals are this site's arithmetic on those rates, not quotes from the providers. Table: The illustrative batch at AWS, Daytona, E2B, Google Cloud and Modal published rates (rates read 2026-11-26) | Provider | Published rates | Environment compute for the batch | How the rate is applied | Source | |---|---|---|---|---| | AWS (Amazon Bedrock AgentCore Code Interpreter) | $0.0895 per vCPU-hour, $0.00945 per GB-hour | $73.20 at these rates if 4 vCPUs were in use for every episode minute: 666.7 × $0.0895 plus 1,431.7 GB-hours (8 GiB is 8.59 GB) × $0.00945 | Per second, on actual CPU use and peak memory, so idle CPU time lowers the total; a session's hardware configuration is 2 vCPU and 8 GB | [AgentCore pricing](https://aws.amazon.com/bedrock/agentcore/pricing/), [AgentCore quotas](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/bedrock-agentcore-limits.html) | | Daytona | $0.0504/h per vCPU, $0.0162/h per GiB of memory | $55.20 | Calculated per second, on the resources reserved for the sandbox | [Daytona pricing](https://www.daytona.io/pricing), [Daytona billing](https://www.daytona.io/docs/en/billing) | | E2B | $0.000014/s per vCPU, $0.0000045/s per GiB of memory | $55.20 | Per second while the sandbox runs; the Pro plan is $150 a month | [E2B pricing](https://e2b.dev/pricing) | | Google Cloud (Gemini Enterprise Agent Platform sandboxes) | $0.085/vCPU-h, $0.009/GiB-h | $68.67: 666.7 × $0.085 plus 1,333.3 × $0.009 | On the vCPU and memory allocated, rounded to the nearest second | [Agent Platform pricing](https://cloud.google.com/products/gemini-enterprise-agent-platform/pricing) | | Modal (Sandboxes) | $0.00003942 / core / sec for a physical core (2 vCPU equivalent), $0.00000667 / GiB / sec | $79.32 with 2 cores and 8 GiB requested: 600,000 sandbox-seconds × (2 × $0.00003942 + 8 × $0.00000667) | On the higher of the request and actual use, at the non-preemptible rates Sandboxes are billed at | [Modal pricing](https://modal.com/pricing), [Sandbox resources](https://modal.com/docs/guide/sandbox-resources) | ## How do I cap the cost of a batch before it starts? Price the batch at its worst case before starting it, every instance running until its timeout, and refuse to start if that ceiling is above your budget. On a hosted service, Promigence's `promigence run quote` prices a run before any environment starts, assuming every sandbox runs until its timeout, and `--cap` makes the run itself refuse to start when its quote is above the cap, according to its quickstart (read 2026-11-26). Its FAQ adds that a sandbox that reaches the cap while it runs "is paused with its files kept", and that "Paused time is not invoiced". The quickstart's commands, with an environment snapshot named `orders-env` as our example: ```bash promigence run quote --snapshot orders-env --count 20 --timeout 15m promigence run --snapshot orders-env --count 20 --cap 1 -- sh -c "python3 /work/env/run_episode.py" ``` Here `run_episode.py` stands for your own episode script. The other named providers publish the two inputs to such a ceiling, a time limit per instance and a spending control on the account (all read 2026-11-26): - **AWS.** AgentCore Code Interpreter sessions end after a configurable timeout, 15 minutes by default ([Code Interpreter sessions](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-resource-session-management.html)), and AWS Budgets cost budgets "Set spending limits for services and receive alerts when costs approach or exceed your defined threshold" ([AWS Budgets](https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-managing-costs.html)). - **Daytona.** A wall-clock TTL "sets a hard upper bound on how long a sandbox may exist" ([Daytona sandboxes](https://www.daytona.io/docs/en/sandboxes)), and the Spending view lists the total price of each sandbox ([Daytona billing](https://www.daytona.io/docs/en/billing)). - **E2B.** A sandbox's timeout defaults to 5 minutes ([E2B sandbox lifetime](https://e2b.dev/docs/faq/sandbox-lifetime)), and spending limits can be set on the Limits page of its console ([E2B billing and limits](https://e2b.dev/docs/billing)). - **Google Cloud.** A `ttl` set when an Agent Platform sandbox is created removes it automatically ([Manage sandboxes](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-sandboxes)); Cloud Billing alerts-only budgets do not cap spending, and spend cap budgets can be set on a project where the service supports them ([Cloud Billing budgets](https://docs.cloud.google.com/billing/docs/how-to/budgets)). - **Modal.** A Sandbox timeout can be set up to 24 hours, with 5 minutes as the default ([Modal Sandboxes](https://modal.com/docs/guide/sandboxes)), and a Workspace budget limits monthly spend ([Modal pricing](https://modal.com/pricing)). On infrastructure you run yourself, the same guard is one line of arithmetic in the launcher: instances × timeout × resources × rate, compared with the budget before the first instance starts. A ceiling-based quote is deliberately pessimistic: if most episodes end early, the bill is below it. ## What should I measure when scaling up? Measure where an episode's time goes and how often the environment, not the agent, causes a failure. 1. **Start time** of an instance, from request to first observation. 2. **Step time** split into model time and environment time. 3. **Environment failure rate**: crashes, memory kills, timeouts of the app itself. 4. **Reward drift** when you change the number of parallel instances. If rewards drop as concurrency rises, instances are starving each other. ## What we read for this article - [Gymnasium registry API (make_vec)](https://gymnasium.farama.org/api/registry/), read 2026-11-26 - [Gymnasium SyncVectorEnv](https://gymnasium.farama.org/api/vector/sync_vector_env/), read 2026-11-26 - [Gymnasium AsyncVectorEnv](https://gymnasium.farama.org/api/vector/async_vector_env/), read 2026-11-26 - [Farama: vector autoreset modes](https://farama.org/Vector-Autoreset-Mode), read 2026-11-26 - [AReaL (arXiv 2505.24298)](https://arxiv.org/abs/2505.24298), read 2026-11-26 - [Docker resource constraints](https://docs.docker.com/engine/containers/resource_constraints/), read 2026-11-26 - [https://www.promigence.ai/docs/quickstart](https://www.promigence.ai/docs/quickstart), read 2026-11-26 - [https://www.promigence.ai/faq](https://www.promigence.ai/faq), read 2026-11-26 - [https://www.promigence.ai/](https://www.promigence.ai/), read 2026-11-26 - [https://www.promigence.ai/security](https://www.promigence.ai/security), read 2026-11-26 - [https://www.promigence.ai/for/rl-environments](https://www.promigence.ai/for/rl-environments), read 2026-11-26 - [AWS: AgentCore Runtime guide](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-how-it-works.html), [AgentCore pricing](https://aws.amazon.com/bedrock/agentcore/pricing/), [AgentCore quotas](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/bedrock-agentcore-limits.html), [Code Interpreter sessions](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-resource-session-management.html), [CodeInterpreterNetworkConfiguration](https://docs.aws.amazon.com/bedrock-agentcore-control/latest/APIReference/API_CodeInterpreterNetworkConfiguration.html) and [AWS Budgets](https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-managing-costs.html), read 2026-11-26 - [Daytona: Pricing](https://www.daytona.io/pricing), [Billing](https://www.daytona.io/docs/en/billing), [Snapshots](https://www.daytona.io/docs/en/snapshots), [Sandboxes](https://www.daytona.io/docs/en/sandboxes), [Network limits](https://www.daytona.io/docs/en/network-limits) and [home page](https://www.daytona.io/), read 2026-11-26 - [E2B: Documentation overview](https://e2b.dev/docs), [Pricing](https://e2b.dev/pricing), [Billing and limits](https://e2b.dev/docs/billing), [How long does a sandbox live?](https://e2b.dev/docs/faq/sandbox-lifetime), [Internet access](https://e2b.dev/docs/sandbox/internet-access) and [Template: how it works](https://e2b.dev/docs/template/how-it-works), read 2026-11-26 - [Google Cloud: Agent Sandbox on GKE](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/agent-sandbox), [Gemini Enterprise Agent Platform pricing](https://cloud.google.com/products/gemini-enterprise-agent-platform/pricing), [Agent Platform sandboxes overview](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox), [Manage sandboxes](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-sandboxes), [Manage snapshots](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-snapshots) and [Cloud Billing budgets](https://docs.cloud.google.com/billing/docs/how-to/budgets), read 2026-11-26 - [Modal: Pricing](https://modal.com/pricing), [Sandboxes product page](https://modal.com/products/sandboxes), [Sandboxes guide](https://modal.com/docs/guide/sandboxes), [Sandbox resources](https://modal.com/docs/guide/sandbox-resources), [Networking and security](https://modal.com/docs/guide/sandbox-networking) and [Security](https://modal.com/docs/guide/security), read 2026-11-26 ## FAQ ### What is the difference between SyncVectorEnv and AsyncVectorEnv? SyncVectorEnv steps its sub-environments one after another in the same process. AsyncVectorEnv runs each in its own process and talks to them through pipes, so slow steps overlap. For agent environments, where a step waits on an app or a test run, the asynchronous form is usually the one you want. ### Why does synchronous rollout collection waste time with LLM agents? Agent episodes differ a lot in length. If a batch waits for every episode to finish, the hardware sits idle behind the longest one. The AReaL paper describes generation that must wait until the longest output in the batch is completed, and reports up to 2.77 times faster training by decoupling generation from training. ### Should environment instances share a container? Not if the agent can change anything. One instance per episode, started from the same image, keeps one episode's changes from leaking into the next and makes resets a matter of starting a fresh copy. ### How many environment instances can I run per machine? Divide the machine's CPUs and memory by each instance's limits, then leave headroom. Measure an instance's real use under a busy episode first; app clones with databases often need more memory than the agent's own process. --- # How to version agent environments so runs can be reproduced URL: https://www.agenticrlenvironments.com/guide/version-and-reproduce-agent-environments/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 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. 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 | Component | Pin it by | Example of a change that needs a new version | |---|---|---| | Environment code | A commit hash | A tool now returns more fields | | Container image | Its digest | A rebuilt image picks up a new library release | | Data | A hash of the dump or loader plus its seed | A generator library update changes names | | Task set | A hash of the sorted task list | Tasks added, removed or reworded | | Grader | A commit hash, and its test set | A new assertion on unchanged state | | Limits | Values in the registration | `max_episode_steps` raised from 30 to 50 | | Clock | The start date the app sees | Tasks 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](https://gymnasium.farama.org/api/registry/), read 2026-11-26). Its custom environment guide recommends the full form, such as `gymnasium_env/GridWorld-v0`, for clarity ([Gymnasium custom environment guide](https://gymnasium.farama.org/introduction/create_custom_env/), 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): ```bash promigence snapshot create \ --image python:3.12 \ --setup "git clone https://github.com// /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) | Provider | How the environment is built and checked | How a version is pinned and kept | Source | |---|---|---|---| | AWS (Amazon Bedrock AgentCore Runtime) | Deployed from your code directly or from a container image | Every update creates a new version, immutable once created, and an endpoint can point at a specific version | [Runtime versioning](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agent-runtime-versioning.html) | | Daytona | A snapshot is built from an image or a Dockerfile, and any number of sandboxes can start from it | The 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 use | [Snapshots](https://www.daytona.io/docs/en/snapshots) | | E2B | A template build runs the start command, waits for the ready command, which repeats until it exits 0, then snapshots the sandbox | Tags version a template, and a build ID pins a sandbox to one exact build | [How it works](https://e2b.dev/docs/template/how-it-works), [Start and ready commands](https://e2b.dev/docs/template/start-ready-command), [Tags and versioning](https://e2b.dev/docs/template/tags) | | 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 one | A 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 image | [Manage templates](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-templates), [Manage snapshots](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-snapshots) | | Modal | Named Images are built with `Image.build`; an exec readiness probe passes when its command exits 0 | External image tags are treated as immutable once pulled; filesystem snapshots are Images kept for 30 days by default, which you can change | [Sandboxes guide](https://modal.com/docs/guide/sandboxes), [Snapshots](https://modal.com/docs/guide/sandbox-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](https://docs.docker.com/reference/cli/docker/image/pull/), read 2026-11-26): ```bash 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](https://faker.readthedocs.io/en/master/), 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: ```bash 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](https://gymnasium.farama.org/api/env/), 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](https://www.agenticrlenvironments.com/guide/wrap-a-tool-use-task-as-a-gymnasium-environment/) 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](https://arxiv.org/html/2405.14573), read 2026-11-26), and TextWorld's game generator takes a `--seed` ([TextWorld repository](https://github.com/microsoft/TextWorld), 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 | Change | New version? | |---|---| | Grader now also checks unchanged state | Yes | | Tool output gains a new field | Yes, the observation changed | | Image rebuilt with a new library release | Yes, unless replay tests show identical state and rewards | | Tasks reworded for clarity | Yes | | Code refactor, all replay tests identical | No | | Faster reset, same state afterwards | No | ## What we read for this article - [Gymnasium registry API](https://gymnasium.farama.org/api/registry/), read 2026-11-26 - [Gymnasium custom environment guide](https://gymnasium.farama.org/introduction/create_custom_env/), read 2026-11-26 - [Gymnasium Env API](https://gymnasium.farama.org/api/env/), read 2026-11-26 - [docker image pull: pull by digest](https://docs.docker.com/reference/cli/docker/image/pull/), read 2026-11-26 - [Faker documentation](https://faker.readthedocs.io/en/master/), read 2026-11-26 - [AndroidWorld (arXiv 2405.14573)](https://arxiv.org/html/2405.14573), read 2026-11-26 - [TextWorld repository](https://github.com/microsoft/TextWorld), read 2026-11-26 - [https://www.promigence.ai/docs/quickstart](https://www.promigence.ai/docs/quickstart), read 2026-11-26 - [https://www.promigence.ai/faq](https://www.promigence.ai/faq), read 2026-11-26 - [https://www.promigence.ai/docs/cli](https://www.promigence.ai/docs/cli), read 2026-11-26 - [AWS: AgentCore Runtime versioning and endpoints](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agent-runtime-versioning.html), read 2026-11-26 - [Daytona: Snapshots](https://www.daytona.io/docs/en/snapshots), read 2026-11-26 - [E2B: Template, how it works](https://e2b.dev/docs/template/how-it-works), [Start and ready commands](https://e2b.dev/docs/template/start-ready-command) and [Template tags and versioning](https://e2b.dev/docs/template/tags), read 2026-11-26 - [Google Cloud: Manage sandbox templates](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-templates) and [Manage snapshots](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-snapshots), read 2026-11-26 - [Modal: Sandboxes guide](https://modal.com/docs/guide/sandboxes) and [Sandbox snapshots](https://modal.com/docs/guide/sandbox-snapshots), read 2026-11-26 ## FAQ ### 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. --- # What is an agentic RL environment? State, actions, observations and reward URL: https://www.agenticrlenvironments.com/guide/what-is-an-agentic-rl-environment/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 An agentic RL environment is a program an AI agent acts in over many turns. It holds hidden state, accepts actions such as tool calls, returns observations such as text or screenshots, and pays a reward when it checks the outcome. Gymnasium's reset and step are the usual way to write one. An agentic RL environment is the world an AI agent acts in during training or evaluation: a program with its own state, a set of actions the agent may take, what the agent gets to see after each action, and a rule that scores the result. "Agentic" means the agent takes many steps, usually by calling tools, running commands or using an application, before anything is scored. ## What are the parts of an agent environment? An agent environment has five parts: state, actions, observations, reward and an end condition. Table: The parts of an agent environment, with examples from published environments | Part | What it is | Example | |---|---|---| | State | Everything the environment knows, most of which the agent does not observe | The orders, users and products in a shop's database | | Action | What the agent may do in one step | A tool call, a shell command, a click, a search query | | Observation | What the agent sees after an action | A tool's text output, a web page, test results, a screenshot | | Reward | A number that says how well the agent did | 1 if the right order was cancelled and nothing else changed, else 0 | | End condition | When the episode stops | The agent says it is done, or a step limit is reached | Published environments fill these slots in different ways. WebShop, a simulated shopping site, gives two kinds of action: a search with a text query and a click on a text button, and it computes a reward between 0 and 1 by matching the bought product's attributes, options and price against the instruction ([WebShop paper, arXiv 2207.01206](https://arxiv.org/abs/2207.01206), read 2026-11-26). AppWorld, a world of nine apps operated through 457 APIs, lets the agent write code against those APIs and scores the result with state-based unit tests that also look for collateral damage ([AppWorld, arXiv 2407.18901](https://arxiv.org/abs/2407.18901), read 2026-11-26). ## How does Gymnasium define an environment? Gymnasium defines an environment as a class with two main methods, `reset` and `step`, and two declared spaces, `action_space` and `observation_space`. 1. `reset(seed=None, options=None)` starts an episode and returns the first observation and an info dictionary. Passing an integer seed re-initialises the environment's random number generator, so the same seed gives the same start. 2. `step(action)` applies one action and returns five values: `observation, reward, terminated, truncated, info`. 3. `action_space` and `observation_space` describe which actions and observations are valid. 4. `close()` releases resources; the documentation names "database or HTTP connections" among them. The Gymnasium API reference describes `terminated` as "Whether the agent reaches the terminal state (as defined under the MDP of the task)" and `truncated` as "Whether the truncation condition outside the scope of the MDP is satisfied", typically a time limit ([Gymnasium Env API](https://gymnasium.farama.org/api/env/), read 2026-11-26). Gymnasium replaced the older single `done` flag with these two in version 0.26 (same page). The current release on PyPI is gymnasium 1.4.0, published 5 October 2026, for Python 3.10 or later ([gymnasium on PyPI](https://pypi.org/project/gymnasium/), read 2026-11-26). The library's introduction calls the cycle of observe, act and receive a new state and reward the "agent-environment loop", repeated until the episode ends ([Gymnasium basic usage](https://gymnasium.farama.org/introduction/basic_usage/), read 2026-11-26). ## Why does the terminated and truncated split matter for agents? The split matters because a learning algorithm must treat "the task ended" and "we ran out of steps" differently. When an episode is truncated, the agent might still have succeeded with more steps, so the value of the last state is not zero. When it is terminated, the outcome is final. For language agents this shows up as two common rules: 1. **Terminate** when the agent calls a `finish` or `submit` tool, or does something the task defines as fatal, such as deleting the record it was meant to fix. 2. **Truncate** at a step limit or a wall-clock limit. Gymnasium's `register` takes `max_episode_steps`, "The maximum number of episodes steps before truncation" ([Gymnasium registry API](https://gymnasium.farama.org/api/registry/), read 2026-11-26). Never record a truncated episode as a failure of the task in training data without saying so. It mixes "wrong answer" with "too slow". ## Why are agent environments partially observable? Agent environments are partially observable because the agent sees only what its tools and screens show, not the state behind them. A shop's database, a repository's full history or a server's logs exist whether or not the agent looks. The ScienceWorld paper notes that most approaches to interactive text environments "frame reasoning as a partially-observable Markov decision process (POMDP)" ([ScienceWorld paper, arXiv 2203.07540](https://arxiv.org/abs/2203.07540), read 2026-11-26). In practice this means: - The observation is a view, not the state. Design it on purpose: what a real user of the app would see. - The agent has to take actions that only gather information, such as reading a file or listing orders. - The reward should be computed from the hidden state, not from what the agent says it did. ## What makes an environment "agentic" rather than single-turn? An environment is agentic when the agent must take several actions, each depending on what the previous ones returned, before the outcome is known. A single-turn task, such as answering one math question, has one action and one reward. Table: Single-turn tasks and agentic environments compared | | Single-turn task | Agentic environment | |---|---|---| | Actions per episode | One answer | Many tool calls, commands or clicks | | State | None, or the prompt only | A database, file system, app or simulated world | | Reward from | Comparing the answer with a reference | Checking the final state, running tests, or both | | What can go wrong outside the agent | Little | Services time out, state leaks between episodes, tools change | | Cost of one episode | One model call | Many model calls plus the environment's compute | SWE-Gym is an example of the agentic kind: each of its 2,438 Python task instances comes with "a codebase with an executable runtime environment, unit tests, and a task specified in natural language" ([SWE-Gym, arXiv 2412.21139](https://arxiv.org/abs/2412.21139), read 2026-11-26). ## What should I decide before building one? Decide five things before writing code: 1. **The action interface.** Tool calls as JSON, shell commands, code, or screen actions. Fewer, clearer actions make credit assignment easier. 2. **The observation.** What a capable person doing the job would see, trimmed to fit the model's context. 3. **The reward.** Which final state counts as success, and how a program checks it. 4. **The limits.** Maximum steps, maximum time, and which actions end the episode at once. 5. **The seed.** Which parts of a task are random, and how one integer reproduces them. The rest of this site covers each step: [wrapping a task in the Gymnasium API](https://www.agenticrlenvironments.com/guide/wrap-a-tool-use-task-as-a-gymnasium-environment/), [cloning a web app](https://www.agenticrlenvironments.com/guide/clone-a-web-app-as-an-rl-environment/), [generating tasks](https://www.agenticrlenvironments.com/guide/generate-tasks-for-agent-environments/), [writing graders](https://www.agenticrlenvironments.com/guide/write-a-grader-for-an-agent-environment/) and [designing rewards](https://www.agenticrlenvironments.com/guide/reward-design-for-agentic-rl/). ## What we read for this article - [Gymnasium Env API](https://gymnasium.farama.org/api/env/), read 2026-11-26 - [Gymnasium basic usage](https://gymnasium.farama.org/introduction/basic_usage/), read 2026-11-26 - [Gymnasium registry API](https://gymnasium.farama.org/api/registry/), read 2026-11-26 - [gymnasium on PyPI](https://pypi.org/project/gymnasium/), read 2026-11-26 - [WebShop (arXiv 2207.01206)](https://arxiv.org/abs/2207.01206), read 2026-11-26 - [AppWorld (arXiv 2407.18901)](https://arxiv.org/abs/2407.18901), read 2026-11-26 - [ScienceWorld (arXiv 2203.07540)](https://arxiv.org/abs/2203.07540), read 2026-11-26 - [SWE-Gym (arXiv 2412.21139)](https://arxiv.org/abs/2412.21139), read 2026-11-26 ## FAQ ### What is the difference between an environment and a benchmark? An environment is the world the agent acts in, plus its reward. A benchmark is a fixed set of tasks in one or more environments, with a scoring rule and a published leaderboard. The same environment can serve training, where tasks are generated freely, and evaluation, where a frozen task set is used. ### What is the difference between terminated and truncated in Gymnasium? Terminated means the episode reached an end defined by the task, such as success or an unrecoverable failure. Truncated means it was cut off for a reason outside the task, usually a step or time limit. Gymnasium returns both flags from step, and you reset the environment when either is true. ### Why is an agent environment partially observable? Because the agent only sees what its tools return or what is on screen, never the full database, file system or server state behind them. Text environments are often framed as partially observable Markov decision processes for this reason. ### Does an LLM agent environment need a numeric reward? For reinforcement learning, yes. For evaluation, a pass or fail is enough, and it is the same check. Many agent environments give a reward only at the end, from a program that inspects the final state. --- # How to wrap a tool-use task as a Gymnasium environment for an LLM agent URL: https://www.agenticrlenvironments.com/guide/wrap-a-tool-use-task-as-a-gymnasium-environment/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Subclass gymnasium.Env, declare Text spaces for actions and observations, build the task from self.np_random in reset, parse each action as a tool call in step, and compute the reward from the final state. Register it with a versioned id and max_episode_steps, then run the environment checker. To turn a tool-use task into a Gymnasium environment, put the task's state in a class that subclasses `gymnasium.Env`, let `reset` create a new task from a seed, let `step` run one tool call and return what the tool said, and give a reward only when a program checks the final state. The example below is complete and was run as published. ## What does the finished environment do? The environment below asks an agent to cancel a customer's one pending order out of three, without touching the others. The agent acts by sending one JSON tool call per step: `get_order`, `cancel_order` or `finish`. The reward is 1 when the pending order is cancelled and the shipped ones are unchanged, and 0 otherwise. Table: The example environment's interface | Element | In this example | |---|---| | Action | A JSON string such as `{"tool": "cancel_order", "id": "A715"}` | | Observation | The task text after reset, then each tool's text output | | State | A dictionary of three orders and which one is the target | | Reward | 1.0 or 0.0, computed when the agent calls `finish` | | Terminated | When the agent calls `finish` | | Truncated | After 10 steps, set by `max_episode_steps` at registration | ## Step 1: How do I install a pinned Gymnasium? Install Gymnasium at a fixed version in a fresh virtual environment, so the example behaves the same later. ```bash python3 -m venv .venv .venv/bin/pip install gymnasium==1.4.0 ``` Gymnasium 1.4.0 was released on 5 October 2026 and needs Python 3.10 or later ([gymnasium on PyPI](https://pypi.org/project/gymnasium/), read 2026-11-26). We ran the code on this page with it under Python 3.14. ## Step 2: How do I declare text actions and observations? Declare both spaces as `gymnasium.spaces.Text` with an explicit character set. The constructor is `Text(max_length, *, min_length=1, charset=..., seed=None)`, and its default character set is "the lower and upper english alphabet plus latin digits" ([Gymnasium fundamental spaces](https://gymnasium.farama.org/api/spaces/fundamental/), read 2026-11-26). JSON needs braces, quotes and spaces, so the example uses Python's `string.printable`. ## Step 3: How do I write reset, step and the grader? Write `reset` to build a task from the environment's own random generator, `step` to run one tool call, and a private `_grade` method that inspects the state. Gymnasium's guide says that in `reset` "you must call `super().reset(seed=seed)` to properly initialize the random number generator" ([Gymnasium custom environment guide](https://gymnasium.farama.org/introduction/create_custom_env/), read 2026-11-26). Save this as `orders_env.py`: ```python import json import string import gymnasium as gym from gymnasium import spaces TEXT = string.printable class OrdersEnv(gym.Env): """A tool-use task: cancel the customer's pending order, leave the others alone.""" metadata = {"render_modes": []} def __init__(self): self.observation_space = spaces.Text(max_length=4096, charset=TEXT) self.action_space = spaces.Text(max_length=512, charset=TEXT) self.orders = {} self.target = None def reset(self, *, seed=None, options=None): super().reset(seed=seed) ids = [f"A{n}" for n in self.np_random.choice(900, size=3, replace=False) + 100] self.orders = {i: "shipped" for i in ids} self.target = ids[int(self.np_random.integers(3))] self.orders[self.target] = "pending" task = ( "Task: the customer wants their pending order cancelled. " f"Their orders are {', '.join(ids)}. " 'Reply with one JSON tool call: {"tool": "get_order", "id": ...}, ' '{"tool": "cancel_order", "id": ...} or {"tool": "finish"}.' ) return task, {"target": self.target} def step(self, action): try: call = json.loads(action) tool = call["tool"] except (ValueError, KeyError, TypeError): return "Error: not a JSON tool call.", 0.0, False, False, {} if tool == "get_order" and call.get("id") in self.orders: obs = f"Order {call['id']}: {self.orders[call['id']]}" return obs, 0.0, False, False, {} if tool == "cancel_order" and call.get("id") in self.orders: self.orders[call["id"]] = "cancelled" return f"Order {call['id']} cancelled.", 0.0, False, False, {} if tool == "finish": reward = self._grade() return "Episode finished.", reward, True, False, {"orders": dict(self.orders)} return f"Error: unknown tool or order: {action}", 0.0, False, False, {} def _grade(self): # Outcome check on the final state: the pending order is cancelled # and no other order was touched. others_ok = all(s == "shipped" for i, s in self.orders.items() if i != self.target) return 1.0 if self.orders[self.target] == "cancelled" and others_ok else 0.0 gym.register(id="toolenv/Orders-v0", entry_point=OrdersEnv, max_episode_steps=10) ``` Three design choices in this code matter for any agent environment: 1. **The target goes in `info`, not in the observation.** The trainer can log it; the agent cannot read it. 2. **A bad action costs a step, not the episode.** The agent sees an error and can try again. 3. **The grader reads state, not the transcript.** An agent that says "done" without cancelling gets 0. ## Step 4: How do I register it with a version and a step limit? Register the class with `gymnasium.register`, an id of the form `namespace/Name-vN`, and `max_episode_steps`. Gymnasium's registry documents the id syntax as `[namespace/](env_name)[-v(version)]` ([Gymnasium registry API](https://gymnasium.farama.org/api/registry/), read 2026-11-26). The custom environment guide recommends the full form with namespace and version for clarity, and uses `max_episode_steps` to "Prevent infinite episodes" (Gymnasium custom environment guide, read 2026-11-26). The last line of `orders_env.py` does this. ## Step 5: How do I check that it works? Run Gymnasium's environment checker, play one episode with a scripted policy, and confirm that the step limit and the seed behave. Save this as `run.py` next to `orders_env.py`: ```python import json import gymnasium as gym from gymnasium.utils.env_checker import check_env import orders_env # registers toolenv/Orders-v0 env = gym.make("toolenv/Orders-v0") check_env(env.unwrapped) obs, info = env.reset(seed=7) ids = obs.split("orders are ")[1].split(".")[0].split(", ") pending = None for i in ids: obs, r, term, trunc, info = env.step(json.dumps({"tool": "get_order", "id": i})) if obs.endswith("pending"): pending = i env.step(json.dumps({"tool": "cancel_order", "id": pending})) obs, r, term, trunc, info = env.step(json.dumps({"tool": "finish"})) print("reward", r, "terminated", term, "truncated", trunc) obs, info = env.reset(seed=7) for t in range(20): obs, r, term, trunc, info = env.step('{"tool": "get_order", "id": "nope"}') if term or trunc: print("stopped after", t + 1, "steps; truncated =", trunc) break a, _ = env.reset(seed=123) b, _ = env.reset(seed=123) print("same task for same seed:", a == b) env.close() ``` Run it with warnings turned into errors, so a checker warning cannot pass unnoticed: ```bash .venv/bin/python -W error::UserWarning run.py ``` Our run printed: ```text reward 1.0 terminated True truncated False stopped after 10 steps; truncated = True same task for same seed: True ``` ## How do I connect a language model to it? Connect a model by turning each observation into a message and each model reply into the next action. A minimal loop: 1. Call `env.reset(seed=...)` and send the observation as the first user message. 2. Ask the model for one tool call, and pass its text to `env.step`. 3. Append the observation to the conversation and repeat until `terminated` or `truncated`. 4. Store the whole trajectory with the seed, the environment id and the reward. For training, the reward from step 4 is what the RL algorithm optimises. The same environment, with a frozen list of seeds, is an evaluation set. To run many copies at once, see [scaling environment instances](https://www.agenticrlenvironments.com/guide/scale-environment-instances-for-rl/). ## What we read for this article - [Gymnasium custom environment guide](https://gymnasium.farama.org/introduction/create_custom_env/), read 2026-11-26 - [Gymnasium fundamental spaces (Text, Discrete)](https://gymnasium.farama.org/api/spaces/fundamental/), read 2026-11-26 - [Gymnasium registry API](https://gymnasium.farama.org/api/registry/), read 2026-11-26 - [Gymnasium Env API](https://gymnasium.farama.org/api/env/), read 2026-11-26 - [gymnasium on PyPI](https://pypi.org/project/gymnasium/), read 2026-11-26 ## FAQ ### Can Gymnasium spaces hold text? Yes. gymnasium.spaces.Text holds strings between a minimum and maximum length over a character set. The default character set is only English letters and digits, so set charset to string.printable or your own set if actions and observations contain spaces, quotes or punctuation. ### Where should the randomness of a task come from? From self.np_random, after calling super().reset(seed=seed) on the first line of reset. Then the same seed always produces the same task, which you need for debugging and for fair comparisons between agents. ### What should happen when the agent sends an action that does not parse? Return an error message as the observation with zero reward and let the episode go on. The step limit set with max_episode_steps will truncate an agent that never recovers. Ending the episode on the first malformed call makes learning harder for little benefit. ### Do I need a Gymnasium environment to train an LLM agent? No. Many RL libraries for language models use their own interfaces. Writing the environment against reset and step still pays off, because the task, the tools and the grader live in one testable class that any training loop can call. --- # How to write a grader or verifier for an agent environment URL: https://www.agenticrlenvironments.com/guide/write-a-grader-for-an-agent-environment/ Author: AgenticRLEnvironments editors Published: 2026-11-26 Updated: 2026-11-26 Write a grader that checks the final state with code, also checks what must not have changed, runs where the agent cannot touch it, and is tested with right, wrong and empty answers. Keep environment errors out of the reward, and use a model as judge only for what code cannot check. A grader is the code that decides an episode's reward. For agent environments it should inspect what the agent did to the world, not what the agent said it did, and it should be tested as carefully as the environment itself, because every flaw in it becomes something the agent learns. ## What kinds of graders do agent environments use? Agent environments use four kinds of grader: state checks, test suites, answer matching and model judges. Table: Kinds of grader, with published examples | Grader | What it checks | Published example | Main risk | |---|---|---|---| | State check | The database, files or app state after the episode | AppWorld's state-based unit tests, which also check for collateral damage ([arXiv 2407.18901](https://arxiv.org/abs/2407.18901)) | Missing a side effect you did not think to check | | Test suite | Tests that must go from fail to pass, and stay passing | SWE-bench: solved when "all tests across FAIL_TO_PASS and PASS_TO_PASS pass" ([arXiv 2310.06770](https://arxiv.org/html/2310.06770)) | Tests too weak to catch a wrong fix | | Answer or attribute matching | The returned answer or chosen item against the goal | WebShop scores attributes, options and price against the instruction ([arXiv 2207.01206](https://arxiv.org/html/2207.01206)) | Formatting differences marked wrong | | Model judge | Open-ended output, rated by a language model | The MT-Bench judge study ([arXiv 2306.05685](https://arxiv.org/abs/2306.05685)) | Judge bias and judge exploitation | All read 2026-11-26. ## Step 1: How do I write a state-check grader? Write it as a set of assertions about the final state, run after the episode ends. 1. List the facts that must be true for success: "order A715 status is cancelled". 2. List the facts that must stay true: "orders A948 and A661 are still shipped", "no new refunds were issued". 3. Read both from the environment's database or API, not from the agent's transcript. 4. Return 1 only if every assertion holds; return partial credit only if you have decided you want it (see [reward design](https://www.agenticrlenvironments.com/guide/reward-design-for-agentic-rl/)). 5. Log which assertion failed. That log is how you debug both agents and graders. The second list is what most first graders miss. A grader that only checks "the order is cancelled" pays an agent that cancels every order. ## Step 2: How do I write a test-based verifier for code tasks? Use two test sets: tests that fail before the fix and must pass after it, and tests that pass before and must still pass. SWE-bench calls them `FAIL_TO_PASS` and `PASS_TO_PASS`, and counts a task as solved only if both sets pass after the patch is applied (SWE-bench paper, read 2026-11-26). Three rules keep this honest: 1. **Run the tests from a clean copy the agent never touched.** Copy the agent's changes to source files only, then add the original tests back. 2. **Check the tests are strong.** Run a few plausible wrong fixes; at least one test should fail for each. 3. **Treat test-file edits as suspicious.** If the agent's change touches tests, either discard those edits or fail the episode. The ABC checklist paper found that "SWE-bench Verified uses insufficient test cases" ([Zhu et al., arXiv 2507.02825](https://arxiv.org/abs/2507.02825), read 2026-11-26): strong-looking tests can still accept wrong patches. ## Step 3: When should I use a model as judge? Use a model as judge only when the result cannot be checked by code, such as the quality of a written explanation, and keep it narrow. The MT-Bench study reports that strong model judges reach "over 80% agreement" with human preferences, "the same level of agreement between humans", and it examines "position, verbosity, and self-enhancement biases" ([Zheng et al., arXiv 2306.05685](https://arxiv.org/abs/2306.05685), read 2026-11-26). In practice: 1. Give the judge a rubric with yes or no questions, not a 1 to 10 scale. 2. Give it the evidence it needs, such as the final state or the reference, not only the agent's claims. 3. Swap the order of compared answers and average, to cancel position bias. 4. Measure agreement with human labels on a sample before using its scores for training. 5. Watch for agents learning to please the judge: longer answers, confident wording, or instructions aimed at the judge. ## Step 4: How do I test the grader itself? Test the grader with a fixed set of episodes whose correct scores you know, and run that set every time the grader or the environment changes. Table: A minimum test set for a grader | Test episode | Expected score | |---|---| | Reference solution | Full reward | | Do nothing, then finish | Zero | | Empty or malformed final answer | Zero | | Right action on the wrong object | Zero | | Right result plus an unwanted side effect | Zero, or reduced if you award partial credit | | Known exploit, such as editing tests or printing the expected output | Zero | The empty-answer row is in the table because it has caught real benchmarks: the same checklist paper reports that "TAU-bench counts empty responses as successful", and that such issues can lead to under- or overestimation of agent performance "by up to 100% in relative terms" (Zhu et al., read 2026-11-26). ## How do I keep environment errors out of the reward? Give every finished episode one of three outcomes, not two: the task succeeded, the task was attempted and not achieved, or the environment broke before the attempt could count. Only the first two produce a reward. An episode whose app crashed, ran out of memory or timed out on its own side carries no information about the agent, and scoring it 0 teaches the policy that whatever it did was wrong. On a hosted service, Promigence prints a validity report after each run that counts completed sandboxes, the ones that ended on the task's account and the ones that ended on the environment's account, according to its quickstart. Its errors reference states that an environment-side error is kept out of your result and retried once before hand-over, and gives the grader's own outcomes separate codes: `grade_not_passed` when "The task completed and its grade did not pass", counted as the task's, and `grader_failed` when "The grade could not be computed", which it calls "Not a task failure". Its CLI reference lets a run name the grader: `--grade` is "A command that scores the work in a clean copy of the environment after CMD ends", and `--holdout` is "A second, held-out test command; the report shows the gap between the two pass rates". Its FAQ adds that a sandbox that stopped partway through a run can be started again with `promigence run replay`, as a new sandbox. All four pages were read 2026-11-26. The other named providers document what they report when a sandbox or a command ends, which is where your own classification starts: Table: How AWS, Daytona, E2B, Google Cloud and Modal report the end of a sandbox (read 2026-11-26) | Provider | What it reports when a sandbox or command ends | Source | |---|---|---| | AWS (Amazon Bedrock AgentCore) | A Runtime session stops on inactivity (15 minutes by default), at its maximum lifetime (8 hours by default), on an explicit stop, or when health checks find its compute unhealthy | [Runtime sessions](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-sessions.html) | | Daytona | Its lifecycle states include Build Failed, which "needs to be retried", and Error, which "needs to be recovered" | [Sandboxes](https://www.daytona.io/docs/en/sandboxes) | | E2B | When a stream drops, the SDK says whether the sandbox was killed or reached its end of life (`TimeoutError` in JavaScript, `TimeoutException` in Python); any other connection error means the sandbox is still running | [How long does a sandbox live?](https://e2b.dev/docs/faq/sandbox-lifetime) | | Google Cloud (Gemini Enterprise Agent Platform sandboxes) | Command output, meaning stdout, stderr and exit codes, is returned in the execution response to the parent agent | [Manage sandboxes](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-sandboxes) | | Modal | Unix-style exit codes on each process and on the Sandbox itself tell success, manual termination and out-of-memory apart; a Sandbox finishes when its entrypoint exits, it is terminated, a timeout or idle timeout is reached, or it runs out of memory | [Sandboxes guide](https://modal.com/docs/guide/sandboxes) | To build the same split into your own environment: 1. **Check the environment before handing it over.** Run a short health check after reset: the app answers, the seed data is there, the tools respond. 2. **Classify the end of every episode.** Agent-side ends: it called `finish`, gave up, or hit the step limit. Environment-side ends: the instance died, a service it depends on timed out, a memory limit killed the app. 3. **Drop or retry environment-side episodes.** Exclude them from the training batch and the reported score, and start them again from the same seed. 4. **Report the two rates apart.** A rising environment-side rate is a bug in your environment, not a change in your agent. ## Where should the grader run? Run the grader outside the agent's reach: after the episode, in a process the agent could not modify, reading state through a path the agent could not change. If the grader runs inside the environment the agent controls, the agent can change it. Published accounts include agents that made a verification function "always return true", raised exceptions to skip tests, and stubbed whole libraries "in order to overwrite their verification functions" ([Baker et al., arXiv 2503.11926](https://arxiv.org/html/2503.11926), read 2026-11-26). Practical rules: 1. Copy out only the artefacts the grader needs, then grade in a fresh copy of the environment. 2. Keep reference solutions and expected outputs out of the agent's file system. 3. Grade on exit codes and results produced by your own test runner, not on text the agent's process printed. ## What we read for this article - [AppWorld (arXiv 2407.18901)](https://arxiv.org/abs/2407.18901), read 2026-11-26 - [SWE-bench (arXiv 2310.06770)](https://arxiv.org/html/2310.06770), read 2026-11-26 - [WebShop (arXiv 2207.01206)](https://arxiv.org/html/2207.01206), read 2026-11-26 - [Judging LLM-as-a-Judge (arXiv 2306.05685)](https://arxiv.org/abs/2306.05685), read 2026-11-26 - [Establishing Best Practices for Building Rigorous Agentic Benchmarks (arXiv 2507.02825)](https://arxiv.org/abs/2507.02825), read 2026-11-26 - [Monitoring Reasoning Models for Misbehavior (arXiv 2503.11926)](https://arxiv.org/html/2503.11926), read 2026-11-26 - [https://www.promigence.ai/docs/quickstart](https://www.promigence.ai/docs/quickstart), read 2026-11-26 - [https://www.promigence.ai/docs/errors](https://www.promigence.ai/docs/errors), read 2026-11-26 - [https://www.promigence.ai/faq](https://www.promigence.ai/faq), read 2026-11-26 - [https://www.promigence.ai/docs/cli](https://www.promigence.ai/docs/cli), read 2026-11-26 - [AWS: AgentCore Runtime sessions](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-sessions.html), read 2026-11-26 - [Daytona: Sandboxes](https://www.daytona.io/docs/en/sandboxes), read 2026-11-26 - [E2B: How long does a sandbox live?](https://e2b.dev/docs/faq/sandbox-lifetime), read 2026-11-26 - [Google Cloud: Manage sandboxes](https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/manage-sandboxes), read 2026-11-26 - [Modal: Sandboxes guide](https://modal.com/docs/guide/sandboxes), read 2026-11-26 ## FAQ ### What is the difference between a grader and a verifier? The words are used almost interchangeably. Grader usually means the function that turns an episode into a score. Verifier is common in RL with verifiable rewards and in coding, where it can also mean a learned model that ranks candidate solutions. On this page both mean the check that decides the reward. ### Should a grader read the agent's final answer or the environment state? The state, whenever the task changes something. An answer can claim success that did not happen. For question-answering tasks with no state change, compare the answer with the reference using a normaliser, not exact string equality. ### Can I use an LLM as the grader? For open-ended outputs, yes, with care. The MT-Bench study found strong model judges agree with human preferences over 80% of the time, about as often as humans agree with each other, but also documented position, verbosity and self-enhancement biases. Use code wherever code can decide. ### How do I know my grader is wrong? Test it. Feed it a correct solution, an empty one, a near miss and a known exploit, and check each score. A published checklist study found grading flaws that misestimated agent performance by up to 100% in relative terms. --- # About this guide AgenticRLEnvironments.com is a working guide to building the environments that agents learn and are tested in: what goes into one, how tasks and graders are made, how rewards go wrong, and how to keep environments versioned and reproducible. Guides are written by the editors as a desk. Each one lists the papers, specifications and repositories behind it, with the day they were read. Code on the site was run before it was published, against the library version the guide names. Every guide carries its first publication date and its last update. When a source changes, the guide is corrected and re-dated. Worked examples are labelled as examples, and every price or limit quoted on the site links to the page it was read from.