nemo_gym.sandbox.config

View as Markdown

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::

nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml

sandbox: opensandbox: connection: { … }

agent config

sandbox_provider: sandbox

An inline single-key mapping ({provider_name: {...}}) is also accepted for keeping everything in one file.

Module Contents

Functions

NameDescription
_candidate_sandbox_namesList top-level config keys that look like named sandbox provider blocks.
_to_plain_dictReturn a plain dict for mappings, including OmegaConf DictConfig.
resolve_provider_configResolve a sandbox_provider field into a single-key provider config dict.

API

nemo_gym.sandbox.config._candidate_sandbox_names(
named_configs: collections.abc.Mapping[str, typing.Any] | None
) -> list[str]

List top-level config keys that look like named sandbox provider blocks.

nemo_gym.sandbox.config._to_plain_dict(
value: typing.Any
) -> typing.Any

Return a plain dict for mappings, including OmegaConf DictConfig.

nemo_gym.sandbox.config.resolve_provider_config(
sandbox_provider: str | collections.abc.Mapping[str, typing.Any],
named_configs: collections.abc.Mapping[str, typing.Any] | None = None
) -> dict[str, typing.Any]

Resolve a sandbox_provider field into a single-key provider config dict.

Parameters:

sandbox_provider
str | Mapping[str, Any]

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: {...}}.

named_configs
Mapping[str, Any] | NoneDefaults to None

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: If sandbox_provider is neither a string nor a mapping.
  • ValueError: If a named reference cannot be found, or if the resolved block is not a single-key provider mapping.