#[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 From<StopReason> for StopReason
Available on crate feature unstable_protocol_v2 only.
impl From<StopReason> for StopReason
unstable_protocol_v2 only.Source§fn from(value: StopReason) -> Self
fn from(value: StopReason) -> Self
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§impl Serialize for StopReason
impl Serialize for StopReason
impl StructuralPartialEq for StopReason
Source§impl TryFrom<StopReason> for StopReason
Available on crate feature unstable_protocol_v2 only.
impl TryFrom<StopReason> for StopReason
unstable_protocol_v2 only.Source§type Error = ProtocolConversionError
type Error = ProtocolConversionError
Source§fn try_from(value: StopReason) -> Result<Self>
fn try_from(value: StopReason) -> Result<Self>
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
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.