---
url: 'https://adk.nht.io/api/@nhtio/adk/lib/utils/retry/functions/computeBackoff.md'
---

# Function: computeBackoff()

```ts
function computeBackoff(attempt: number, cfg: BackoffConfig): number;
```

Defined in: [lib/utils/retry.ts:30](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/utils/retry.ts#L30)

Exponential backoff with a ceiling: `min(baseDelayMs * 2^(attempt-1), maxDelayMs)`.

## Parameters

| Parameter | Type                                              | Description                                                            |
| --------- | ------------------------------------------------- | ---------------------------------------------------------------------- |
| `attempt` | `number`                                          | 1-based attempt number.                                                |
| `cfg`     | [`BackoffConfig`](../interfaces/BackoffConfig.md) | Carries `baseDelayMs` (default 500) and `maxDelayMs` (default 30\_000). |

## Returns

`number`

The (un-jittered) delay in ms.
