> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# RetryOptions

# RetryOptions

Retry-policy options accepted by [`withRetry`](https://www.adaline.ai/docs/reference/sdk/v2/typescript/classes/adaline#namespace-clients). The same policy is used by every namespace client method; the exported helper is useful when you need that behavior on a call that isn't wrapped yet (e.g., a direct call to `adaline.deploymentsApi.*` or `adaline.logsApi.*`).

## Definition

```typescript theme={null}
interface RetryOptions {
  retries?: number;
  minTimeout?: number;
  maxTimeout?: number;
  randomize?: boolean;
  maxRetryTime?: number;
  factor?: number;
}
```

## Fields

| Field | Type | Default | Description |
| - | - | - | - |
| `retries` | `number` | `10` | Maximum number of retry attempts on 5xx responses. |
| `minTimeout` | `number` | `1000` | Minimum delay between attempts (ms). |
| `maxTimeout` | `number` | `10000` | Maximum delay between attempts (ms). |
| `factor` | `number` | `2` | Exponential backoff factor. Each retry waits `factor ×` the previous delay. |
| `randomize` | `boolean` | `true` | If `true`, adds jitter to each delay. |
| `maxRetryTime` | `number` | `20000` | Hard ceiling on total time spent retrying (ms). The retry loop gives up once this is exceeded. |

## Defaults

The exported `DEFAULT_RETRY_OPTIONS` constant is what every namespace client uses:

```typescript theme={null}
const DEFAULT_RETRY_OPTIONS: RetryOptions = {
  retries: 10,
  minTimeout: 1000,
  maxTimeout: 10000,
  randomize: true,
  maxRetryTime: 20000,
  factor: 2,
};
```

## Behavior

* **5xx responses** — retried with exponential backoff and jitter.
* **4xx responses** — aborted immediately via `AbortError`; no retries.
* **Network errors** — retried like 5xx.

## Usage

```typescript theme={null}
import { Adaline, withRetry } from '@adaline/client';

const adaline = new Adaline();

// Short-circuit retries for a latency-sensitive path
const deployment = await withRetry(
  () => adaline.deploymentsApi.getDeployment('prompt_abc123', 'deploy_xyz789'),
  { retries: 2, maxRetryTime: 2000 },
);
```

## See Also

* [withRetry helper](https://www.adaline.ai/docs/reference/sdk/v2/typescript/classes/adaline.md#namespace-clients)
* [Adaline class](https://www.adaline.ai/docs/reference/sdk/v2/typescript/classes/adaline.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.