> This page is for version 0.3.0.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

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

# nemo_gym.web.artifacts

Backend-neutral artifact persistence for web rollouts.

## Module Contents

### Classes

| Name                                                           | Description                                                                |
| -------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`WebArtifactStore`](#nemo_gym-web-artifacts-WebArtifactStore) | Persist screenshots and recordings without depending on a browser backend. |

### Functions

| Name                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [`_png_bytes`](#nemo_gym-web-artifacts-_png_bytes)           | -           |
| [`_safe_component`](#nemo_gym-web-artifacts-_safe_component) | -           |

### Data

[`_SAFE_COMPONENT`](#nemo_gym-web-artifacts-_SAFE_COMPONENT)

### API

```python
class nemo_gym.web.artifacts.WebArtifactStore(
    root: str | pathlib.Path,
    inline_screenshots: bool = True
)
```

Persist screenshots and recordings without depending on a browser backend.

**`root`** `= Path(root).expanduser().resolve()`

---

```python
nemo_gym.web.artifacts.WebArtifactStore.recording_artifacts(
    session_id: str
) -> list[nemo_gym.web.models.WebArtifactRef]
```

Return finalized, non-empty recordings for a closed browser session.

```python
nemo_gym.web.artifacts.WebArtifactStore.save_screenshot(
    session_id: str,
    step: int,
    image: typing.Any,
    suffix: str = ''
) -> nemo_gym.web.models.WebImage
```

```python
nemo_gym.web.artifacts.WebArtifactStore.session_dir(
    session_id: str
) -> pathlib.Path
```

```python
nemo_gym.web.artifacts._png_bytes(
    image: typing.Any
) -> bytes
```

```python
nemo_gym.web.artifacts._safe_component(
    value: str
) -> str
```

```python
nemo_gym.web.artifacts._SAFE_COMPONENT = re.compile('[^A-Za-z0-9_.-]+')
```