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§
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§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>,
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 more