> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.sandbox.providers.opensandbox.snapshots

Audit or delete OpenSandbox snapshots, and optionally the paused sandboxes that hold them.

Pausing a sandbox checkpoints it server-side. Interrupted runs leave snapshots
and paused sandboxes behind, and both hold cluster storage until deleted. Like
cleanup\_sandboxes.py, this talks to the management API directly so it runs from
any Python with aiohttp and PyYAML, for example as a job submitted by file path.

snapshots.py --connection-config env.yaml                         # audit every snapshot
snapshots.py --connection-config env.yaml --sandbox-id \<id> --reap
snapshots.py --connection-config env.yaml --kill-paused --reap    # also delete paused sandboxes
snapshots.py --domain \<host> --api-key \<key> --snapshot-id \<id> --reap

## Module Contents

### Functions

| Name                                                                                       | Description                                                                |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| [`_run`](#nemo_gym-sandbox-providers-opensandbox-snapshots-_run)                           | Run the cleanup and turn its failures into a message and a status.         |
| [`cleanup_snapshots`](#nemo_gym-sandbox-providers-opensandbox-snapshots-cleanup_snapshots) | List matching snapshots (and paused sandboxes) and optionally delete them. |
| [`main`](#nemo_gym-sandbox-providers-opensandbox-snapshots-main)                           | -                                                                          |

### Data

[`PAGE_SIZE`](#nemo_gym-sandbox-providers-opensandbox-snapshots-PAGE_SIZE)

[`REAP_CONCURRENCY`](#nemo_gym-sandbox-providers-opensandbox-snapshots-REAP_CONCURRENCY)

[`REAP_SWEEPS`](#nemo_gym-sandbox-providers-opensandbox-snapshots-REAP_SWEEPS)

[`REQUEST_TIMEOUT_SECONDS`](#nemo_gym-sandbox-providers-opensandbox-snapshots-REQUEST_TIMEOUT_SECONDS)

### API

```python
nemo_gym.sandbox.providers.opensandbox.snapshots._run(
    parser: argparse.ArgumentParser,
    domain: str,
    access_key: str,
    protocol: str,
    args: argparse.Namespace
) -> int
```

Run the cleanup and turn its failures into a message and a status.

```python
nemo_gym.sandbox.providers.opensandbox.snapshots.cleanup_snapshots(
    domain: str,
    protocol: str,
    access_key: str,
    sandbox_id: str | None,
    states: list[str] | None,
    snapshot_ids: list[str] | None,
    kill_paused: bool,
    reap: bool
) -> int
```

async

List matching snapshots (and paused sandboxes) and optionally delete them.

`snapshot_ids=None` lists snapshots; a list, even an empty one, names them
exactly. Blank selectors are rejected rather than widening the scope.

```python
nemo_gym.sandbox.providers.opensandbox.snapshots.main(
    argv: list[str] | None = None
) -> int
```

```python
nemo_gym.sandbox.providers.opensandbox.snapshots.PAGE_SIZE = 100
```

```python
nemo_gym.sandbox.providers.opensandbox.snapshots.REAP_CONCURRENCY = 32
```

```python
nemo_gym.sandbox.providers.opensandbox.snapshots.REAP_SWEEPS = 3
```

```python
nemo_gym.sandbox.providers.opensandbox.snapshots.REQUEST_TIMEOUT_SECONDS = 30
```