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

Strict ATIF projection for external rollout reverification.

The adapter validates a deliberately bounded canonical ATIF v1.7 subset, joins
each trajectory to an explicit materialized Gym task, and constructs the
Responses-shaped payload used by Gym's existing stateless verifier path.

Provider-native payloads and producer-private status records carried in
`extra` are producer evidence, not part of the ATIF interchange contract.
Exporters own their projection into the canonical fields consumed here.

## Module Contents

### Classes

| Name                                                                                     | Description                                                                         |
| ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [`AtifProjectionError`](#nemo_gym-atif_reverification-AtifProjectionError)               | Raised when an ATIF trajectory cannot be projected without changing what is scored. |
| [`AtifReverifyManifestEntry`](#nemo_gym-atif_reverification-AtifReverifyManifestEntry)   | Explicit join between one external trajectory and one Gym rollout.                  |
| [`LoadedAtifTrajectory`](#nemo_gym-atif_reverification-LoadedAtifTrajectory)             | A validated trajectory together with immutable source provenance.                   |
| [`ProjectedAtifVerifyPayload`](#nemo_gym-atif_reverification-ProjectedAtifVerifyPayload) | Verifier payload plus provenance that must survive result persistence.              |

### Functions

| Name                                                                                                             | Description                                                                      |
| ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [`_apply_materialized_request_context`](#nemo_gym-atif_reverification-_apply_materialized_request_context)       | -                                                                                |
| [`_created_at`](#nemo_gym-atif_reverification-_created_at)                                                       | -                                                                                |
| [`_has_multimodal_content`](#nemo_gym-atif_reverification-_has_multimodal_content)                               | -                                                                                |
| [`_item_id`](#nemo_gym-atif_reverification-_item_id)                                                             | -                                                                                |
| [`_model_name`](#nemo_gym-atif_reverification-_model_name)                                                       | -                                                                                |
| [`_observation_output`](#nemo_gym-atif_reverification-_observation_output)                                       | Project both standard ATIF content and Relay's structured result extension.      |
| [`_optional_nonnegative_count`](#nemo_gym-atif_reverification-_optional_nonnegative_count)                       | -                                                                                |
| [`_reject_nonfinite_json_numbers`](#nemo_gym-atif_reverification-_reject_nonfinite_json_numbers)                 | -                                                                                |
| [`_reject_unsupported_training_metadata`](#nemo_gym-atif_reverification-_reject_unsupported_training_metadata)   | -                                                                                |
| [`_relay_usage_details`](#nemo_gym-atif_reverification-_relay_usage_details)                                     | Aggregate optional Relay token details without turning unknown values into zero. |
| [`_step_has_usage_counts`](#nemo_gym-atif_reverification-_step_has_usage_counts)                                 | -                                                                                |
| [`_text_parts`](#nemo_gym-atif_reverification-_text_parts)                                                       | -                                                                                |
| [`_trajectory_content_sha256`](#nemo_gym-atif_reverification-_trajectory_content_sha256)                         | Hash semantic ATIF content without ignored producer metadata.                    |
| [`_trajectory_identity_seed`](#nemo_gym-atif_reverification-_trajectory_identity_seed)                           | -                                                                                |
| [`_usage`](#nemo_gym-atif_reverification-_usage)                                                                 | -                                                                                |
| [`_validate_declared_gym_source_identity`](#nemo_gym-atif_reverification-_validate_declared_gym_source_identity) | -                                                                                |
| [`_validate_projected_output_ids`](#nemo_gym-atif_reverification-_validate_projected_output_ids)                 | -                                                                                |
| [`_validate_supported_trajectory`](#nemo_gym-atif_reverification-_validate_supported_trajectory)                 | -                                                                                |
| [`atif_trajectory_to_response`](#nemo_gym-atif_reverification-atif_trajectory_to_response)                       | Project one complete text-only ATIF v1.7 trajectory into a Gym response.         |
| [`build_atif_verify_payload`](#nemo_gym-atif_reverification-build_atif_verify_payload)                           | Replace a materialized task's native response with its ATIF projection.          |
| [`index_materialized_inputs`](#nemo_gym-atif_reverification-index_materialized_inputs)                           | Index materialized tasks without guessing identity from row order.               |
| [`load_atif_manifest`](#nemo_gym-atif_reverification-load_atif_manifest)                                         | Load an explicit trajectory-to-rollout manifest from JSONL.                      |
| [`load_atif_trajectory`](#nemo_gym-atif_reverification-load_atif_trajectory)                                     | Read and validate one ATIF document without involving the Relay runtime.         |
| [`project_atif_manifest_entries`](#nemo_gym-atif_reverification-project_atif_manifest_entries)                   | Project a one-to-one manifest while rejecting ambiguous batch joins.             |
| [`project_atif_manifest_entry`](#nemo_gym-atif_reverification-project_atif_manifest_entry)                       | Resolve one manifest entry without relying on filenames or session IDs.          |

### Data

[`_RESPONSE_REQUEST_FIELDS`](#nemo_gym-atif_reverification-_RESPONSE_REQUEST_FIELDS)

### API

```python
class nemo_gym.atif_reverification.AtifProjectionError()
```

**Bases:** [ConfigError](/nemo-gym/nemo_gym/config_types#nemo_gym-config_types-ConfigError)

Raised when an ATIF trajectory cannot be projected without changing what is scored.

```python
class nemo_gym.atif_reverification.AtifReverifyManifestEntry()
```

**Bases:** `BaseModel`

Explicit join between one external trajectory and one Gym rollout.

**`expected_sha256`** `str | None = Field(default=None, pattern='^[0-9a-f]{64}$')`

---

**`model_config`** `= ConfigDict(extra='forbid', populate_by_name=True)`

---

**`rollout_index`** `int`

---

**`task_index`** `int = Field(alias='_ng_task_index', ge=0, strict=True)`

---

**`trajectory_path`** `Path`

---

```python
class nemo_gym.atif_reverification.LoadedAtifTrajectory(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7,
    source_path: pathlib.Path,
    source_sha256: str
)
```

Dataclass

A validated trajectory together with immutable source provenance.

**`source_path`** `Path`

---

**`source_sha256`** `str`

---

**`trajectory`** `AtifTrajectoryV1_7`

---

```python
class nemo_gym.atif_reverification.ProjectedAtifVerifyPayload(
    payload: dict[str, typing.Any],
    trajectory_id: str | None,
    session_id: str | None,
    source_path: pathlib.Path,
    source_sha256: str,
    trajectory_content_sha256: str,
    task_index: int,
    rollout_index: int,
    schema_version: str,
    projection_status: typing.Literal['complete'] = 'complete'
)
```

Dataclass

Verifier payload plus provenance that must survive result persistence.

`projection_status="complete"` means Gym built the bounded scoring payload
without guessing or dropping a field this adapter maps. It does not claim a
full-fidelity conversion of the ATIF document or producer metadata in
`extra`; the source hashes preserve that provenance.

**`payload`** `dict[str, Any]`

---

**`projection_status`** `Literal['complete'] = 'complete'`

---

**`rollout_index`** `int`

---

**`schema_version`** `str`

---

**`session_id`** `str | None`

---

**`source_path`** `Path`

---

**`source_sha256`** `str`

---

**`task_index`** `int`

---

**`trajectory_content_sha256`** `str`

---

**`trajectory_id`** `str | None`

---

```python
nemo_gym.atif_reverification._apply_materialized_request_context(
    response: nemo_gym.openai_utils.NeMoGymResponse,
    materialized_input: typing.Mapping[str, typing.Any]
) -> nemo_gym.openai_utils.NeMoGymResponse
```

```python
nemo_gym.atif_reverification._created_at(
    agent_steps: list[typing.Any]
) -> float
```

```python
nemo_gym.atif_reverification._has_multimodal_content(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> bool
```

```python
nemo_gym.atif_reverification._item_id(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7,
    components: str = ()
) -> str
```

```python
nemo_gym.atif_reverification._model_name(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> str
```

```python
nemo_gym.atif_reverification._observation_output(
    result: typing.Any,
    field_name: str
) -> str | openai.types.responses.response_function_call_output_item_list_param.ResponseFunctionCallOutputItemListParam
```

Project both standard ATIF content and Relay's structured result extension.

```python
nemo_gym.atif_reverification._optional_nonnegative_count(
    namespace: typing.Mapping[str, typing.Any],
    field_name: str,
    step_id: int
) -> int | None
```

```python
nemo_gym.atif_reverification._reject_nonfinite_json_numbers(
    value: typing.Any,
    field_name: str
) -> None
```

```python
nemo_gym.atif_reverification._reject_unsupported_training_metadata(
    step: typing.Any
) -> None
```

```python
nemo_gym.atif_reverification._relay_usage_details(
    agent_steps: list[typing.Any]
) -> tuple[int | None, int | None]
```

Aggregate optional Relay token details without turning unknown values into zero.

```python
nemo_gym.atif_reverification._step_has_usage_counts(
    step: typing.Any
) -> bool
```

```python
nemo_gym.atif_reverification._text_parts(
    value: typing.Any,
    field_name: str
) -> list[str]
```

```python
nemo_gym.atif_reverification._trajectory_content_sha256(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> str
```

Hash semantic ATIF content without ignored producer metadata.

Provider payloads and status records carried in `extra` do not affect the
projected verifier response.  Exclude them from the content identity so
they cannot perturb generated response or item IDs when `trajectory_id`
is absent.  Retain the few extension fields that this adapter consumes.

```python
nemo_gym.atif_reverification._trajectory_identity_seed(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> str
```

```python
nemo_gym.atif_reverification._usage(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> nemo_gym.openai_utils.NeMoGymResponseUsage | None
```

```python
nemo_gym.atif_reverification._validate_declared_gym_source_identity(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7,
    manifest_key: tuple[int, int]
) -> None
```

```python
nemo_gym.atif_reverification._validate_projected_output_ids(
    output: list[typing.Any]
) -> None
```

```python
nemo_gym.atif_reverification._validate_supported_trajectory(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> None
```

```python
nemo_gym.atif_reverification.atif_trajectory_to_response(
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> nemo_gym.openai_utils.NeMoGymResponse
```

Project one complete text-only ATIF v1.7 trajectory into a Gym response.

```python
nemo_gym.atif_reverification.build_atif_verify_payload(
    materialized_input: dict[str, typing.Any],
    trajectory: nemo_gym.atif_v1_7.AtifTrajectoryV1_7
) -> dict[str, typing.Any]
```

Replace a materialized task's native response with its ATIF projection.

The materialized task remains authoritative for the system/user input,
verifier metadata, agent routing, and rollout correlation.  ATIF contributes
only the response produced by the external agent.

```python
nemo_gym.atif_reverification.index_materialized_inputs(
    rows: typing.Iterable[typing.Mapping[str, typing.Any]]
) -> dict[tuple[int, int], dict[str, typing.Any]]
```

Index materialized tasks without guessing identity from row order.

```python
nemo_gym.atif_reverification.load_atif_manifest(
    path: pathlib.Path
) -> list[nemo_gym.atif_reverification.AtifReverifyManifestEntry]
```

Load an explicit trajectory-to-rollout manifest from JSONL.

```python
nemo_gym.atif_reverification.load_atif_trajectory(
    path: pathlib.Path
) -> nemo_gym.atif_reverification.LoadedAtifTrajectory
```

Read and validate one ATIF document without involving the Relay runtime.

```python
nemo_gym.atif_reverification.project_atif_manifest_entries(
    entries: typing.Iterable[nemo_gym.atif_reverification.AtifReverifyManifestEntry],
    materialized_inputs: typing.Mapping[tuple[int, int], typing.Mapping[str, typing.Any]],
    manifest_directory: pathlib.Path
) -> list[nemo_gym.atif_reverification.ProjectedAtifVerifyPayload]
```

Project a one-to-one manifest while rejecting ambiguous batch joins.

```python
nemo_gym.atif_reverification.project_atif_manifest_entry(
    entry: nemo_gym.atif_reverification.AtifReverifyManifestEntry,
    materialized_inputs: typing.Mapping[tuple[int, int], typing.Mapping[str, typing.Any]],
    manifest_directory: pathlib.Path
) -> nemo_gym.atif_reverification.ProjectedAtifVerifyPayload
```

Resolve one manifest entry without relying on filenames or session IDs.

```python
nemo_gym.atif_reverification._RESPONSE_REQUEST_FIELDS = frozenset({'background', 'instructions', 'max_output_tokens', 'max_tool_calls', ...
```