# Resource Exhaustion

> When a provider CLI returns a resource_exhausted error (e.g., Cursor hitting rate limits), Foundry does not crash or spam retries. It applies an…

Source: https://bifrost5.com/foundry/docs/resource-exhaustion/

# Resource Exhaustion

Information

Hand long, costly runs to people who answer within a defined time when something goes wrong, with Production-Grade.

[See editions](/foundry/docs/editions)

When a provider CLI returns a `resource_exhausted` error (e.g., Cursor hitting rate limits), Foundry does not crash or spam retries. It applies an exponential backoff strategy with circuit-breaking.

## Backoff Schedule

| Attempt | Wait |
| --- | --- |
| 1 | 1 minute |
| 2 | 5 minutes |
| 3 | 20 minutes |
| 4 | 1 hour |
| 5 | 2 hours |
| 6+ | Complete halt |

The supervisor sleeps during backoff intervals (longer intervals reduce CPU cycles). Attempt count, last attempt time, and next retry time are tracked in state.

## Circuit Breaker

- A failed provider is **circuit-broken for 1 day** (TTL stored in DragonflyDB).

- Foundry automatically **falls back to the next provider** in the configured priority chain.

- Circuit breaker TTL is configurable in Settings → General.

## Provider Priority Chain

Each provider strategy defines a fallback order. Example (claude-primary):

- Claude (primary)

- Cursor (fallback)

- Gemini (fallback)

If Claude is circuit-broken, tasks route to Cursor automatically: no operator intervention needed.
