Skip to main content

PersistentRestartLoopGuard

Defined in the protocols module.
AI Agent A :class:RestartLoopGuard whose events survive a process restart. The in-memory guard is reconstructed fresh on every boot, so a persisted turn that hard-crashes the whole process (OOM, segfault) can drive an infinite supervisor → boot → auto-resume → crash loop the breaker never sees. This subclass loads its event history from an injected :class:RestartStoreProtocol at construction and flushes back on every mutation, so the breaker observes the true cross-boot restart rate and can trip on a crash cycle slower than a single in-process window. The window defaults to one hour (vs. the in-process 60s) because a cross-boot crash loop is paced by process (re)start latency, not by an in-loop retry. Pure decision preserved: all persistence is delegated to the injected store, so the trip logic remains provable in isolation. Example::

Constructor

RestartStoreProtocol
required
No description available.

Methods

record()

Record a restart at wall-clock now and flush to the store.

reset()

Clear the history in memory and in the durable store.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 4982