pub struct AgentRetryStrategy { /* private fields */ }Expand description
Retry strategy for AI agents
Implementations§
Source§impl AgentRetryStrategy
impl AgentRetryStrategy
Sourcepub fn with_config(
base_delay: Duration,
max_delay: Duration,
max_attempts: u32,
) -> Self
pub fn with_config( base_delay: Duration, max_delay: Duration, max_attempts: u32, ) -> Self
Create with custom configuration
Sourcepub fn with_jitter(self, factor: f64) -> Self
pub fn with_jitter(self, factor: f64) -> Self
Set jitter factor
Sourcepub fn with_retryable_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_retryable_pattern(self, pattern: impl Into<String>) -> Self
Add retryable pattern
Sourcepub fn with_non_retryable_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_non_retryable_pattern(self, pattern: impl Into<String>) -> Self
Add non-retryable pattern
Sourcepub fn get_retry_delay(&self, attempt: u32) -> Duration
pub fn get_retry_delay(&self, attempt: u32) -> Duration
Calculate retry delay with exponential backoff and jitter
Sourcepub fn is_retryable(&self, error: &str) -> bool
pub fn is_retryable(&self, error: &str) -> bool
Determine if an error is retryable
Sourcepub fn should_retry(&self, error: &str, attempt: u32) -> RetryDecision
pub fn should_retry(&self, error: &str, attempt: u32) -> RetryDecision
Get retry decision for an error
Trait Implementations§
Source§impl Clone for AgentRetryStrategy
impl Clone for AgentRetryStrategy
Source§fn clone(&self) -> AgentRetryStrategy
fn clone(&self) -> AgentRetryStrategy
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 AgentRetryStrategy
impl Debug for AgentRetryStrategy
Auto Trait Implementations§
impl Freeze for AgentRetryStrategy
impl RefUnwindSafe for AgentRetryStrategy
impl Send for AgentRetryStrategy
impl Sync for AgentRetryStrategy
impl Unpin for AgentRetryStrategy
impl UnsafeUnpin for AgentRetryStrategy
impl UnwindSafe for AgentRetryStrategy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more