Skip to main content
The postgresql backend stores sessions in a PostgreSQL database. Multiple agent instances can connect to the same database for shared, distributed persistence.

When to use

  • Production, multi-instance, or distributed deployments;
  • Teams already using PostgreSQL as shared storage.

Usage

Provide connection details via config.yaml (or the matching environment variables) — never hard-code the password.
To forward SQLAlchemy driver args such as connection pooling, use db_kwargs:
You can also inject a PostgreSqlConfig directly through backend_configs to override the environment variables:

Parameters

ShortTermMemory constructor parameters (postgresql)

PostgreSqlConfig fields and environment variables

The PostgreSqlConfig config class uses the env prefix DATABASE_POSTGRESQL_.
config.yaml

Isolate session tables with a schema

Multiple applications can share one PostgreSQL database while using a different DATABASE_POSTGRESQL_SCHEMA for each deployment. VeADK creates the schema when it does not exist and pins the connection’s search_path to it, preventing deployments from sharing the same session tables.
The schema name must start with a letter or underscore and contain only letters, digits, and underscores. The database user needs permission to create schemas and tables.
VeADK selects a PostgreSQL driver compatible with the installed Google ADK version and automatically encodes special characters in usernames and passwords. You can provision PostgreSQL on Volcengine.
Last modified on September 19, 2026