pub struct RetryPolicy {
pub max_attempts: u32,
pub backoff: BackoffStrategy,
pub initial_delay: Duration,
pub max_delay: Duration,
pub jitter: bool,
pub retryable_on: Vec<ErrorClass>,
}Expand description
Defines how a node retries on failure.
Fields§
§max_attempts: u32Maximum number of attempts (including the first). Must be >= 1.
backoff: BackoffStrategyBackoff strategy between attempts.
initial_delay: DurationInitial delay before the first retry.
max_delay: DurationMaximum delay cap (exponential backoff will not exceed this).
jitter: boolWhether to add random jitter to delays (prevents thundering herd).
retryable_on: Vec<ErrorClass>Which error classes are retryable. Empty = retry on any error.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn io_default() -> Self
pub fn io_default() -> Self
A sensible default for I/O-bound tool calls.
Sourcepub fn llm_default() -> Self
pub fn llm_default() -> Self
A sensible default for LLM calls.
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Compute the delay before the nth retry (0-indexed).
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
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 RetryPolicy
impl Debug for RetryPolicy
Source§impl<'de> Deserialize<'de> for RetryPolicy
impl<'de> Deserialize<'de> for RetryPolicy
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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