#[non_exhaustive]pub enum StopReason {
Show 17 variants
Cancelled,
Checkpoint,
ContentFiltered,
EndTurn,
GuardrailIntervened,
Interrupt,
MaxTokens,
LimitOutputTokens,
LimitStructuredOutputAttempts,
LimitTotalTokens,
LimitTurns,
PauseTurn,
Refusal,
StopSequence,
ToolUse,
ModelContextWindowExceeded,
Other(UnknownStopReason),
}Expand description
Why the model or the agent loop stopped (StopReason).
The set is open: a value this version does not know round-trips through StopReason::Other.
Build values from strings with StopReason::from, so a known string such as "endTurn" always
becomes its named variant and compares equal to it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Cancelled
The invocation was cancelled.
Checkpoint
The agent paused at a cycle boundary for durable execution.
ContentFiltered
Content was filtered by safety mechanisms.
EndTurn
Natural end of the model’s turn.
GuardrailIntervened
A guardrail policy stopped generation.
Interrupt
Execution was interrupted for human input.
MaxTokens
The provider’s per-call token cap was reached.
LimitOutputTokens
The invocation’s outputTokens limit was reached.
LimitStructuredOutputAttempts
The invocation’s structuredOutputAttempts limit was reached.
LimitTotalTokens
The invocation’s totalTokens limit was reached.
LimitTurns
The invocation’s turns limit was reached.
PauseTurn
The model paused a long-running turn; send the response back to continue.
Refusal
A streaming classifier intervened on a potential policy violation.
StopSequence
A stop sequence was encountered.
ToolUse
The model wants to use a tool.
ModelContextWindowExceeded
The input exceeded the model’s context window.
Other(UnknownStopReason)
Any other value, kept verbatim.
Implementations§
Trait Implementations§
Source§impl Clone for StopReason
impl Clone for StopReason
Source§impl Debug for StopReason
impl Debug for StopReason
Source§impl<'de> Deserialize<'de> for StopReason
impl<'de> Deserialize<'de> for StopReason
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for StopReason
impl Display for StopReason
impl Eq for StopReason
Source§impl From<&str> for StopReason
impl From<&str> for StopReason
Source§impl From<String> for StopReason
impl From<String> for StopReason
Source§impl Hash for StopReason
impl Hash for StopReason
Source§impl PartialEq for StopReason
impl PartialEq for StopReason
Source§impl Serialize for StopReason
impl Serialize for StopReason
impl StructuralPartialEq for StopReason
Auto Trait Implementations§
impl Freeze for StopReason
impl RefUnwindSafe for StopReason
impl Send for StopReason
impl Sync for StopReason
impl Unpin for StopReason
impl UnsafeUnpin for StopReason
impl UnwindSafe for StopReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more