Quick Start
How It Works
| Store | Location | Use case |
|---|---|---|
DefaultSessionStore | ~/.praisonai/sessions/ | Agent session_id (zero config) |
JSONConversationStore | Configurable path | Full conversation API via db() |
Compaction Checkpoint Key
When context compaction persists a checkpoint, the session JSON gains an optional top-levellast_compaction object. It is omitted entirely when no checkpoint exists, so older session files load unchanged.
| Field | Type | Default | Meaning |
|---|---|---|---|
summary | str | (required) | The condensed history the compactor produced |
message_index | int | 0 | Transcript length at compaction time; anything after this index is the tail |
role | str | "system" | Role used when replaying the summary as an LLM message |
tokens_before | int | 0 | Token count before compaction (observability) |
tokens_after | int | 0 | Token count after compaction (observability) |
timestamp | float | time.time() | When the checkpoint was written |
metadata | Dict[str, Any] | {} | Free-form extension slot |
Configuration Options
DefaultSessionStore
| Option | Type | Default | Description |
|---|---|---|---|
session_dir | str | ~/.praisonai/sessions/ | Directory for session JSON files |
max_messages | int | 100 | Maximum messages kept per session |
lock_timeout | float | 5.0 | File lock timeout in seconds |
JSONConversationStore
| Option | Type | Default | Description |
|---|---|---|---|
path | str | "./praisonai_conversations" | Directory for JSON files |
pretty | bool | True | Pretty-print JSON output |
On macOS, Linux, and Windows,
DefaultSessionStore uses file locking for multi-process safety. On platforms without fcntl, a one-time warning is logged and single-process usage remains safe.Best Practices
Use session_id for quick dev
Use session_id for quick dev
No
db= needed — set session_id and conversations persist to ~/.praisonai/sessions/ automatically.Set a custom session_dir for projects
Set a custom session_dir for projects
Point
DefaultSessionStore(session_dir=...) at a project folder to keep sessions alongside your code.Upgrade when data grows
Upgrade when data grows
JSON suits development and small deployments. Move to SQLite or PostgreSQL when you need querying or multi-instance scaling.
Back up the sessions directory
Back up the sessions directory
Copy the session folder regularly — each session is a single readable
.json file.Related
SQLite Persistence
Upgrade to SQLite for SQL queries and better concurrency
Database Persistence
Compare all persistence backends

