Skip to main content
Because every event and state change is persisted, work can be redelivered or reconstructed.

Replaying an event

swarm event replay <event-id> (the event.replay method) redelivers a persisted event to its original subscribers, or a subset with --subscriber. It creates a new event that points back at the original, queues fresh deliveries, and records the replay itself in the audit trail. Only terminal originals (delivered, failed, or dead-lettered) are replayable.

Replaying for an agent

swarm agent replay <agent-id> --event-id <id> is the same primitive scoped to one agent. swarm agent replay-backlog <agent-id> redelivers an agent’s pending backlog — useful after a restart, if swarm run status shows an agent still blocked on undelivered events.

Crash recovery

On restart, the runtime replays any event that was persisted but not yet marked delivered. Each event carries an idempotency key — a fingerprint the runtime checks before acting — so replaying an already-processed event is a no-op rather than a second execution, and recovery does not double-process work.

Run-level fork

Fork reconstructs the full system state at a moment in time and resumes from there. Forks currently run against the same contract bundle as the source run; forking onto a new bundle is planned but not yet enabled.
Fork returns the new run’s ID; follow it with swarm run trace <new-run-id> -f. Flags:
  • --at-event <event-id> — fork at this source event; the new run starts as if the source run had just processed this event.
  • --bundle-hash <hash> — pin the fork to a specific bundle. Same-bundle forks only; cross-bundle forks are gated separately and currently rejected.
  • --idempotency-key <key> — retry-safe fork creation; identical key returns the same fork rather than creating a duplicate.
For finer-grained replay inside a run — one event, or one agent’s backlog — use the event and agent replay primitives above.