Skip to content

[codex] feat(sandbox): integrate Apptainer provider stack#1798

Draft
hemildesai wants to merge 6 commits into
NVIDIA-NeMo:mainfrom
hemildesai:codex/apptainer-provider-stack
Draft

[codex] feat(sandbox): integrate Apptainer provider stack#1798
hemildesai wants to merge 6 commits into
NVIDIA-NeMo:mainfrom
hemildesai:codex/apptainer-provider-stack

Conversation

@hemildesai

Copy link
Copy Markdown
Contributor

Summary

  • add a canonical named Apptainer sandbox config with provider-owned metadata and Mini SWE-ready instance settings
  • validate Apptainer SandboxSpec.provider_options through a frozen ApptainerProviderOptions dataclass
  • keep Mini SWE provider-neutral by moving OpenSandbox's Linux/AMD64 option into shallow-merged provider defaults
  • package both provider YAML configs in wheels and document Apptainer runtime/isolation constraints

Why

The provider stack ending at #1713 added named configs, provider defaults, and typed options for OpenSandbox, while the Apptainer provider from #1694 still relied on inline config and silently ignored unknown options. That also made the documented path-only provider swap fail because the Mini SWE config carried an OpenSandbox-only platform option.

Impact

Users can select Apptainer by swapping the provider path in +config_paths. Explicit agent provider options still override provider defaults by top-level key. Invalid Apptainer option names and types now fail before a staging directory or subprocess is created.

Validation

  • uv run pytest tests/unit_tests/test_apptainer_provider.py tests/unit_tests/test_sandbox.py tests/unit_tests/test_opensandbox_provider.py responses_api_agents/mini_swe_agent_2/tests/test_app.py responses_api_agents/mini_swe_agent_2/tests/test_sandbox_environment.py -q — 125 passed
  • scoped ruff check and ruff format --check
  • scoped pre-commit run --files ...
  • wheel build verified both Apptainer and OpenSandbox provider YAMLs are included

A live Linux Apptainer smoke test was not available on this macOS checkout; provider subprocess behavior remains covered by the existing hermetic test suite.

Refs #1713
Refs #1694

ananthsub and others added 6 commits June 26, 2026 22:22
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 NVIDIA-NeMo#1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
A sandbox block may carry an optional `default_metadata` key whose entries
are merged into each sandbox's spec metadata (SandboxSpec.metadata), with
the agent's own sandbox_spec.metadata taking precedence. This keeps
provider-identifying tags with the provider config instead of the
provider-neutral agent config.

- Add resolve_provider_metadata and exclude reserved keys (default_metadata)
  from resolve_provider_config.
- mini_swe_agent_2 merges provider default_metadata into the sandbox spec
  metadata.
- Restore sandbox-api: opensandbox-sdk via the opensandbox provider config.

Refs NVIDIA-NeMo#1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Add a `nemo_gym.sandbox_providers` entry point group so a separate package
can publish a sandbox provider that becomes available on install/import,
without editing the registry. Lookup precedence is explicit registration >
built-in loaders > entry points; discovery is cached.

Refs NVIDIA-NeMo#1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Two installed distributions publishing the same provider entry-point name
now raise a clear error naming both packages, instead of silently picking
one nondeterministically. An entry point shadowed by a higher-precedence
built-in or registered provider is logged as a warning and ignored.

Refs NVIDIA-NeMo#1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
…aclass

Represent the recognized per-sandbox create options (spec.provider_options)
as a frozen OpenSandboxProviderOptions dataclass with a validating
from_mapping, so the supported options and their types are discoverable in
one place and unknown keys are rejected with a clear error. The create path
now reads typed attributes instead of scattered dict lookups.

SDK-owned nested structures (platform, volumes) stay pass-through mappings
so their inner fields remain validated by the OpenSandbox SDK rather than
over-constrained here.

Refs NVIDIA-NeMo#1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Add the named Apptainer config and align provider options with the sandbox provider stack.

Signed-off-by: Hemil Desai <hemil.desai10@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants