> This page is for version 0.4.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.task_images

Resolve benchmark reference images at the agent-side trust boundary.

## Module Contents

### Functions

| Name                                                                                       | Description                                                            |
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| [`resolve_local_task_image_path`](#nemo_gym-web-task_images-resolve_local_task_image_path) | Resolve and validate one local reference below a read-only image root. |
| [`resolve_task_image_url`](#nemo_gym-web-task_images-resolve_task_image_url)               | Return a model-safe URL for one task reference image.                  |

### Data

[`_MIME_OVERRIDES`](#nemo_gym-web-task_images-_MIME_OVERRIDES)

[`_PASSTHROUGH_SCHEMES`](#nemo_gym-web-task_images-_PASSTHROUGH_SCHEMES)

### API

```python
nemo_gym.web.task_images.resolve_local_task_image_path(
    image_reference: str,
    image_root: str | pathlib.Path | None,
    max_bytes: int
) -> tuple[pathlib.Path, str]
```

Resolve and validate one local reference below a read-only image root.

```python
nemo_gym.web.task_images.resolve_task_image_url(
    image_reference: str,
    image_root: str | pathlib.Path | None,
    max_bytes: int
) -> str
```

Return a model-safe URL for one task reference image.

Public WebArena-family JSONL records store relative image paths. The model
endpoint cannot consume those controller paths directly, so the web agent
reads them from an explicitly mounted, read-only root and emits a data URL.
Existing data and HTTP(S) URLs pass through unchanged.

Local references are accepted only when they resolve inside `image_root`.
This prevents benchmark metadata from becoming an arbitrary file-read API.

```python
nemo_gym.web.task_images._MIME_OVERRIDES = {'.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.png': 'image/png', '.webp': 'ima...
```

```python
nemo_gym.web.task_images._PASSTHROUGH_SCHEMES = frozenset({'data', 'http', 'https'})
```