pub enum ToolRetryPolicy {
Never,
Safe {
max_attempts: u32,
base_delay_ms: u64,
max_delay_ms: u64,
},
Idempotent {
max_attempts: u32,
base_delay_ms: u64,
max_delay_ms: u64,
},
}Expand description
Automatic retry policy for a tool’s execution.
This is intentionally separate from ToolScheduling: scheduling
decides whether different tool calls may run together, while retry policy
decides whether one failed call may be attempted again inside its scheduled
slot.
Variants§
Never
Never retry automatically. This is the default for every tool.
Safe
Retry only failures that explicitly report a safe retry disposition.
Idempotent
Retry only failures that explicitly report a safe retry disposition, and only when the runtime can provide a stable replay key.
Implementations§
Source§impl ToolRetryPolicy
impl ToolRetryPolicy
pub fn safe( max_attempts: u32, base_delay_ms: u64, max_delay_ms: u64, ) -> ToolRetryPolicy
pub fn idempotent( max_attempts: u32, base_delay_ms: u64, max_delay_ms: u64, ) -> ToolRetryPolicy
pub fn max_attempts(self) -> u32
pub fn delay_ms_for_retry( self, retry_index: u32, requested_after_ms: Option<u64>, ) -> u64
pub fn requires_replay_key(self) -> bool
Trait Implementations§
Source§impl Clone for ToolRetryPolicy
impl Clone for ToolRetryPolicy
Source§fn clone(&self) -> ToolRetryPolicy
fn clone(&self) -> ToolRetryPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ToolRetryPolicy
Source§impl Debug for ToolRetryPolicy
impl Debug for ToolRetryPolicy
Source§impl Default for ToolRetryPolicy
impl Default for ToolRetryPolicy
Source§fn default() -> ToolRetryPolicy
fn default() -> ToolRetryPolicy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ToolRetryPolicy
impl<'de> Deserialize<'de> for ToolRetryPolicy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolRetryPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolRetryPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ToolRetryPolicy
Source§impl PartialEq for ToolRetryPolicy
impl PartialEq for ToolRetryPolicy
Source§fn eq(&self, other: &ToolRetryPolicy) -> bool
fn eq(&self, other: &ToolRetryPolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ToolRetryPolicy
impl Serialize for ToolRetryPolicy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ToolRetryPolicy
Auto Trait Implementations§
impl Freeze for ToolRetryPolicy
impl RefUnwindSafe for ToolRetryPolicy
impl Send for ToolRetryPolicy
impl Sync for ToolRetryPolicy
impl Unpin for ToolRetryPolicy
impl UnsafeUnpin for ToolRetryPolicy
impl UnwindSafe for ToolRetryPolicy
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
Mutably borrows from an owned value. Read more