Retry with Backoff & Circuit Breaking
Handle transient tool failures with bounded retries and backoff; break the circuit when a tool is persistently unhealthy.
This page is the complete instruction page for one pattern called "Retry with Backoff & Circuit Breaking." It explains the problem this pattern solves, the idea behind the solution, when you should (and should not) use it, and what happens afterward — both the good effects and the costs.
This matters because building AI agents is not just about making them clever. It is also about making them safe and predictable. Following a well-tested pattern like this one helps avoid common mistakes, and shows you exactly which safety rules and regulations it connects to, listed under "Standards Mesh" on this page.
Context
Tools fail — rate limits, network glitches, brief outages. An agent that does not retry loses legitimate work; an agent that retries forever cascades failure.
Problem
Naive error handling either drops work or amplifies outages.
Forces
- Resilience to transient faults vs persistent-fault containment
Solution
Wrap tool calls in retry-with-exponential-backoff (e.g. 3 attempts, 1s/3s/9s). Track per-tool failure rates; trip a circuit breaker when threshold exceeded and fast-fail for a cool-down window. On breaker-open, agent uses degradation path (alternative tool, cached data, human escalation).
Applicability
- Agents with external tool dependencies
- Production agent fleets
- High-volume agents
Anti-Patterns
- Infinite retry on every error
- No distinction between retryable and terminal errors
Consequences
- +Resilient to transient failures
- +Contains cascading failure
- −Library / framework dependency
- −Breakers need tuning