Skip to main content
JSON file persistence saves agent sessions as human-readable files — no database required.
The user chats locally; JSON files persist the session without installing a database.

Quick Start

1

Simple Usage

Set session_id — PraisonAI persists to JSON automatically:
2

With Configuration

Custom session directory or the conversation JSON store:

How It Works


Compaction Checkpoint Key

When context compaction persists a checkpoint, the session JSON gains an optional top-level last_compaction object. It is omitted entirely when no checkpoint exists, so older session files load unchanged.
See Compacted Session Resume for how the key is produced and consumed.

Configuration Options

DefaultSessionStore

JSONConversationStore

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

No db= needed — set session_id and conversations persist to ~/.praisonai/sessions/ automatically.
Point DefaultSessionStore(session_dir=...) at a project folder to keep sessions alongside your code.
JSON suits development and small deployments. Move to SQLite or PostgreSQL when you need querying or multi-instance scaling.
Copy the session folder regularly — each session is a single readable .json file.

SQLite Persistence

Upgrade to SQLite for SQL queries and better concurrency

Database Persistence

Compare all persistence backends