nemo_gym.agent_utils.sandbox_session
nemo_gym.agent_utils.sandbox_session
Agent-server lifecycle for one supervised harness activation.
Module Contents
Classes
Functions
Data
API
Harness argv and the installed interpreter used to launch its supervisor.
Execute, stop, capture, then release an owned or borrowed sandbox.
Runtime installation belongs in the adapter’s seed hook. stage_activation
stages input and returns a command; collect copies harness artifacts
to the agent server after cleanup is confirmed. It may run a bounded snapshot
command, but must not restart the harness. Parsing responses stays in the adapter.
A new session stages input and its supervisor, runs the harness process, then stops and collects artifacts. Execution retains the sandbox until close releases it. A failed borrowed cleanup remains closing and can be retried; an owned sandbox can fall back to provider stop. Closed means release succeeded.
Each stop, collection and release phase is bounded by close_timeout (or
the timeout passed to close). Failed cleanup/release retains the handle
for retry. Failed capture is recorded separately and does not prevent release.
HTTP request binding and activation retries belong to the agent session layer.
Whether sandbox release completed successfully.
Whether close has been requested, including a failed attempt.
Marker path an adapter may pass to its harness for cancellation diagnostics.
Join finalization before release; concurrent/retried closes never duplicate capture.
Run once, preserving captured artifacts even when execution raises.
Cancellation stops the remote harness before releasing provider exec. Callers that merely stop waiting (such as disconnected HTTP requests) must shield their shared activation task.
Read combined supervisor/harness diagnostics without masking the original failure.
Fence a delayed launch or confirm descendant cleanup before transport cancellation.