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

# DB • AI Agent SDK

> Database adapter interface for PraisonAI Agents.

# db

<Badge color="blue">AI Agent</Badge>

Database adapter interface for PraisonAI Agents.

This module provides the protocol and types for database persistence.
Implementations are provided by the wrapper layer (praisonai.db).

Usage (simplest - recommended):
from praisonaiagents import Agent, db

agent = Agent(
name="Assistant",
db=db(database\_url="postgresql://localhost/mydb"),  # db(...) shortcut
session\_id="my-session"  # optional: defaults to per-hour ID
)
agent.chat("Hello!")  # auto-persists messages, runs, traces, tool calls

Alternative (explicit backend):
db=db.PraisonDB(database\_url="...")  # Auto-detect backend
db=db.PostgresDB(host="localhost")   # PostgreSQL
db=db.SQLiteDB(path="data.db")       # SQLite
db=db.RedisDB(host="localhost")      # Redis (state only)

## Import

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