Overview
AsyncPostgresStorage provides an asynchronous PostgreSQL-based storage backend using SQLAlchemy with asyncpg. Ideal for production deployments, multi-node systems, and applications requiring ACID compliance with async support.
Basic Usage
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
db_url | str | None | PostgreSQL connection URL (e.g., postgresql+asyncpg://user:pass@host/db) |
db_engine | AsyncEngine | None | Pre-configured SQLAlchemy AsyncEngine |
db_schema | str | "public" | PostgreSQL schema to use |
session_table | str | None | Custom name for the session table |
user_memory_table | str | None | Custom name for the user memory table |
create_schema | bool | True | Whether to create the schema if it doesn’t exist |
id | str | None | Unique identifier for this storage instance |
Connection pool is automatically configured with
pool_pre_ping=True and pool_recycle=3600 for robust connection handling.
