# tinker_cookbook.rl.TrajectoryGroup

## _class_ [**tinker_cookbook.rl.TrajectoryGroup**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L400)()

A group of trajectories produced by one [`EnvGroupBuilder`](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/envgroupbuilder/).

Created by the rollout executor after running all environments in a group and computing group rewards. This is the primary data structure consumed by RL training algorithms.

The `_G` suffix follows the project convention for tensors/lists indexed over the group dimension.

**Fields:**

- [**trajectories_G**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L421) ( _list[ [Trajectory](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/rl/trajectory/)_)
- [**final_rewards_G**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L422) ( _list[float]_) – computed by the EnvGroupBuilder, looking at whole group
- [**metrics_G**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L423) ( _list[Metrics]_)  
- [**rollout_errors**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L427) ( _list[ [RolloutError](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/rl/rollouterror/), default: `field(default_factory=list)`_) – Empty list means no trajectory errors occurred.

### [**get_total_rewards**](https://github.com/thinking-machines-lab/tinker-cookbook/blob/main/tinker_cookbook/rl/types.py#L429)()

Get the total reward (return) for each trajectory in the group.

The total reward is the sum of the per-timestep rewards (from `Env.step`) plus the final group reward (from `EnvGroupBuilder.compute_group_rewards`).

**Returns:** _list[float]_ – Total rewards, one per trajectory in the group.

## Referenced by

- [tinker_cookbook.rl.assemble_training_data](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/rl/assemble_training_data/)
- [tinker_cookbook.rl.compute_advantages](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/rl/compute_advantages/)
- [tinker_cookbook.rl.RolloutError](https://tinker-docs.thinking-machines.ai/cookbook/api-reference/rl/rollouterror/)
