nemo_gym.sandbox.config
nemo_gym.sandbox.config
Resolve a sandbox provider reference into a provider config.
An agent selects a sandbox by name (sandbox_provider: sandbox). The named
block lives in its own provider config file, so swapping providers is swapping a
config_paths entry, not editing the agent config:
An inline single-key mapping ({provider_name: {...}}) is also accepted for
keeping everything in one file.
A block may also carry a reserved default_metadata key. Its entries are merged
into the sandbox’s SandboxSpec.metadata as defaults (the agent’s own
sandbox_spec.metadata overrides them), so provider-identifying tags live with
the provider rather than the agent config:
A block may also carry a reserved volume_sources key: a mapping from a Compose
volume name (an external: true volume) or a bind-mount host path to the path, under
the provider’s shared storage root, that stands in for it when a Compose group starts:
Module Contents
Classes
Functions
Data
SANDBOX_BLOCK_DEFAULT_METADATA_KEY
SANDBOX_BLOCK_VOLUME_SOURCES_KEY
API
Bases: BaseModel
The sandbox_config settings a server applies to every sandbox it starts.
Servers that need more, such as a fixed image, subclass it with their own fields.
Build the spec of one sandbox; metadata adds to the provider’s and the config’s metadata.
List top-level config keys that look like named sandbox provider blocks.
Return the provider keys in a block (everything but reserved keys).
Resolve a sandbox_provider reference or inline mapping to a plain block.
Return a plain dict for mappings, including OmegaConf DictConfig.
Resolve a sandbox_provider field into a single-key provider config dict.
Parameters:
Either the name of a top-level sandbox config block
(resolved from named_configs) or an inline single-key provider
mapping of the form {provider_name: {...}}.
Mapping of top-level config name to config block, typically
the merged global config dict. Required when sandbox_provider is a
name reference.
Returns: dict[str, Any]
A plain {provider_name: provider_kwargs} dict suitable for
Raises:
TypeError: Ifsandbox_provideris neither a string nor a mapping.ValueError: If a named reference cannot be found, or if the block does not hold exactly one provider key.
Return a sandbox block’s default_metadata.
These are provider-contributed defaults to merge into SandboxSpec.metadata.
Returns an empty dict when the block has no default_metadata key. See
resolve_provider_config for argument semantics.
Return a sandbox block’s volume_sources: Compose volume names and bind-mount host paths mapped
to paths under the provider’s shared storage root.
Returns an empty dict when the block has no volume_sources key. Keys and values must be
non-empty strings. See resolve_provider_config for argument semantics.
volume_sources as a plain dict of non-empty strings; None is empty. source names the config
in error messages.