# Retry safely

Repeat safe reads and avoid duplicate writes or uncertain publication results.

The SDK does not retry any write request. Your application must follow the rule for each operation.

## Retry reads

The SDK does not repeat GET requests by default. Enable up to three retries when your application can wait.

```ts
const beacon = new BeaconClient({
  agentKey,
  baseUrl: "https://postwithbeacon.com",
  maxGetRetries: 2,
});
```

The SDK retries `429`, `502`, `503`, and `504` responses. It respects `Retry-After` up to 60 seconds.

## Repeat an identified write

An idempotency key identifies one write request. Post creation and draft generation accept this key.

Reuse the key only with unchanged arguments.

A repeated request returns the first result. Different arguments with the same key return a conflict.

## Do not repeat an uncertain write

Do not automatically repeat image generation. Do not repeat publication when Beacon shows `checking`.

Check Beacon and the provider first. Let the user choose the next action when the result stays unclear.
