> ## Documentation Index
> Fetch the complete documentation index at: https://acme-c84a37e5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Circuit Breaker

> Preventing failure cascades with open and half-open states

## Instance configuration

```typescript theme={null}
import tryo from "tryo";

const runner = tryo({
  circuitBreaker: {
    failureThreshold: 2,
    resetTimeout: 1000,
    halfOpenRequests: 1,
  },
});
```

## Behavior

* Opens the circuit after `failureThreshold` consecutive errors
* During `resetTimeout`, calls fail immediately
* In `half-open`, limits the number of controlled probes

## Per call

```typescript theme={null}
import { run } from "tryo";

const r = await run(async () => 1, {
  circuitBreaker: { failureThreshold: 3, resetTimeout: 1500 },
});
```
