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.
Persistent sessions keep conversation state alive across gateway restarts and let clients resume mid-conversation with event replay.
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.
The user returns later; persisted session state reloads so the agent remembers prior turns.

Quick Start

1

Enable persistence

Default storage: ~/.praisonai/sessions/
2

Resume as a client

3

Full configuration

What gets persisted

The on-disk record under persist_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):
Server joined:
Replay frames:
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:
Choosing resume_window: minutes for ephemeral chat, 24 h for support bots, up to 7 days for long tasks.

Best Practices

Without since, the client may miss events between disconnect and resume.
Too short loses conversations; too long grows disk usage.
Session files should be included in normal backup rotation.
Do not share storage between two gateway processes — see Gateway Overview single-instance guidance.

Gateway Overview

Gateway setup and configuration

Bot vs Gateway

When to use gateway vs direct bots