Expand description
Resilience primitives for tool execution.
Collects the concerns that govern how tools recover from and bound transient failures:
circuit_breaker- state-machine fault isolation (Closed/Open/HalfOpen) keyed by tool name. Tracks failure counts, applies exponential backoff, and short-circuits calls when a downstream is degraded.adaptive_rate_limiter- per-key token-bucket rate limiter with adaptive refill and priority weighting. Used to throttle tools whose cost varies with the call.rate_limiter- per-tool budgeted counter rate limiter. Provides the per-tool token bucket that the executor uses for synchronous admission.ToolResilience- the unified facade. New callers should use this rather than reaching for the individual primitives, so that all three invariants (admission, fault isolation, post-call accounting) are checked in one place.
The primitives share callers (autonomous executor, tool pipeline, agent error recovery) but address distinct failure modes; they are grouped here so a maintainer can audit the full resilience toolkit in one place.
Modules§
- adaptive_
rate_ limiter - circuit_
breaker - rate_
limiter - Simple in‑process rate limiter for tool execution.
Structs§
- Tool
Resilience - Unified facade for tool resilience. Wraps the adaptive rate limiter and the circuit breaker so callers can use a single API for admission, fault isolation, and post-call accounting.
Enums§
- Call
Outcome - Outcome of a tool call, used by
ToolResilience::record_outcometo update the circuit breaker.
Statics§
- GLOBAL_
TOOL_ RESILIENCE - Process-wide resilience facade. Constructed lazily from the shared adaptive rate limiter and a default circuit breaker.