pub enum ModelStopReason {
EndTurn,
ToolUse,
MaxTokens,
Refusal,
ContextWindowExceeded,
Unrecognized,
}Expand description
Why the model stopped producing output for this round, as reported by the gateway. The kernel validates only the EndTurn/ToolUse structural pairing; interpreting terminal reasons is driver policy.
Exhaustive on purpose: the runtime decides what a turn does next from this value, so a new one is a breaking change.
Serializable for logs and tests; the serialized form is not part of the stable set and may change in any release.
Variants§
EndTurn
The model ended its turn without requesting tools; tool_calls must
be empty.
ToolUse
The model requested tool invocations; tool_calls must be non-empty.
MaxTokens
Output was cut off at the token limit.
Refusal
The model (or a provider content filter) refused to produce output.
ContextWindowExceeded
The provider stopped because the context window was exhausted. The output was not committed; the runner reports it as an interruption.
Unrecognized
The provider reported a stop value this kernel has no meaning for. The
output was not committed and the wire value is preserved on
ModelOutput::raw_stop_reason.