Agent Recovery and Restart Policies After Kernel Panics or OOM Events
How to safely restart persistent agents after crashes without duplicating work or corrupting state.

Recovery after a kernel panic or OOM event is not complete when an agent’s process starts again. Persistent agents accumulate state, execution history, and external effects that a restart cannot reconstruct on its own. A correct recovery policy must determine what to restore, which checkpoint to use, and whether continuing from that checkpoint is safe.
Why kernel panics and OOM events are a different class of failure for agents than for stateless processes
An agent that restarts and sends an already-sent notification has compounded the failure. The same applies when it repeats a write against an already-modified record. Restarting restores execution while leaving the validity of the task state uncertain. A stateless function is designed to discard local state between invocations, while a persistent agent needs the context it builds up across tool calls.
The difficulty comes from where the crash interrupts execution. Long-running agents idle at low memory usage and then spike sharply at tool-call boundaries, often after earlier calls have changed external systems. An OOM kill can interrupt the next call without revealing whether its effect completed. A kernel panic also destroys the in-memory execution trace, leaving the last persisted checkpoint behind the outside world. Recovery needs both a process supervisor and a record of which work was completed before the crash.
How OOM events actually arrive in a running agent, and what they destroy
A tool call can drive a sharp peak faster than user-space machinery can react. Even so, the cgroup v2 memory controller can step in at two stages. Its memory.high setting applies a soft throttle and reclaim pressure without invoking the OOM killer, allowing execution to continue under pressure. Its memory.max setting invokes the OOM killer when usage reaches the hard limit and reclaim cannot reduce it sufficiently.
Most orchestration systems set only the hard limit and leave the soft-throttle stage unset, so they lose the earlier chance to shed load or save state. Once the kill occurs, there is no final checkpoint or cleanup. The agent loses its unpersisted context window and local state for any in-flight call, even though that call may already have changed an external system. File handles, sockets, and entropy-dependent state also need recovery handling. A kernel panic destroys more because the guest kernel state is lost without cleanup handlers running, so storage stays in whatever intermediate state execution had reached.
The checkpoint-before-meltdown principle and what state is worth persisting
A clean abort to a known-good checkpoint should count as a successfully salvaged partial run. The soft throttle can trigger an emergency flush while the agent can still run. Because a spike can still outrun that response, this window complements checkpoints taken during normal execution. Faster restart machinery cannot recover state that was never persisted.
Five categories define what meaningful preservation includes. The in-context working buffer needs a summarized snapshot of recent tool calls and reasoning, without which the agent cannot reconstruct its current intent without replaying history. Workflow execution position needs durable records of completed, in-flight, and pending steps, in a store such as PostgreSQL, or recovery risks starting again from step one. Semantic memory needs provenance-tagged facts, preferences, and knowledge so that a corrupt or poisoned entry can be quarantined on its own, apart from the rest of the store. The episodic event log needs a chronological record of issued calls and outcomes, or recovery lacks evidence of what has already happened outside the agent. Identity and credential state needs explicit recovery handling, including re-issuance of scoped tokens, session handles, and entropy-derived material, rather than blind restoration that duplicates identifiers.
The episodic log is especially important because a restored working buffer can describe intent without proving execution. Only the recorded history provides the basis for distinguishing unfinished work from work whose completion the agent failed to observe.

