Repository navigation
feat(sandbox): decouple sandbox provider config from agent config - #1708
Conversation
| close_timeout_s: 30 | ||
| # Name of the sandbox to use; include a provider config that defines a | ||
| # `sandbox` block (e.g. nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml). | ||
| sandbox_provider: sandbox |
There was a problem hiding this comment.
should this be sandbox_provider: opensandbox?
There was a problem hiding this comment.
no this is intentional.
sandbox here is a provider-agnostic instance name, which acts as the handle that the agent references. it's not the provider type. the provider type is the inner key inside of the provider config
this is structured closer to the other gym configs
sandbox: # instance name the agent references
opensandbox: # provider registry key
connection: ...
if we ship every provider config under the same canonical name sandbox, then for the common use cases, users can swap sandbox providers without any edits to the agent config
There was a problem hiding this comment.
Hmm, I think it may be confusing to infer which sandbox provider was used if the agent config doesn't reference it explicitly right?
Wouldn't it be better to just switch using cli like --sandbox_provider opensandbox or --sandbox_provider daytona etc to keep it explicit?
95124ec to
6e51e5e
Compare
6e51e5e to
41167a4
Compare
Sandbox providers are now defined as named blocks in their own config files (e.g. nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml) that agents reference by name (sandbox_provider: sandbox). Swapping providers becomes swapping one config path in +config_paths, with no edits to the agent config. - Add resolve_provider_config to resolve a sandbox name (or an inline single-key mapping) to a single provider config. - Make mini_swe_agent_2's config provider-neutral and resolve the reference at runtime. - Document single / swap / multiple-sandbox usage, including distinct instance names for mixing providers or running two configs of the same provider type. Refs #1377 Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
41167a4 to
0c907b9
Compare
Signed-off-by: Hemil Desai <hemild@nvidia.com>
Signed-off-by: Hemil Desai <hemild@nvidia.com>
β¦1709) ## Summary Stacked on top of #1708. Lets a sandbox provider config contribute default sandbox metadata* so provider-identifying tags live with the provider rather than the provider-neutral agent config. A sandbox block may carry an optional `default_metadata` key: ```yaml sandbox: default_metadata: { sandbox-api: opensandbox-sdk } opensandbox: connection: { ... } ``` Its entries are merged into each sandbox's `SandboxSpec.metadata`; the agent's own `sandbox_spec.metadata` overrides them on conflict. This restores the `sandbox-api: opensandbox-sdk` label that #1708 dropped from the agent config, now sourced from the provider config instead. ### Changes - Add `nemo_gym.sandbox.resolve_provider_metadata`; exclude reserved keys (`default_metadata`) from `resolve_provider_config`. - `mini_swe_agent_2` merges provider `default_metadata` into the sandbox spec metadata at runtime. - Add `default_metadata: { sandbox-api: opensandbox-sdk }` to the opensandbox provider config; document it in the README. - Unit tests for `resolve_provider_metadata` and the agent merge path. Refs #1377 ## Test plan - [x] `uv run pytest tests/unit_tests/test_sandbox.py responses_api_agents/mini_swe_agent_2/tests/test_app.py` (38 passed, 10 skipped) - [x] `uv run ruff check` + `ruff format --check` clean - [x] End-to-end resolution verified through `GlobalConfigDictParser` (provider key + default_metadata) --------- Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com> Signed-off-by: Hemil Desai <hemild@nvidia.com> Signed-off-by: Kajal Jain <kajalj@nvidia.com> Co-authored-by: Hemil Desai <hemild@nvidia.com> Co-authored-by: Kajal Jain <kajalj@nvidia.com>
Rebased onto main, which merged #1708 (decouple sandbox provider config from the agent config). Align the ECS Fargate provider with that pattern: - Add a standalone provider config nemo_gym/sandbox/providers/ecs_fargate/configs/ecs_fargate.yaml -- a top-level `sandbox` block selected via `sandbox_provider: sandbox`, matching opensandbox/apptainer. Region-only; task cpu/memory/disk come from sandbox_spec.resources. - Drop the agent-coupled configs/mini_swe_agent_ecs_fargate.yaml; the generic mini_swe_agent_2.yaml now runs on ECS by adding the provider config path. - Bump the generic config's sandbox_spec.resources.disk_gib 20 -> 30 so it is valid on every provider (Fargate rejects an explicit 20; 21-200 only). - Update the ECS Fargate docs (Fern page + agent README) to the config-paths recipe. - Reconcile uv.lock (boto3 / botocore, sandbox extra) after the rebase. Signed-off-by: Michal Bien <mbien@nvidia.com>
Summary
Follow-up to #1377 addressing the config-usability feedback (thread): the inline
sandbox_provider:block welded provider connection/lifecycle config (and its secret) into the agent config, making it hard to swap providers.This decouples the two. A sandbox is now a named block β
<name>: { <provider>: {config} }β defined in its own provider config file, and an agent points at it by name (sandbox_provider: sandbox). The framework only ever resolves a name β one provider config.sandboxblock; the agent defaults tosandbox_provider: sandbox.sandbox, so swapping providers is swapping one+config_pathsentry.Changes
nemo_gym.sandbox.resolve_provider_configβ resolves a sandbox name (from the merged config) or an inline single-key mapping to a single{provider: config}dict forcreate_provider.nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yamldefining the namedsandboxblock.responses_api_agents/mini_swe_agent_2provider-neutral:sandbox_provideraccepts a name (default) or inline mapping; the reference is resolved at runtime. Renamedmini_swe_agent_opensandbox.yamlβmini_swe_agent_2.yaml.Bottom of a 2-PR stack; the follow-up adds provider-contributed default sandbox metadata.
Refs #1377
Test plan
uv run pytest tests/unit_tests/test_sandbox.py tests/unit_tests/test_opensandbox_provider.py responses_api_agents/mini_swe_agent_2/tests/uv run ruff check+ruff format --checkcleanGlobalConfigDictParser