Skip to main content
The gateway now ships in the praisonai-bot package. praisonai serve gateway still works exactly as documented here; for a standalone install see praisonai-bot Migration.
Liveness closes half-open gateway connections by heartbeating over the wire and reaping any peer that misses too many beats.

Quick Start

1

Enable liveness on an agent's gateway

2

Tune the cadence

3

Or configure it in gateway.yaml


How It Works

The gateway emits a PING on each interval; any inbound frame (a PONG, a peer PING, or a normal message) refreshes last_activity. A silent peer misses beats until the reaper closes it. A connection is reaped once now > last_activity + interval_seconds × missed_beats_before_reap. Setting enabled=False (the default) makes evaluate always return KEEP, so upgrading changes nothing.

Configuration Options

LivenessConfig is the user-facing config; to_policy() bridges it to the pure LivenessPolicy the reaper consumes.

Full field, type, and default reference

Common Patterns

Pick a cadence from the peer’s network profile — the default is a no-op until you turn it on.

Disabled (default)

Mobile / NAT peers

Aggressive reaping for high-turnover realtime


Best Practices

Default is enabled=False — behaviour is unchanged. Only enable it when presence stays online after a peer vanishes.
The server advertises heartbeat_ms; the reference client’s watchdog trips at ~2× that. If you build your own client, honour the advertised value so both sides derive the same window from reap_deadline / interval_seconds.
Treat this close code as expected. Reconnect and resume — don’t surface it as a fatal error to the user.

Reliability Preset

Related resilience knobs

Session Continuity

What survives a reap

Hot-Reload Observability

Reload outcome, watcher liveness, and config drift in health()