OpenSandbox Provider
The opensandbox provider creates sandboxes through the OpenSandbox SDK and server API. It is the Kubernetes-backed provider used by agentic software engineering environments such as mini_swe_agent_2.
Setup
Install the sandbox extra in the runtime image or virtual environment that creates sandboxes:
For package installs, use:
Set connection values through the provider config. The shipped config reads these environment variables:
Provider Config
NeMo Gym ships an OpenSandbox provider config at nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml. It defines a top-level sandbox block that agents reference with sandbox_provider: sandbox.
Run an agent with the provider config by passing it alongside the agent and model configs:
The provider constructor accepts four optional config sections:
SandboxSpec Provider Options
Set OpenSandbox-specific create options under SandboxSpec.provider_options, or under sandbox_spec.provider_options in an agent config:
Supported options are:
Unknown provider option keys raise ValueError; values with the wrong type raise TypeError. This catches config drift before a sandbox allocation is attempted.
Relevant SandboxSpec Fields
Resource Mapping
SandboxResources is translated into OpenSandbox resource quantities:
The provider also normalizes metadata values for backend labels by replacing unsupported characters and truncating values to the provider limit.
Lifecycle
The provider creates one OpenSandbox sandbox per Gym sandbox:
If create.skip_health_check is enabled, the provider reconnects to the sandbox before running the NeMo Gym readiness probe so follow-up operations use a fresh SDK handle.
File Transfer
The provider uses the OpenSandbox SDK file API for uploads and downloads:
upload()reads the local file and writes bytes to the target sandbox path.download()reads bytes from the sandbox path and writes them to the local target path.
Startup files from SandboxSpec.files use the same provider file path semantics before the first command runs.
User and Runtime Notes
The neutral user argument to exec() maps onto OpenSandbox command options:
Command failures return SandboxExecResult with the command’s exit code. If OpenSandbox reports an execution error without an exit code, the provider returns code 125 with error_type="sandbox".
The provider’s create.image_pull_policy defaults to IfNotPresent. Valid values are Always, IfNotPresent, and Never. The resolved policy is written into OpenSandbox create extensions as both imagePullPolicy and opensandbox.extensions.image-pull-policy unless those keys are already present in provider_options.extensions.
Create retries handle transient allocation, connection, image pull, and server-side errors. Command retries are controlled separately by operations.command_retries.