e2b sandbox provider moves each task’s shell commands and verification script into an isolated E2B sandbox instead of executing them on that host.
Install
The E2B provider ships in NeMo Gym’ssandbox extra. Install it from a checkout of the repository:
The
e2b provider is not part of a published NeMo Gym release yet — the latest nemo-gym on PyPI (0.5.0) does not include it. Install from the repository until a release ships it, after which pip install "nemo-gym[sandbox]" works. The provider requires e2b>=2.36.0,<3.0.0.Configure the E2B provider
NeMo Gym ships a ready-to-use provider config atnemo_gym/sandbox/providers/e2b/configs/e2b.yaml. The fields that matter most for an E2B run:
api_url and sandbox_url unset for the hosted E2B service. For an E2B-compatible gateway, set both to the endpoints supplied by the gateway operator.
Wire the provider into a run
Layer the provider config alongside an agent and model config. Every shipped provider config binds the same instance name,sandbox, so switching sandbox backends means swapping this one path — any harness that reads sandbox_provider: sandbox works the same way:
create.timeout_s, or a harness’s own sandbox_spec.ttl_s where it overrides that — as the backstop that reclaims orphaned sandboxes.
Two provider rules apply before a run reaches E2B. The provider accepts only
template under provider_options and rejects anything else before allocating a sandbox, and it will not start from an OCI image reference that has no create.template_map entry. A harness that sets other provider options, or that supplies image references, needs those adjusted in your own config layer.Build templates from OCI images
E2B starts a sandbox from a template name or ID, not an OCI image reference directly. NeMo Gym includes a provisioning CLI that builds an E2B template from an OCI image ahead of a run:create block:
Security considerations
- The shipped config keeps
secure: true, so the sandboxenvdservice requires an access token. - Outbound internet access is enabled by default. Set
create.allow_internet_access: falsefor offline or untrusted workloads, or use outbound network rules to restrict traffic by CIDR or hostname. mini_swe_agent_2stripse2b.connection.api_key,headers, andapi_headersfrom the per-instance worker config it writes to disk and passes them through the worker environment instead, so the API key never lands in a serialized config file.- NeMo Gym identifies its traffic by appending
nemo-gym/<version>to the E2B SDK’sUser-Agentthrough E2B’sset_integrationhook. An explicit customUser-Agentin the connection headers takes precedence and hides that attribution.
SandboxSpec field mapping, and lifecycle and retry behavior, see the NeMo Gym E2B provider documentation.