#[non_exhaustive]pub enum StopReason {
EndTurn,
MaxTokens,
MaxTurnRequests,
Refusal,
Cancelled,
}Expand description
Reasons why an agent stops processing a prompt turn.
See protocol docs: Stop Reasons
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EndTurn
The turn ended successfully.
MaxTokens
The turn ended because the agent reached the maximum number of tokens.
MaxTurnRequests
The turn ended because the agent reached the maximum number of allowed agent requests between user turns.
Refusal
The turn ended because the agent refused to continue. The user prompt and everything that comes after it won’t be included in the next prompt, so this should be reflected in the UI.
Cancelled
The turn was cancelled by the client via session/cancel.
This stop reason MUST be returned when the client sends a session/cancel
notification, even if the cancellation causes exceptions in underlying operations.
Agents should catch these exceptions and return this semantically meaningful
response to confirm successful cancellation.
Trait Implementations§
Source§impl Clone for StopReason
impl Clone for StopReason
Source§fn clone(&self) -> StopReason
fn clone(&self) -> StopReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy 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: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for StopReason
Source§impl IntoV2 for StopReason
Available on crate feature unstable_protocol_v2 only.
impl IntoV2 for StopReason
unstable_protocol_v2 only.Source§impl JsonSchema for StopReason
impl JsonSchema for StopReason
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for StopReason
impl PartialEq for StopReason
Source§fn eq(&self, other: &StopReason) -> bool
fn eq(&self, other: &StopReason) -> bool
self and other values to be equal, and is used by ==.