Why Agent Training Needs a Fresh Working Environment for Every Attempt
A recent Hugging Face community survey puts the execution environment at the centre of agent training. Here is how to reason about isolation, reset behaviour and reliable rewards.

Treat the environment and verifier as part of the experiment, with explicit reset rules and separate records for infrastructure failures.
In a September 11 community article, Sergio Paniego examines the execution infrastructure used in agent reinforcement learning. The discussion accompanies a TRL and OpenEnv training class and distinguishes the task, the agent interface, the isolated machine and the surrounding rollout system. Its central theme is that a tool-using agent needs persistent working state during an attempt, followed by a dependable boundary between attempts.
That distinction matters because an agent is not simply returning an answer to a fixed question. It may create files, run processes, inspect outputs and revise a plan. The environment becomes part of what the model experiences. If that environment behaves inconsistently, a training result can reflect accidental infrastructure differences rather than improved problem solving.
Define the attempt before scaling it
Consider an illustrative coding task: repair a failing function and demonstrate that a specified test passes. The initial repository, installed dependencies, available tools and time budget define the starting conditions. The sequence of edits and commands forms the attempt. A verifier then determines whether the final state satisfies the task.
Write that contract in concrete terms. Is network access available? Can the agent change the tests? Does a background process continue running between tool calls? What happens when a command times out? These are not incidental details. They determine which strategies are possible and what success actually means. A training pipeline cannot compare attempts fairly when these rules change invisibly.
Reset state, not just the prompt
Giving a new prompt to the same working directory is not necessarily a new attempt. Files, caches, services and environment settings may survive. An agent could benefit from work done during a previous run without receiving any explicit indication that the help exists.
A small reset test is therefore valuable before a large experiment. Deliberately create a file and start a harmless background process in one attempt, reset the environment, and verify the documented treatment of both. Some systems intentionally preserve particular caches to save time. That can be reasonable, but the cache must not contain task answers or other state that changes the difficulty. Efficiency should be an explicit design choice, not an undocumented shortcut.
Make the verifier harder to fool than the task
A verifier is the mechanism that turns an outcome into a training signal. It can be wrong even when it runs without an error. For example, checking only whether a report file exists rewards an empty report. Checking only whether a test command exits successfully may reward a modified command that no longer runs the intended tests.
Begin with simple adversarial cases: the untouched starting state, an obviously incomplete solution and a known acceptable result. The verifier should distinguish them. Keep verification assets outside the agent's writable task area when the design requires them to remain fixed. Also preserve enough evidence to explain a score later; a bare success flag makes debugging difficult.
Separate model mistakes from infrastructure failures
A package mirror outage, exhausted disk or unavailable service does not necessarily mean the agent chose a bad action. Mixing these events into ordinary task failures can distort the feedback loop. Record infrastructure failures as their own category and decide consistently whether the attempt should be retried, excluded or scored under a documented resilience objective.
This distinction also helps capacity planning. If an experiment spends most of its time preparing environments, adding more model-serving capacity may not improve useful throughput. Measure preparation, agent interaction, verification and cleanup separately. Optimizing the slowest meaningful stage is more informative than reporting only the number of concurrent workers.
Keep a complete experiment record
The reproducible unit is larger than a model checkpoint. It includes the task version, environment image, tool interface, reset rules, verifier and resource limits. Save identifiers for those components with the resulting trajectories. When performance changes, this record helps distinguish a model improvement from an easier environment or altered scoring rule.
For a first implementation, a modest set of well-understood tasks is more useful than a huge collection with uncertain boundaries. Establish that attempts are independent, scores are meaningful and failures are diagnosable. Only then increase concurrency. Reliable environments make scaling interpretable; scaling alone does not make unreliable environments trustworthy.
Source: One sandbox per rollout, or how labs run RL for agents in 2026 ↗. How we write


