Skip to main content

Module retry

Module retry 

Source
Expand description

Unified retry policy

Provides RetryPolicy configuration and the with_retry execution wrapper, for unified use by all external calls: LLM / MCP / A2A / Sandbox, etc.

§Example

use echo_core::retry::{RetryPolicy, with_retry};
use std::time::Duration;

let policy = RetryPolicy::new(3, Duration::from_millis(500))
    .max_delay(Duration::from_secs(30))
    .jitter(true);

let result = with_retry(&policy, || async {
    // Potentially-failing async operation
    Ok::<_, String>("success".to_string())
}).await;

Structs§

RetryPolicy
Unified retry policy configuration

Functions§

with_retry
Execute an async operation with the given retry policy (all errors are considered retryable).
with_retry_if
Execute an async operation with the given retry policy.