nemo_gym.rollouts.trajectory_builder
nemo_gym.rollouts.trajectory_builder
Building a rollout’s trajectory record from its model calls and the observations its agent reported.
Module Contents
Functions
Data
API
Split one captured model call into the turn’s question, answer, reasoning, and tool-call count.
Handles the three dialects the Model Server captures: Responses API output items, chat-completions messages, and Anthropic Messages content blocks.
Build policy turns from captured calls for an agent that sent no trajectory.
A call belongs to the invocation whose model_calls reference it. Unreferenced calls stay
in the raw evidence but do not become turns: even a single-agent rollout may capture judge
or auxiliary calls that do not belong to the agent. Compaction helpers remain invocation-owned
calls for token accounting, but never become policy turns, even when agent ownership claims
conflict. Preserve those claims for validation rather than choosing which owner is correct.
Explicit verifier ownership also excludes a call from turns when an agent incorrectly references it;
retain both ownership claims for validation.