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
How it works
| Role | Responsibility |
|---|---|
| Client | Track highest cursor; send since on reconnect |
| Gateway | Rehydrate sessions; emit replay frames |
| SessionStore | Persist state to disk |
| TTL cleanup | Hourly purge of expired sessions |
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
| Option | Type | Default | Description |
|---|---|---|---|
persist | bool | false | Enable persistent session storage |
persist_path | str | ~/.praisonai/sessions/ | Storage directory |
resume_window | int | 86400 | Seconds a detached session stays resumable (24 h) |
timeout | int | 3600 | Active session expiry in seconds |
max_messages | int | 1000 | History cap per session |
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

