pub struct ToolRetryPolicy {
pub max_retries: usize,
pub backoff: BackoffStrategy,
pub retryable_patterns: Vec<String>,
}Expand description
Policy controlling when and how tool execution is retried on failure.
Fields§
§max_retries: usizeMaximum number of retry attempts (0 = no retries).
backoff: BackoffStrategyBackoff strategy between attempts.
retryable_patterns: Vec<String>If set, only errors whose message contains one of these substrings are retried.
Implementations§
Source§impl ToolRetryPolicy
impl ToolRetryPolicy
Sourcepub fn exponential(max_retries: usize) -> Self
pub fn exponential(max_retries: usize) -> Self
Creates a policy with exponential backoff (100ms base, 10s max).
Sourcepub fn fixed(max_retries: usize, delay: Duration) -> Self
pub fn fixed(max_retries: usize, delay: Duration) -> Self
Creates a policy with fixed delay between retries.
Sourcepub fn retryable_on(self, patterns: Vec<String>) -> Self
pub fn retryable_on(self, patterns: Vec<String>) -> Self
Only retry if the error message contains one of these substrings.
Sourcepub fn is_retryable(&self, error_msg: &str) -> bool
pub fn is_retryable(&self, error_msg: &str) -> bool
Returns true if the given error message is eligible for retry.
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 moreSource§impl Debug for ToolRetryPolicy
impl Debug 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