Skip to content

feat(sandbox): discover sandbox providers via entry points - #1712

Merged
kajalj22 merged 2 commits into
ansubramania/sandbox-provider-default-metadatafrom
ansubramania/sandbox-provider-entry-points
Jun 30, 2026
Merged

feat(sandbox): discover sandbox providers via entry points#1712
kajalj22 merged 2 commits into
ansubramania/sandbox-provider-default-metadatafrom
ansubramania/sandbox-provider-entry-points

Conversation

@ananthsub

Copy link
Copy Markdown
Contributor

Summary

Stacked on top of #1709. Addresses the open review thread on #1377 (here) asking to support an entry-points configuration so users can plug in their own providers.

Adds a nemo_gym.sandbox_providers entry point group. A separate package can publish a sandbox provider that becomes available on install/import — no edits to the registry:

[project.entry-points."nemo_gym.sandbox_providers"]
my_provider = "my_pkg.provider:MyProvider"

Lookup precedence is explicit register_provider > built-in loaders > entry points; discovery is cached. list_providers() now unions all three sources.

Changes

  • nemo_gym/sandbox/providers/registry.py: add ENTRY_POINT_GROUP, cached _entry_point_loaders(), and fold entry points into get_provider_class / list_providers.
  • Unit test for discovery + built-in precedence (mocked entry points).
  • README: document registering a custom provider via entry points.

Refs #1377

Test plan

  • uv run pytest tests/unit_tests/test_sandbox.py tests/unit_tests/test_opensandbox_provider.py (23 passed, 11 skipped)
  • uv run ruff check clean

@copy-pr-bot

copy-pr-bot Bot commented Jun 26, 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.

hemildesai
hemildesai previously approved these changes Jun 27, 2026
@hemildesai
hemildesai force-pushed the ansubramania/sandbox-provider-entry-points branch from 7ed6b8c to 89aa965 Compare June 27, 2026 05:22
hemildesai
hemildesai previously approved these changes Jun 27, 2026
@hemildesai
hemildesai force-pushed the ansubramania/sandbox-provider-entry-points branch from 89aa965 to 6c34d08 Compare June 29, 2026 16:50
hemildesai added a commit that referenced this pull request Jun 29, 2026
Signed-off-by: Hemil Desai <hemild@nvidia.com>
hemildesai added a commit that referenced this pull request Jun 29, 2026
Signed-off-by: Hemil Desai <hemild@nvidia.com>
hemildesai added a commit that referenced this pull request Jun 29, 2026
Signed-off-by: Hemil Desai <hemild@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 #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 #1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
@kajalj22
kajalj22 force-pushed the ansubramania/sandbox-provider-entry-points branch from 8195954 to b0698c3 Compare June 30, 2026 16:25
@kajalj22
kajalj22 merged commit 678c59d into main Jun 30, 2026
16 checks passed
kajalj22 pushed a commit that referenced this pull request Jun 30, 2026
…aclass (#1713)

## Summary

Stacked on top of #1712. Addresses the open review thread on #1377
([here](#1377 (comment)))
asking whether the individual provider options should be frozen
dataclasses so the supported options + validation are discoverable.

Represents the recognized per-sandbox create options
(`SandboxSpec.provider_options`) as a frozen
`OpenSandboxProviderOptions` dataclass with a validating `from_mapping`:

- Supported options and their types now live in one place (`platform`,
`snapshot_id`, `volumes`, `skip_health_check`, `extensions`).
- Unknown keys and wrong types are rejected with clear errors.
- The create path reads typed attributes instead of scattered
`provider_options.get(...)` lookups, replacing the ad-hoc
`_spec_extensions` / `_provider_option_bool` / `_spec_volumes` helpers.

### Design note

SDK-owned nested structures (`platform`, `volumes`) are kept as
pass-through mappings rather than strictly-typed sub-dataclasses, so
their inner fields stay validated by the OpenSandbox SDK and we don't
over-constrain options we don't own.

Refs #1377

## Test plan

- [x] `uv run pytest tests/unit_tests/test_opensandbox_provider.py
tests/unit_tests/test_sandbox.py
responses_api_agents/mini_swe_agent_2/tests/test_app.py` (40 passed, 11
skipped)
- [x] `uv run ruff check` + `ruff format --check` clean
- [x] Create-path behavior (platform passthrough, image-pull-policy
extensions, skip_health_check) preserved under the fake-SDK tests

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
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.

3 participants