Skip to Content
AgentShield
Self-Hosting

Backup and Recovery

What to back up, how to restore AgentShield without breaking the audit chain, and how to recover from data store failures.

What to back up

DataCriticalityHow
PostgreSQLCritical. Identities, policies, decisions, approvals, audit chain, outboxContinuous archiving (WAL) plus periodic base backups, or your provider's point-in-time recovery
Object storage (evidence)High for investigationsBucket versioning or replication; object lock for tamper resistance
Audit head exportsHigh: your out-of-band integrity referenceCopy each export's sequence and head_hash to a separate system
ConfigurationHighVersion the tools file, Kustomize overlays, and environment in source control; keep Secrets in your secret manager
RedisNot requiredEphemeral nonces, counters, and circuits
NATS JetStreamNot required for correctnessEvents are re-derivable from PostgreSQL while they are in the outbox; published events are retained seven days

Agent seeds are not held by AgentShield. Agent operators back them up, or simply rotate after a loss.

Restoring PostgreSQL

  1. Stop the gateway, control plane, and relay so nothing writes during the restore.
  2. Restore the database to the chosen point in time.
  3. Verify the audit chain against your most recent external head exports at or before that point. See Auditability.
  4. Start services and confirm readiness.

After a point-in-time restore:

  • Decisions, executions, and events after the restore point are gone. Side effects that happened in external systems during that window are not reversed; reconcile them from your tool providers' logs.
  • An execution claimed before the restore point but completed after it reappears as dispatched without an outcome. The gateway refuses to run it again (409), which is the safe behavior.
  • Approvals decided after the restore point must be decided again.

Redis loss

Losing Redis resets nonce reservations, budgets, and circuits. The gateway's readiness returns to 200 as soon as Redis answers again. For the following 60 seconds, a request captured shortly before the loss could be replayed once, because its timestamp is still valid and its nonce is no longer reserved. Use Redis persistence or replication if that window matters to you.

Relay or NATS loss

Events remain in event_outbox until JetStream acknowledges them. When the relay or NATS returns, the backlog drains in order. If the JetStream stream itself is lost, events already deleted from the outbox are not republished; they remain in security_events and the audit chain.

Object storage loss

Evidence rows in PostgreSQL keep each bundle's SHA-256. Restored objects that match are served normally; missing or altered objects are refused by the control plane with an integrity error. The underlying records the bundles were built from remain in PostgreSQL.

Recovery drills

  • Restore a backup to a separate environment quarterly and verify the audit chain against exported heads.
  • Run the chaos catalog against the restored environment to confirm the gateway still fails closed.

Was this page helpful?

On this page