nemo_gym.sandbox.providers.e2b.build
nemo_gym.sandbox.providers.e2b.build
Build E2B templates from OCI images.
E2B cannot start a sandbox from an OCI reference: POST /sandboxes accepts
only a template name or ID. Building a template from the image is the path from
an OCI reference to a running sandbox.
This module is deliberately outside the sandbox public API and the
:class:SandboxProvider protocol. Building a template is a provisioning
step — slow, one-off, and shared across runs — whereas the provider API is
about starting and driving sandboxes. Keeping them apart means
:meth:E2BProvider.create never blocks on an image build, and provisioning can
run ahead of time from CI, a notebook, or the CLI below.
Typical use: build templates once, then feed the resulting mapping into the
provider’s create.template_map.
python -m nemo_gym.sandbox.providers.e2b.build
—image ghcr.io/acme/task-a:1.0 —image ghcr.io/acme/task-b:1.0
—cpu-count 8 —memory-mb 16384 —output template_map.yaml
Module Contents
Classes
Functions
Data
API
Bases: RuntimeError
Raised when a template cannot be built from an image.
Build one template from an OCI image and return its alias.
Build templates for many images, returning an image -> alias mapping.
The result is exactly the shape of the provider’s create.template_map.
With continue_on_error the failures are logged and omitted, so one bad
image does not discard a long batch.
Return a deterministic, charset-safe alias for an image + build size.
The digest covers the resources as well as the image because E2B bakes cpu/memory into the template: two sandboxes wanting different sizes must not share one, or the second silently inherits the first’s sizing.
Whether alias already exists on the target deployment.