> ## Documentation Index
> Fetch the complete documentation index at: https://docs.staging.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](https://docs.staging.relayapp.im/live/authentication.md) |
| Verify the raw webhook request before accepting it | [Signature verification](https://docs.staging.relayapp.im/webhooks/verify-signatures.md) |
| Commit and deduplicate events before acknowledging | [Webhook delivery](https://docs.staging.relayapp.im/webhooks/delivery.md) or [WebSocket ACKs](https://docs.staging.relayapp.im/websocket/acknowledgements.md) |
| Run model and tool work after acknowledgment | [Webhook delivery](https://docs.staging.relayapp.im/webhooks/delivery.md) |
| Retry a message with its original key and body | [Idempotency](https://docs.staging.relayapp.im/live/idempotency.md) |
| Complete recovery before resuming WebSocket ACKs | [FULL sync](https://docs.staging.relayapp.im/websocket/full-sync.md) |
| Keep event acknowledgment apart from Delivered and Read | [Delivery receipts](https://docs.staging.relayapp.im/messages/receipts.md) |
| Store attachment IDs rather than expiring download URLs | [Download attachments](https://docs.staging.relayapp.im/messages/receiving-media.md) |
| Cache only history this contact can access | [Message history](https://docs.staging.relayapp.im/chats/history.md) |

## 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](https://docs.staging.relayapp.im/live/debugging.md). 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](https://docs.staging.relayapp.im/live/debugging.md)
* [Use idempotency keys](https://docs.staging.relayapp.im/live/idempotency.md)
* [Configure SDK retries](https://docs.staging.relayapp.im/live/retries.md)
* [Handle SDK errors](https://docs.staging.relayapp.im/live/errors.md)


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