Skip to main content
Provides PostgreSQL database configuration for agent session history, chat storage, and memory persistence.

agno/db/postgres

Config

Supports two connection patterns: Option 1 — Connection URL: Option 2 — Separate fields: Common fields:

Outputs

Dependencies

Depends on: Nothing directly, but fields support FieldReferences (e.g., from gcp/cloudsql outputs). Depended on by:
  • agno/agent — in the db field
  • agno/team — in the db field
  • agno/memory/manager — in the db field
  • agno/knowledge — in the contents_db field

Example — Using Cloud SQL outputs

Example — Using connection URL

Notes

  • You must provide either connection_url or host + database. When using separate fields, username and password are also required.
  • Credentials in the URL take precedence — if the URL already contains credentials, the separate username/password fields are ignored.
  • The db_schema defaults to "ai". Agno creates tables within this schema automatically at runtime.
  • This resource is stateless — it does not create the database itself. Use gcp/cloudsql/database to provision the actual database.