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

# Database Setup

> Configure database backends for persistence

# Database Setup

Configure different database backends for agent persistence.

## SQLite (Default)

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Session

session = Session(
    session_id="my-session",
    persistence="sqlite",
    db_path="./data/sessions.db"
)
```

## PostgreSQL

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install psycopg2-binary
```

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Session

session = Session(
    session_id="my-session",
    persistence="postgresql",
    connection_string="postgresql://user:pass@localhost:5432/praisonai"
)
```

Or via environment variable:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export DATABASE_URL="postgresql://user:pass@localhost:5432/praisonai"
```

## Redis

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install redis
```

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Session

session = Session(
    session_id="my-session",
    persistence="redis",
    redis_url="redis://localhost:6379/0"
)
```

## MongoDB

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install pymongo
```

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Session

session = Session(
    session_id="my-session",
    persistence="mongodb",
    mongodb_url="mongodb://localhost:27017/praisonai"
)
```

## Related

* [Persistence Overview](/docs/guides/persistence/overview) - Concepts
* [Databases](/docs/databases) - Full database documentation
