Quick Start
How It Works
| Feature | Description |
|---|---|
| JSONB columns | Rich metadata queries on session data |
| Serverless retry | Auto SSL and retry for Neon, CockroachDB, Xata |
| Schema support | Isolate tables with a PostgreSQL schema |
Init-Failure Handling
PostgreSQL initialization distinguishes transient outages from fatal misconfiguration so a typo never hides behind a cooldown window.- Transient (memoized for the cooldown, retried after):
ConnectionError,TimeoutError,OSError, and DBAPI operational errors matched by class name across the MRO (for examplepsycopg2.OperationalError,psycopg.errors.OperationalError) — no optional-dependency import needed. - Fatal (raised immediately on every call):
PermissionError, credential/typo/misconfiguration errors,ValueError/TypeErrorfrom bad config. KeyboardInterrupt/SystemExit/ otherBaseExceptions bypass the handler entirely and never poison the memoized state.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
url | str | None | Full connection URL (overrides individual options) |
host | str | "localhost" | Database host |
port | int | 5432 | Database port |
database | str | "praisonai" | Database name |
user | str | "postgres" | Database user |
password | str | "" | Database password |
schema | str | "public" | PostgreSQL schema |
table_prefix | str | "praison_" | Prefix for table names |
auto_create_tables | bool | True | Create tables automatically |
pool_size | int | 5 | Connection pool size |
max_retries | int | 3 | Retries on connection errors (serverless cold-start) |
retry_delay | float | 0.5 | Base delay between retries in seconds |
URL formats
neon, cockroachdb, crdb, xata resolve to the postgres backend. For async, use create_conversation_store("async_postgres", ...).
Best Practices
Use db() for most agents
Use db() for most agents
Agent(db=db(database_url="postgresql://...")) is the simplest path — store wiring is automatic.Enable SSL in production
Enable SSL in production
Set
sslmode=require in the URL for encrypted connections.Use serverless aliases for Neon/Xata
Use serverless aliases for Neon/Xata
Point at Neon or Xata URLs — SSL and retry are applied automatically.
Resume sessions after restart
Resume sessions after restart
Reuse the same
session_id — conversation history loads on the next agent.start().Related
SQLite Persistence
Local file database for development
Database Persistence
Compare all persistence backends

