Skip to main content

Memory Storage

PraisonAI supports 22+ database backends for memory persistence. Choose the right one for your use case.

Storage Categories

Conversation Stores

Store conversation history and chat context. Best for session continuity.

PostgreSQL

Production-ready relational DB

MySQL

Popular relational DB

SQLite

Zero-config local storage

JSON

Simple file-based storage

Supabase

Managed Postgres

Neon

Serverless Postgres

State Stores

Store agent state, checkpoints, and runtime data. Best for complex workflows.

Redis

High-speed caching

MongoDB

Document store

DynamoDB

AWS managed

Firestore

Google Cloud

Upstash

Serverless Redis

Quick Setup

from praisonaiagents import Agent

# SQLite (zero-config, default)
agent = Agent(memory=True)

# PostgreSQL
agent = Agent(
    memory={
        "db": "postgresql://localhost/mydb",
        "session_id": "user-123"
    }
)

# Redis
agent = Agent(
    memory={
        "backend": "redis",
        "db": "redis://localhost:6379",
        "session_id": "user-123"
    }
)

Choosing a Database

Use CaseRecommendedWhy
Local developmentSQLite/JSONZero config
Production web appPostgreSQLReliable, scalable
High-speed cachingRedisSub-ms latency
ServerlessNeon/UpstashNo server management
AWS infrastructureDynamoDBNative integration

Storage Backends

For training data, sessions, and general persistence, PraisonAI provides pluggable storage backends:
BackendDependenciesBest For
FileBackendNoneDevelopment, debugging
SQLiteBackendNoneProduction, concurrent access
RedisBackendredisHigh-speed caching, distributed
from praisonaiagents.storage import FileBackend, SQLiteBackend, RedisBackend

# File-based (default)
file_backend = FileBackend(storage_dir="~/.praisonai/data")

# SQLite (recommended for production)
sqlite_backend = SQLiteBackend(db_path="~/.praisonai/data.db")

# Redis (for distributed systems)
redis_backend = RedisBackend(url="redis://localhost:6379", prefix="praison:")
See Storage Backends for detailed usage with all components.

Database Overview

Complete database reference

Session Resume

Continue conversations

Storage Backends

Pluggable storage backends