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

# Best practices

> Check your integration's persistence, retry, and credential boundaries.

Check these nine boundaries before you put your agent backend in front of people.

## Review each boundary

Each row is a rule the owning page explains in full. The pattern behind all of them is the same: commit before you acknowledge, retry with the same key, and keep credentials where only your server can read them.

| Check                                                   | Owning guide                                                                            |
| ------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| Keep the token in server-side secret storage            | [Authentication](/live/authentication)                                                  |
| Verify the raw webhook request before accepting it      | [Signature verification](/webhooks/verify-signatures)                                   |
| Commit and deduplicate events before acknowledging      | [Webhook delivery](/webhooks/delivery) or [WebSocket ACKs](/websocket/acknowledgements) |
| Run model and tool work after acknowledgment            | [Webhook delivery](/webhooks/delivery)                                                  |
| Retry a message with its original key and body          | [Idempotency](/live/idempotency)                                                        |
| Complete recovery before resuming WebSocket ACKs        | [FULL sync](/websocket/full-sync)                                                       |
| Keep event acknowledgment apart from Delivered and Read | [Delivery receipts](/messages/receipts)                                                 |
| Store attachment IDs rather than expiring download URLs | [Download attachments](/messages/receiving-media)                                       |
| Cache only history this contact can access              | [Message history](/chats/history)                                                       |

## When it fails

The failures these rules prevent look alike from the outside: a reply sent twice, a reply never sent, or a message that arrived while your backend was down. Start from the identifiers on the [debugging page](/live/debugging). The `event_id` tells you whether an event was delivered twice, and the `trace_id` matches a request to Relay's own record of it.

## Next steps

* [Debug with trace IDs](/live/debugging)
* [Use idempotency keys](/live/idempotency)
* [Configure SDK retries](/live/retries)
* [Handle SDK errors](/live/errors)
