# tinker_cookbook.rl.StopReason

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

Why a trajectory ended.

Environments that know why an episode terminated record the reason as a one-hot metric `metrics["stop/<reason>"] = 1.0` on the final transition (alongside any pre-existing metric keys), and the rollout loop mirrors it onto `Trajectory.stop_reason`.

Not every value is produced by every environment; some values are reserved for rollout features that report them (e.g. sampled-token budgets, tool-call caps, and rollout timeouts).

## Referenced by

- [tinker_cookbook.completers.TokensWithLogprobs](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/completers/tokenswithlogprobs/)
- [tinker_cookbook.rl.ActionExtra](https://tinker-docs.thinkingmachines.ai/cookbook/api-reference/rl/actionextra/)
