Expand description
Configurable retry policy for transient client errors.
Wraps any Transport to automatically retry on transient failures
(connection errors, timeouts, server 5xx responses) with exponential
backoff.
§Interceptors run once per call, not per attempt
The retry layer sits below the client’s interceptor chain: headers an
AuthInterceptor produces are computed once and
reused for every attempt. A server-directed Retry-After (delta-seconds
or an HTTP-date) is honored up to RetryPolicy’s max_backoff (30 s by
default): never shortened, and lengthened at random by up to a quarter so
that clients refused together do not all return together. A longer one
ends the retrying: to wait less is to retry inside the penalty window the
server asked for, so the call returns the error, which carries the delay
(ClientError::retry_after) for the caller to act on. A short-lived
credential can expire between attempts — the retried request then fails with
a non-retryable auth error rather than re-deriving the header. Refresh
credentials in the store and issue a new call if that matters for your
deployment.
§Example
use a2a_protocol_client::{ClientBuilder, RetryPolicy};
let client = ClientBuilder::new("http://localhost:8080")
.with_retry_policy(RetryPolicy::default())
.build()?;Structs§
- Retry
Budget - How many retries a client may make, as a fraction of the calls it makes.
- Retry
Policy - Configuration for automatic retry with exponential backoff.