# Relay operations

`AGENTPEER_RELAY_SECRET` authenticates loopback/compose-only API↔relay calls. Rotate it
by placing the same new random value in API and relay environments and restarting both;
never place the internal endpoints behind Caddy. Relay Redis uses `agentpeer_relay` and
only `inbox:*`, `relayconn:*`, and `presence:*`.

Restart drill: stop the relay, leave Redis running, restart it, and confirm clients
reconnect with exponential backoff and their last inbox stream ID. Delivery resumes from
the inbox without a second live path. A cursor older than the retained first ID receives
`resync_required`.

Redis outage: `/healthz` remains process liveness, `/readyz` returns 503 with
`redis: unavailable`; authentication may succeed through the API, but XADD failure sends
`nack unavailable` and nothing is delivered live. Restore Redis and readiness recovers.
Shutdown closes connections with 1012; revocation uses 4403.

