> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Persistent Restart Loop Guard • AI Agent SDK

> PersistentRestartLoopGuard: A :class:`RestartLoopGuard` whose events survive a process restart.

# PersistentRestartLoopGuard

> Defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) 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::

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
guard = PersistentRestartLoopGuard(store, max_restarts=3,
                                   window_seconds=3600)
if guard.record(now=time.time()):
    # too many restart-interrupted boots — stop auto-resuming the turn
    ...
```

## Constructor

**store** `RestartStoreProtocol` *required*

No description available.

## Methods

> [card] [record()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/PersistentRestartLoopGuard-record.md)
>
> Record a restart at wall-clock `now` and flush to the store.

> [card] [reset()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/PersistentRestartLoopGuard-reset.md)
>
> Clear the history in memory *and* in the durable store.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L6258)
>
> `praisonaiagents/gateway/protocols.py` at line 6258


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.