pub struct ToolRetryConfig {
pub max_retries: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub backoff_multiplier: f64,
pub jitter: f64,
pub retry_if: Option<RetryPredicate>,
}Expand description
Configuration for automatic retries when a tool execution fails.
When a tool handler returns an error and retry configuration is present, the registry will automatically retry with exponential backoff.
§Example
use llm_stack::provider::ToolRetryConfig;
use std::time::Duration;
let config = ToolRetryConfig {
max_retries: 3,
initial_backoff: Duration::from_millis(100),
max_backoff: Duration::from_secs(5),
backoff_multiplier: 2.0,
jitter: 0.5,
retry_if: None, // Retry all errors
};Fields§
§max_retries: u32Maximum retry attempts (not counting initial try). Default: 3.
initial_backoff: DurationInitial backoff duration before first retry. Default: 100ms.
max_backoff: DurationMaximum backoff duration cap. Default: 5 seconds.
backoff_multiplier: f64Backoff multiplier for exponential growth. Default: 2.0.
jitter: f64Jitter factor (0.0 to 1.0) applied to backoff. Default: 0.5.
retry_if: Option<RetryPredicate>Optional predicate to determine if an error is retryable.
Receives the error message. If None, all errors are retried.
Trait Implementations§
Source§impl Clone for ToolRetryConfig
impl Clone for ToolRetryConfig
Source§fn clone(&self) -> ToolRetryConfig
fn clone(&self) -> ToolRetryConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 ToolRetryConfig
impl Debug for ToolRetryConfig
Source§impl Default for ToolRetryConfig
impl Default for ToolRetryConfig
Source§impl PartialEq for ToolRetryConfig
impl PartialEq for ToolRetryConfig
Auto Trait Implementations§
impl Freeze for ToolRetryConfig
impl !RefUnwindSafe for ToolRetryConfig
impl Send for ToolRetryConfig
impl Sync for ToolRetryConfig
impl Unpin for ToolRetryConfig
impl !UnwindSafe for ToolRetryConfig
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