> This page is for version 0.5.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.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.models.token_capture.replay

Source-content facts for source-history capture decisions.

This module records what the gateway received and exposed. It does not decide
whether to splice tokens, compact a context, or create a training segment.

## Module Contents

### Functions

| Name                                                                                   | Description                                                               |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [`_digest`](#nemo_gym-models-token_capture-replay-_digest)                             | -                                                                         |
| [`_normalize_arguments`](#nemo_gym-models-token_capture-replay-_normalize_arguments)   | -                                                                         |
| [`_plain`](#nemo_gym-models-token_capture-replay-_plain)                               | -                                                                         |
| [`render_options_digest`](#nemo_gym-models-token_capture-replay-render_options_digest) | Identify the effective gateway options that can shape a rendered prompt.  |
| [`replay_context`](#nemo_gym-models-token_capture-replay-replay_context)               | Hash ordered source items without discarding exposed reasoning content.   |
| [`same_replay_source`](#nemo_gym-models-token_capture-replay-same_replay_source)       | Compare source facts; render compatibility remains the worker's decision. |
| [`summarize_replay`](#nemo_gym-models-token_capture-replay-summarize_replay)           | Summarize a complete source history or a prefix of the current request.   |

### API

```python
nemo_gym.models.token_capture.replay._digest(
    value: typing.Any
) -> str
```

```python
nemo_gym.models.token_capture.replay._normalize_arguments(
    value: dict
) -> None
```

```python
nemo_gym.models.token_capture.replay._plain(
    value: typing.Any
) -> typing.Any
```

```python
nemo_gym.models.token_capture.replay.render_options_digest(
    payload: dict[str, typing.Any]
) -> str
```

Identify the effective gateway options that can shape a rendered prompt.

```python
nemo_gym.models.token_capture.replay.replay_context(
    items: list[dict],
    render_digest: str | None = None
) -> nemo_gym.models.token_capture.staging.records.ReplayContext
```

Hash ordered source items without discarding exposed reasoning content.

Only documented non-prompt response metadata is ignored. Unknown item kinds
fail instead of collapsing to a fingerprint that could restore edited text.
Media URLs/data are hashed here, never copied into the capture manifest.

```python
nemo_gym.models.token_capture.replay.same_replay_source(
    left: nemo_gym.models.token_capture.staging.records.ReplaySummary,
    right: nemo_gym.models.token_capture.staging.records.ReplaySummary,
    allow_empty_tool_content: bool = False
) -> bool
```

Compare source facts; render compatibility remains the worker's decision.

```python
nemo_gym.models.token_capture.replay.summarize_replay(
    context: nemo_gym.models.token_capture.staging.records.ReplayContext,
    item_count: int | None = None
) -> nemo_gym.models.token_capture.staging.records.ReplaySummary
```

Summarize a complete source history or a prefix of the current request.

Roles and item order are authenticated along with the normalized content.
Reject an unavailable prefix rather than silently hashing a shorter slice.