Choosing the checkpoint granularity: tool-call boundaries versus wall-clock intervals
Each call has an observable start and end, and checkpointing at every boundary limits lost execution to at most one call. The call’s external effect may still be there even when its execution is lost. It means the recovery audit has a bounded uncertainty to resolve through the episodic log. Because memory spikes are themselves tool-call-driven, boundary checkpoints also precede the moments when preservation is most valuable.
Wall-clock checkpointing is simpler but fits less well with how the agent runs. An interval can straddle a risky call and capture inconsistent mid-execution state, or remain too coarse to produce a checkpoint before a memory spike becomes fatal. A hybrid approach uses boundary checkpoints during pressure detected through memory.high events and coarser intervals during stable operation. The trade-off depends on the task profile and checkpoint I/O cost. Guardrailed Meta-Agent Loops: Stress-Testing Policy Pinning, Budget Bounds, and Crash Recovery addresses recovery in self-improving workflows, connecting checkpoint timing to performance and policy-state integrity. Whatever the granularity, the checkpoint that protects the next tool call must be durable before the agent issues that call.
Micro-VM isolation as the physical boundary that makes checkpoint-based recovery work
A crash in one agent must not corrupt another agent’s checkpoint storage, a guarantee shared container environments cannot provide in the same way as isolated micro-VMs. Firecracker uses KVM to give each guest its own kernel and hardware isolation. A guest OOM event or kernel panic is contained within that VM, leaving the host and sibling sandboxes unaffected by the guest failure. The persistent disk survives and keeps the last flushed checkpoint even when the guest kernel is gone.
Within that boundary, snapshot-restore is a recovery primitive. Firecracker preserves guest memory and CPU state so a fresh process can resume the guest from a saved moment. A clean snapshot at a tool-call boundary gives the guest a saved point to return to after it fails. Suspending idle agents offers a secondary economic benefit because their VMs can be torn down until the next wake event, making compute cost follow active concurrency.
Ambiguous recovery can also use a fork-tree pattern. When an in-flight call has an unknown outcome, fork_tree() can restore candidate paths from the pre-call snapshot in parallel. A path that resolves correctly, such as through an idempotent confirmation, is promoted and the others are reaped. That capability still depends on safe handling of restored identity and external communication.
Operational hazards introduced by snapshot-restore that recovery policy must account for
Restoring execution also restores assumptions that may no longer hold. Loading the same snapshot twice duplicates identifier state, entropy pools, session tokens, and cryptographic material, creating security risks and possible split-brain behavior downstream. Recovery policy must therefore consume a snapshot once, mark the prior file invalid after restore, and take a fresh checkpoint before external communication. The VMGenID device can signal restoration to the guest so credential re-issuance happens automatically.
Open connections do not survive snapshot-restore, so the agent must re-establish connectivity before network-dependent tool calls. The guest clock also freezes at snapshot time, potentially disrupting certificate validation, rate-limit logic, and time-sensitive calls. Recovery can enable clock_realtime on load, requiring host kernel 5.16+, or explicitly update the guest clock as the first post-restore action.
Isolation itself has a qualification that policy cannot ignore. KVM hypervisor bugs can invalidate the per-tenant sandboxing model, so a panic of uncertain origin cannot justify assuming that the host remains trustworthy. A policy that encodes these hazards as design requirements is more operationally sound than a simpler policy that leaves them unaddressed.
Deciding whether resumption is safe: the idempotency and external-effect audit
The episodic log makes the resumption decision possible. Before re-issuing a call that was in-flight at the crash, recovery must distinguish an operation that can safely repeat from one that could duplicate an effect. An idempotent read, query, or get can be re-issued unconditionally. A non-idempotent write, POST, or send requires a check of the external system for evidence of success before another attempt. Re-issuance is appropriate only when that evidence is absent. If the evidence is ambiguous, human review takes precedence over retrying because a pause is preferable to a duplicate write.
The audit extends beyond the interrupted call. Before execution continues, every logged action that changed external state since the last clean checkpoint must be checked to see whether it fits the intended task. Without the log, this review has no adequate evidence base. Restoring the agent’s internal state cannot establish whether a message was sent, a record was written, or a request was submitted.
The same audit shows which agents need recovery. The one_for_one strategy restarts only the crashed agent when its state is isolated and no downstream agent consumed its output. The one_for_all strategy restarts the group when shared state may be inconsistent, including a memory store that may have received a partial write. The rest_for_one strategy restarts the crashed agent and downstream dependents when they consumed incomplete output.

Restart timing, backoff, and the thundering-herd problem in multi-agent fleets
Recovery that works for one agent can still overload a fleet. When a shared-host OOM event or host kernel panic takes down co-located VMs, simultaneous restoration can saturate checkpoint storage, recreate memory pressure, or overwhelm downstream services. Exponential backoff with per-agent jitter spreads that demand over time. Retries begin after a short interval, double after each failure, and stop increasing at a maximum such as five minutes. The intervals are directional because appropriate timing depends on the task and the systems it touches.
Backoff does not resolve a persistent crash loop. A restart budget must detect repeated failures and escalate rather than repeatedly exposing the agent to the same triggering tool call. After a defined number of consecutive failures within a time window, a circuit breaker pauses the task, restricts tools to read-only operations, and routes pending work to human review. The circuit closes only after a human confirms that the cause is resolved. Micro-VM isolation makes this policy more precise because recovery can target failed agents without restarting healthy agents in a larger group.
Memory sizing strategy to reduce OOM frequency before recovery policy is needed
Static sizing can turn an anomalous spike into a permanent fleet expense. An agent that fits comfortably at its baseline tier fails during one unusual tool call, prompting a move to a larger tier for every agent. The resulting OOM ratchet prices the fleet around an exceptional peak. Using memory.high as a leading indicator instead allows operators to observe actual peak-to-baseline behavior before committing to a tier.
A spike in one micro-VM cannot OOM-kill neighboring agents, so limits can reflect each agent’s task profile. Snapshot-restore scheduling complements that separation by releasing compute between task turns. The fleet’s memory footprint follows active concurrency.
The final test is whether the restored state, execution history, and external effects form a condition from which the agent can correctly resume.


