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.This page covers agent session persistence (messages, events, cursors). Gateway sessions additionally preserve
pending_inbox and is_executing across disconnects and graceful shutdown — see Gateway Session Continuity.Quick Start
1
Enable persistence
~/.praisonai/sessions/2
Resume as a client
3
Full configuration
What gets persisted
The on-disk record underpersist_path is the JSON returned by GatewaySession.to_dict(). Key fields:
capabilities and protocol_version are restored on resume so server-side code that branches on either keeps working without re-handshake. A persisted record from before the upgrade (no capabilities key) restores cleanly to [] — no migration required.How it works
Reconnect protocol
Client join (resume):Every
response, message, stream_end, and error frame includes a monotonic cursor. Track the highest value for the next reconnect.Configuration options
Common patterns
Python override:resume_window: minutes for ephemeral chat, 24 h for support bots, up to 7 days for long tasks.
Best Practices
Always send since on reconnect
Always send since on reconnect
Without
since, the client may miss events between disconnect and resume.Match resume_window to user behaviour
Match resume_window to user behaviour
Too short loses conversations; too long grows disk usage.
Back up persist_path
Back up persist_path
Session files should be included in normal backup rotation.
One gateway per persist_path
One gateway per persist_path
Do not share storage between two gateway processes — see Gateway Overview single-instance guidance.
Related
Gateway Overview
Gateway setup and configuration
Bot vs Gateway
When to use gateway vs direct bots

