Skip to main content

Persistence Overview

PraisonAI supports automatic database persistence for conversations, knowledge, and state management across 22 database backends.

Quick Start

Enable persistence in 2 lines:
from praisonaiagents import Agent
from praisonai.db import PraisonDB

agent = Agent(
    name="Assistant",
    db=PraisonDB(database_url="postgresql://localhost/mydb"),
    session_id="my-session"
)
agent.chat("Hello!")  # Auto-persists

Installation

pip install "praisonai[tools]"

Supported Backends

CategoryBackendsCount
ConversationPostgreSQL, MySQL, SQLite, SingleStore, Supabase, SurrealDB6
KnowledgeQdrant, ChromaDB, Pinecone, Weaviate, LanceDB, Milvus, PGVector, Redis, Cassandra, ClickHouse10
StateRedis, MongoDB, DynamoDB, Firestore, Upstash, Memory6

Architecture

┌─────────────────────────────────────────┐
│           praisonaiagents.Agent         │
│              (db=adapter)               │
└─────────────────┬───────────────────────┘

┌─────────────────▼───────────────────────┐
│           praisonai.db.PraisonDB        │
│         (DbAdapter Protocol)            │
└─────────────────┬───────────────────────┘

┌─────────────────▼───────────────────────┐
│     praisonai.persistence Layer         │
├─────────────┬─────────────┬─────────────┤
│ Conversation│  Knowledge  │    State    │
│   Store     │    Store    │    Store    │
└─────────────┴─────────────┴─────────────┘

Key Features

  • Zero Config: SQLite works out of the box
  • Session Resume: Same session_id = continue conversation
  • Lazy Loading: No performance impact until used
  • CLI Support: praisonai persistence doctor/run/resume

Next Steps