Quick Start
1
Simplest — enable via gateway.yaml
2
Custom window
3
Python — build the pure guard
How It Works
The guard runs around the channel supervisor loop. Each crashed boot is recorded; once the trailing window holdsmax_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
Start with the defaults (3 / 60s)
Start with the defaults (3 / 60s)
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.
Combine with max_restarts_per_hour for two-tier defence
Combine with max_restarts_per_hour for two-tier defence
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.After a trip, fix the cause then reconnect
After a trip, fix the cause then reconnect
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.Related
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.

