Phidata supports using PostgreSQL as a storage backend for Assistants using the PgAssistantStorage class.

Usage

storage.py
from phi.storage.assistant.postgres import PgAssistantStorage

# Create a storage backend using the Postgres database
storage = PgAssistantStorage(
    # store runs in the ai.assistant_runs table
    table_name="assistant_runs",
    # db_url: Postgres database URL
    db_url=db_url,
)

# Add storage to the Assistant
assistant = Assistant(storage=storage)

Params

table_name
str

The name of the table to store assistant runs in.

schema
str
default: "ai"

The schema to store the table in.

db_url
str

The database URL to connect to.

db_engine
Engine

The database engine to use.