Skip to main content
Stop auto-resurrecting a channel that keeps crashing on resume, before it burns the process into a tight restart loop.

Quick Start

1

Simplest — enable via gateway.yaml

Defaults trip the breaker after 3 rapid restarts within 60 seconds for any channel.
2

Custom window

Trip only after 5 restarts inside a 2-minute window — more tolerant of transient flaps.
3

Python — build the pure guard

When the guard trips, the gateway logs the crash-loop-halted line and stops auto-resurrecting that channel.

How It Works

The guard runs around the channel supervisor loop. Each crashed boot is recorded; once the trailing window holds max_restarts events, the gateway stops resurrecting that channel.

Configuration Options

RestartLoopGuard constructor

Methods:

lifecycle.restart_loop_guard: YAML block

Accepted at the top level of gateway.yaml or nested under gateway:.

Imports

RestartLoopGuard exports from praisonaiagents.gateway. Top-level praisonaiagents does not re-export it.

How It Composes With Channel Supervision

The crash-loop guard is a rapid-fire breaker (seconds window) that runs around the supervisor loop. It is orthogonal to the Channel Supervision health-monitor machinery: Tune both for a two-tier defence: the guard catches immediate crash storms; max_restarts_per_hour catches slow, persistent flapping.

Log signal

When the guard trips, the gateway emits:

Best Practices

The defaults trip after 3 restarts within 60 seconds — a rate that only a genuine crash-on-resume loop hits. Change them only when a channel legitimately flaps (e.g. a flaky upstream) and you want more tolerance.
The guard is a fast breaker; max_restarts_per_hour on Channel Supervision is a slow per-hour cap. Enable both so a rapid crash storm is stopped in seconds and slow persistent flapping is stopped over the hour.
A trip means the channel stopped auto-resurrecting. Once the underlying crash is fixed, run praisonai gateway reconnect <channel> (see Channel Supervision → Reconnect) to reset error state and bring the channel back.

Channel Supervision

Self-healing channels — the supervisor the guard wraps.

Gateway Exit Codes

Restart-intent exit codes that pair with crash forensics.

Scale to Zero

Sibling lifecycle policy — idle-quiesce for serverless hosts.

Drain Trigger

Sibling lifecycle policy — epoch-safe external drain marker.