Skip to main content

Persistence Overview

Persist agent state to resume sessions and maintain context across runs.

What Gets Persisted

  • Memory: Conversation history and context
  • Session State: Current task progress
  • Checkpoints: Intermediate results
  • Configuration: Agent settings

Quick Start

from praisonaiagents import Agent, Session

# Create session with persistence
session = Session(
    session_id="my-session",
    persistence="sqlite"
)

agent = Agent(
    name="Assistant",
    session=session
)

# Run agent
agent.start("Hello!")

# Later, resume the same session
session = Session(session_id="my-session", persistence="sqlite")
agent = Agent(name="Assistant", session=session)
agent.start("What did we talk about?")  # Remembers previous context

Persistence Backends

BackendUse CaseSetup
SQLiteLocal developmentpersistence="sqlite"
PostgreSQLProductionpersistence="postgresql"
RedisHigh-performancepersistence="redis"
MongoDBDocument storagepersistence="mongodb"