> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory Storage

> Database backends for agent memory and state persistence

# 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.

<CardGroup cols={3}>
  <Card title="PostgreSQL" icon="elephant" href="/docs/databases/postgres">
    Production-ready relational DB
  </Card>

  <Card title="MySQL" icon="database" href="/docs/databases/mysql">
    Popular relational DB
  </Card>

  <Card title="SQLite" icon="file" href="/docs/databases/sqlite">
    Zero-config local storage
  </Card>

  <Card title="JSON" icon="brackets-curly" href="/docs/databases/json">
    Simple file-based storage
  </Card>

  <Card title="Supabase" icon="bolt" href="/docs/databases/supabase">
    Managed Postgres
  </Card>

  <Card title="Neon" icon="cloud" href="/docs/databases/neon">
    Serverless Postgres
  </Card>
</CardGroup>

### State Stores

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

<CardGroup cols={3}>
  <Card title="Redis" icon="bolt" href="/docs/databases/redis">
    High-speed caching
  </Card>

  <Card title="MongoDB" icon="leaf" href="/docs/databases/mongodb">
    Document store
  </Card>

  <Card title="DynamoDB" icon="aws" href="/docs/databases/dynamodb">
    AWS managed
  </Card>

  <Card title="Firestore" icon="google" href="/docs/databases/firestore">
    Google Cloud
  </Card>

  <Card title="Upstash" icon="cloud" href="/docs/databases/upstash">
    Serverless Redis
  </Card>

  <Card title="Dakera" icon="brain" href="/docs/features/dakera-memory">
    Decay-weighted vector recall
  </Card>
</CardGroup>

## Quick Setup

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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 Case                              | Recommended  | Why                                           |
| ------------------------------------- | ------------ | --------------------------------------------- |
| Local development                     | SQLite/JSON  | Zero config                                   |
| Production web app                    | PostgreSQL   | Reliable, scalable                            |
| High-speed caching                    | Redis        | Sub-ms latency                                |
| Serverless                            | Neon/Upstash | No server management                          |
| AWS infrastructure                    | DynamoDB     | Native integration                            |
| Decay-weighted recall across sessions | Dakera       | Importance-scored, time-decayed memory server |

For self-hosted decay-weighted vector memory with importance scoring and tiered recall, see [Dakera Memory](/docs/features/dakera-memory).

## Storage Backends

For training data, sessions, and general persistence, PraisonAI provides pluggable storage backends:

| Backend           | Dependencies | Best For                        |
| ----------------- | ------------ | ------------------------------- |
| **FileBackend**   | None         | Development, debugging          |
| **SQLiteBackend** | None         | Production, concurrent access   |
| **RedisBackend**  | `redis`      | High-speed caching, distributed |

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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:")
```

<Note>
  FileMemory sanitises `user_id` before using it as a directory name — values containing path separators, `..`, or other unsafe characters fall back to `"default"`. This prevents accidental writes outside the configured memory directory.
</Note>

See [Storage Backends](/docs/storage/backends) for detailed usage with all components.

## Related

<CardGroup cols={2}>
  <Card title="Database Overview" icon="database" href="/docs/databases/overview">
    Complete database reference
  </Card>

  <Card title="Session Resume" icon="rotate" href="/docs/persistence/session-resume">
    Continue conversations
  </Card>

  <Card title="Storage Backends" icon="hard-drive" href="/docs/storage/backends">
    Pluggable storage backends
  </Card>

  <Card title="Dakera Memory" icon="brain" href="/docs/features/dakera-memory">
    Self-hosted decay-weighted vector memory
  </Card>
</CardGroup>
