Google ADK#
SQLSpec provides session, event, memory, and artifact service contracts. These contracts support the Google Agent Development Kit.
Session Service#
- class sqlspec.extensions.adk.SQLSpecSessionService[source]#
Bases:
BaseSessionServiceSQLSpec-backed implementation of BaseSessionService.
Provides session and event storage using SQLSpec database adapters. Delegates all database operations to a store implementation.
- Parameters:
store¶ (
BaseAsyncADKStore|BaseSyncADKStore) -- Database store implementation.
- __init__(store)[source]#
Initialize the session service.
- Parameters:
store¶ (
BaseAsyncADKStore|BaseSyncADKStore) -- Database store implementation.
- property store: BaseAsyncADKStore | BaseSyncADKStore#
Return the database store.
- async create_session(*, app_name, user_id, state=None, session_id=None)[source]#
Create a new session.
- Parameters:
- Return type:
Session- Returns:
The newly created session.
- async get_user_state(*, app_name, user_id)[source]#
Get user-scoped state for an app and user.
ADK's service API returns unprefixed user state keys, while SQLSpec stores the durable state using ADK's documented
user:prefix.
- async list_sessions(*, app_name, user_id=None, order_by='update_time', descending=True, limit=None, offset=None)[source]#
List sessions for an app, optionally filtered by user.
Ordering and bounded pagination are a SQLSpec extension to Google ADK's narrower base signature; the response model itself is unchanged and carries neither a total count nor a cursor token.
- Parameters:
user_id¶ (
str|None) -- ID of the user. If None, all sessions for the app are listed.order_by¶ (
Literal['create_time','update_time']) -- Timestamp column to sort on. Onlycreate_timeandupdate_timeare accepted.descending¶ (
bool) -- Sort direction applied to the timestamp column and theidtie-break that keeps pages deterministic.limit¶ (
int|None) -- Maximum number of sessions to return.0returns an empty response without reaching the store.offset¶ (
int|None) -- Number of leading rows to skip. Requires a finite limit when positive.
- Return type:
ListSessionsResponse- Returns:
Response containing list of sessions (without events).
- async delete_session(*, app_name, user_id, session_id)[source]#
Delete a session and all its events.
- async append_event(session, event)[source]#
Append an event to a session.
Persists the event record and the post-append durable state atomically via
store.append_event_and_update_state(), then updates the in-memory session only after persistence succeeds.Implements stale-session detection: if the session has been modified in storage since it was last loaded, a
ValueErroris raised instead of silently overwriting.temp:keys are stripped from the persisted state snapshot so they never survive a reload.- Parameters:
- Return type:
Event- Returns:
The appended event.
- Raises:
ValueError -- If the session has been modified in storage since it was loaded (stale session).
Memory Services#
- class sqlspec.extensions.adk.SQLSpecMemoryService[source]#
Bases:
BaseMemoryServiceSQLSpec-backed implementation of BaseMemoryService.
Provides memory entry storage using SQLSpec database adapters. Delegates all database operations to a store implementation.
- ADK BaseMemoryService defines two core methods:
add_session_to_memory(session) - Ingests session into memory (returns void)
search_memory(app_name, user_id, query) - Searches stored memories
- Parameters:
store¶ (
BaseAsyncADKMemoryStore|BaseSyncADKMemoryStore) -- Database store implementation.
- __init__(store)[source]#
Initialize the memory service.
- Parameters:
store¶ (
BaseAsyncADKMemoryStore|BaseSyncADKMemoryStore) -- Database store implementation.
- property store: BaseAsyncADKMemoryStore | BaseSyncADKMemoryStore#
Return the database store.
- async add_session_to_memory(session, scope='user')[source]#
Add a completed session to the memory store.
Extracts all events with content from the session and stores them as searchable memory entries. Uses UPSERT to skip duplicates.
The Session object contains app_name and user_id properties. Events are converted to memory records and bulk inserted via store. Returns void per ADK BaseMemoryService contract.
- async add_events_to_memory(*, app_name, user_id, events, session_id=None, custom_metadata=None, scope='user')[source]#
Add an explicit list of events to the memory service.
Same Event-to-StoredMemory extraction logic as
add_session_to_memory, but operates on a sequence of Events directly (no Session wrapper needed).
- async add_memory(*, app_name, user_id, memories, custom_metadata=None, scope='user')[source]#
Add explicit memory items directly to the memory service.
Each entry's
contentis serialized tocontent_json, text is extracted fromcontent.partsforcontent_text, andcustom_metadatamerges the entry-levelentry.custom_metadatawith the call-levelcustom_metadataparameter.
- async search_memory(*, app_name, user_id, query, scope_filter='all', embedding=None)[source]#
Search memory entries by text query, optionally fused with vector similarity.
Uses the store's configured search strategy. Supplying an embedding lets stores that support vector indexes combine similarity with text rank; omitting it performs the text-only search.
- class sqlspec.extensions.adk.SQLSpecSyncMemoryService[source]#
Bases:
objectSynchronous SQLSpec-backed memory service.
Provides memory entry storage using SQLSpec sync database adapters. This is a sync-compatible version for use with sync drivers like SQLite.
Note: This does NOT inherit from BaseMemoryService since ADK's base class requires async methods. Use this for sync-only deployments.
- Parameters:
store¶ (
BaseSyncADKMemoryStore) -- Sync database store implementation.
- __init__(store)[source]#
Initialize the sync memory service.
- Parameters:
store¶ (
BaseSyncADKMemoryStore) -- Sync database store implementation.
- property store: BaseSyncADKMemoryStore#
Return the database store.
- add_session_to_memory(session, scope='user')[source]#
Add a completed session to the memory store.
Extracts all events with content from the session and stores them as searchable memory entries. Uses UPSERT to skip duplicates.
- search_memory(*, app_name, user_id, query, scope_filter='all', embedding=None)[source]#
Search memory entries by text query, optionally fused with vector similarity.
Artifact Service#
- class sqlspec.extensions.adk.SQLSpecArtifactService[source]#
Bases:
BaseArtifactServiceSQLSpec-backed implementation of BaseArtifactService.
Composes SQL metadata storage with
sqlspec/storage/content backends to provide versioned artifact management for Google ADK.Metadata (version number, filename, MIME type, custom metadata, canonical URI) is stored in a SQL table managed by the artifact store. Content bytes are stored in object storage (S3, GCS, Azure, local filesystem) via the storage registry.
- Parameters:
store¶ (
BaseAsyncADKArtifactStore) -- Artifact metadata store implementation.artifact_storage_uri¶ (
str) -- Base URI for content storage. Can also be a registered alias in the storage registry.registry¶ (
StorageRegistry|None) -- Storage registry to use. Defaults to the global singleton.
- property store: BaseAsyncADKArtifactStore#
Return the artifact metadata store.
- async save_artifact(*, app_name, user_id, filename, artifact, session_id=None, custom_metadata=None)[source]#
Save an artifact, returning the new version number.
Writes content to object storage first, then inserts the metadata row. If content write succeeds but metadata insert fails, the orphaned content blob is logged but not automatically cleaned up (eventual consistency is acceptable; orphan sweep can be added later).
- Parameters:
- Return type:
- Returns:
The version number (0-based, incrementing).
- async load_artifact(*, app_name, user_id, filename, session_id=None, version=None)[source]#
Load an artifact by reading metadata then fetching content.
- Parameters:
- Return type:
Part|None- Returns:
Deserialized Part, or None if not found.
- async list_artifact_keys(*, app_name, user_id, session_id=None)[source]#
List distinct artifact filenames.
When
session_idis provided, returns both session-scoped and user-scoped filenames. When None, returns only user-scoped filenames.
- async delete_artifact(*, app_name, user_id, filename, session_id=None)[source]#
Delete an artifact and all its versions.
Deletes metadata rows first (fail-fast), then removes content objects from storage (best-effort).
- async delete_artifacts_older_than(before, app_name=None)[source]#
Delete artifact versions created before a cutoff.
Metadata rows are deleted first (fail-fast). Content objects for the deleted versions are then removed on a best-effort basis: a failed content delete is logged with its canonical URI and version, and the remaining versions are still processed. Because the metadata row is already gone, a later run of this method cannot rediscover that content, so the warning records are the input to an independent object-store orphan sweep.
- async list_versions(*, app_name, user_id, filename, session_id=None)[source]#
List all version numbers for an artifact.
- async list_artifact_versions(*, app_name, user_id, filename, session_id=None)[source]#
List all versions with full metadata for an artifact.
Store Base Classes#
- class sqlspec.extensions.adk.BaseAsyncADKStore[source]#
Bases:
_ADKStoreCommon[ConfigT],ABCBase class for async SQLSpec-backed ADK session stores.
Implements storage operations for Google ADK sessions and events using SQLSpec database adapters with async/await.
This abstract base class provides common functionality for all database-specific store implementations including: - Connection management via SQLSpec configs - Table name validation - Session and event CRUD operations
Subclasses must implement dialect-specific SQL queries and will be created in each adapter directory (e.g., sqlspec/adapters/asyncpg/adk/store.py).
- Parameters:
config¶ (
TypeVar(ConfigT, bound= DatabaseConfigProtocol[Any, Any, Any])) -- SQLSpec database configuration with extension_config["adk"] settings.
Notes
Configuration is read from config.extension_config["adk"]: - session_table: Sessions table name (default: "adk_session") - events_table: Events table name (default: "adk_event") - app_state_table: App-scoped state table name (default: "adk_app_state") - user_state_table: User-scoped state table name (default: "adk_user_state") - metadata_table: Internal metadata table name (default: "adk_internal_metadata") - owner_id_column: Optional owner FK column DDL (default: None)
- async create_tables()[source]#
Create the sessions and events tables if they don't exist.
- Return type:
- async prepare_schema_async(driver)[source]#
Prepare adapter-specific schema decisions with an asynchronous driver.
- Return type:
- async create_session(session_id, app_name, user_id, state, owner_id=None)[source]#
Create a new session.
- Parameters:
- Return type:
- Returns:
The created session record.
- abstractmethod async get_session(app_name, user_id, session_id, *, renew_for=None)[source]#
Get a session.
- Parameters:
- Return type:
- Returns:
Session record if found, None otherwise.
- abstractmethod async update_session_state(app_name, user_id, session_id, state)[source]#
Update session state.
- abstractmethod async list_sessions(app_name, user_id=None, *, order_by='update_time', descending=True, limit=None, offset=None)[source]#
List all sessions for an app, optionally filtered by user.
- Parameters:
user_id¶ (
str|None) -- ID of the user. If None, returns all sessions for the app.order_by¶ (
Literal['create_time','update_time']) -- Timestamp column to sort on.descending¶ (
bool) -- Sort direction applied to the timestamp column and theidtie-break.limit¶ (
int|None) -- Maximum number of sessions to return.0returns an empty list without database work.offset¶ (
int|None) -- Number of leading rows to skip. Requires a finite limit when positive.
- Return type:
- Returns:
List of session records.
- abstractmethod async delete_session(app_name, user_id, session_id)[source]#
Delete a session and its events.
- abstractmethod async append_event(event_record)[source]#
Append an event to a session.
- Parameters:
event_record¶ (
StoredEvent) -- Event record to insert.- Return type:
- abstractmethod async append_event_and_update_state(event_record, app_name, user_id, session_id, state, *, app_state=None, user_state=None)[source]#
Atomically append an event and update the session's durable state.
This is the authoritative durable write boundary for post-creation app-scoped snapshot to replace/upsert for
app_name. Whenuser_stateis provided, it is a full merged user-scoped snapshot to replace/upsert for(app_name, user_id).Nonemeans that scope was untouched by the event and must not be written.- Parameters:
event_record¶ (
StoredEvent) -- Event record to store.app_name¶ (
str) -- Application name for routing scoped-state upserts.user_id¶ (
str) -- User identifier for routing user-scoped upserts.session_id¶ (
str) -- Session identifier whose state should be updated.state¶ (
dict[str, typing.Any]) -- Post-append durable session-scoped state snapshot (temp:keys already stripped by the service layer).app_state¶ (
dict[str, typing.Any] |None) -- Full app-scoped state snapshot (app:*keys) to upsert atomically, orNonewhen untouched.user_state¶ (
dict[str, typing.Any] |None) -- Full user-scoped state snapshot (user:*keys) to upsert atomically, orNonewhen untouched.
- Return type:
- Returns:
The updated StoredSession reflecting the new state and update_time.
- Raises:
ValueError -- If the session row no longer exists at update time (raced with delete_session).
- abstractmethod async get_events(app_name, user_id, session_id, after_timestamp=None, limit=None)[source]#
Get events for a session.
- Parameters:
- Return type:
- Returns:
List of event records ordered by timestamp ascending.
- abstractmethod async delete_expired_events(before, app_name=None)[source]#
Delete events older than the given timestamp.
- abstractmethod async delete_idle_user_states(updated_before, app_name=None)[source]#
Delete user-scoped state rows whose update_time predates the given threshold.
- abstractmethod async delete_idle_sessions(updated_before, app_name=None)[source]#
Delete sessions whose update_time predates the given threshold.
- abstractmethod async get_user_state(app_name, user_id)[source]#
Return user-scoped state for an application user.
- abstractmethod async upsert_app_state(app_name, state)[source]#
Insert or replace app-scoped state for an application.
- abstractmethod async upsert_user_state(app_name, user_id, state)[source]#
Insert or replace user-scoped state for an application user.
- abstractmethod async get_metadata(key)[source]#
Return a value from the ADK internal metadata table.
- abstractmethod async set_metadata(key, value)[source]#
Set a value in the ADK internal metadata table.
- async reconcile_schema(*, assume_existing=False)[source]#
Apply additive ADK table changes from canonical adapter DDL.
- class sqlspec.extensions.adk.BaseSyncADKStore[source]#
Bases:
_ADKStoreCommon[ConfigT],ABCBase class for sync SQLSpec-backed ADK session stores.
Sync-backed adapters expose a real synchronous API for direct use in synchronous applications. Async bridging belongs in
SQLSpecSessionServicewhen Google ADK calls into a sync store from its async service surface.- Parameters:
config¶ (
TypeVar(ConfigT, bound= DatabaseConfigProtocol[Any, Any, Any])) -- SQLSpec database configuration with extension_config["adk"] settings.
- abstractmethod create_tables()[source]#
Create the sessions and events tables if they don't exist.
- Return type:
- prepare_schema_sync(driver)[source]#
Prepare adapter-specific schema decisions with a synchronous driver.
- Return type:
- abstractmethod create_session(session_id, app_name, user_id, state, owner_id=None)[source]#
Create a new session.
- Return type:
- abstractmethod get_session(app_name, user_id, session_id, *, renew_for=None)[source]#
Get a session.
- Return type:
- abstractmethod update_session_state(app_name, user_id, session_id, state)[source]#
Update session state.
- Return type:
- abstractmethod list_sessions(app_name, user_id=None, *, order_by='update_time', descending=True, limit=None, offset=None)[source]#
List all sessions for an app, optionally filtered by user.
- Parameters:
user_id¶ (
str|None) -- ID of the user. If None, returns all sessions for the app.order_by¶ (
Literal['create_time','update_time']) -- Timestamp column to sort on.descending¶ (
bool) -- Sort direction applied to the timestamp column and theidtie-break.limit¶ (
int|None) -- Maximum number of sessions to return.0returns an empty list without database work.offset¶ (
int|None) -- Number of leading rows to skip. Requires a finite limit when positive.
- Return type:
- Returns:
List of session records.
- abstractmethod delete_session(app_name, user_id, session_id)[source]#
Delete a session and its events.
- Return type:
- abstractmethod append_event_and_update_state(event_record, app_name, user_id, session_id, state, *, app_state=None, user_state=None)[source]#
Atomically append an event and update the session's durable state.
- Return type:
- abstractmethod get_events(app_name, user_id, session_id, after_timestamp=None, limit=None)[source]#
Get events for a session.
- Return type:
- abstractmethod delete_expired_events(before, app_name=None)[source]#
Delete events older than the given timestamp, optionally scoped to one application.
- Return type:
- abstractmethod delete_idle_user_states(updated_before, app_name=None)[source]#
Delete user-scoped state rows whose update_time predates the threshold, optionally scoped to one application.
- Return type:
- abstractmethod delete_idle_sessions(updated_before, app_name=None)[source]#
Delete sessions whose update_time predates the given threshold, optionally scoped to one application.
- Return type:
- abstractmethod get_user_state(app_name, user_id)[source]#
Return user-scoped state for an application user.
- abstractmethod upsert_app_state(app_name, state)[source]#
Insert or replace app-scoped state for an application.
- Return type:
- abstractmethod upsert_user_state(app_name, user_id, state)[source]#
Insert or replace user-scoped state for an application user.
- Return type:
- abstractmethod set_metadata(key, value)[source]#
Set a value in the ADK internal metadata table.
- Return type:
- reconcile_schema(*, assume_existing=False)[source]#
Apply additive ADK table changes from canonical adapter DDL.
Memory Store Base Classes#
- class sqlspec.extensions.adk.BaseAsyncADKMemoryStore[source]#
Bases:
_ADKMemoryStoreCommon[ConfigT],ABCBase class for async SQLSpec-backed ADK memory stores.
Implements storage operations for Google ADK memory entries using SQLSpec database adapters with async/await.
- abstractmethod async create_tables()[source]#
Create the memory table and indexes if they don't exist.
Should check self._enabled and skip table creation if False.
- Return type:
- async drop_tables()[source]#
Drop the memory table and indexes if they exist.
Should drop all dialect-specific objects (tables, indexes, FTS virtual tables, triggers).
- Return type:
- async reconcile_schema(*, assume_existing=False)[source]#
Apply additive ADK memory table changes from canonical adapter DDL.
- Return type:
- abstractmethod async insert_memory_entries(entries, owner_id=None)[source]#
Bulk insert memory entries with deduplication.
- abstractmethod async search_entries(query, app_name, user_id, limit=None, scope_filter='all', embedding=None)[source]#
Search memory entries by text query or vector embedding.
- Parameters:
- Return type:
- Returns:
List of matching memory records ordered by relevance/timestamp.
- abstractmethod async delete_entries_by_session(session_id)[source]#
Delete all memory entries for a specific session.
- class sqlspec.extensions.adk.BaseSyncADKMemoryStore[source]#
Bases:
_ADKMemoryStoreCommon[ConfigT],ABCBase class for sync SQLSpec-backed ADK memory stores.
- abstractmethod create_tables()[source]#
Create the memory table and indexes if they don't exist.
- Return type:
- reconcile_schema(*, assume_existing=False)[source]#
Apply additive ADK memory table changes from canonical adapter DDL.
- Return type:
- abstractmethod insert_memory_entries(entries, owner_id=None)[source]#
Bulk insert memory entries with deduplication.
- Return type:
- abstractmethod search_entries(query, app_name, user_id, limit=None, scope_filter='all', embedding=None)[source]#
Search memory entries by text query or vector embedding.
- Return type:
Artifact Store Base Classes#
- class sqlspec.extensions.adk.BaseAsyncADKArtifactStore[source]#
Bases:
_ADKArtifactStoreCommon[ConfigT],ABCBase class for async SQLSpec-backed ADK artifact metadata stores.
Manages artifact version metadata in a SQL table. Content bytes are stored externally via
sqlspec/storage/backends and referenced by canonical URI in each metadata row.Subclasses must implement dialect-specific SQL queries.
- Parameters:
config¶ (
TypeVar(ConfigT, bound= DatabaseConfigProtocol[Any, Any, Any])) -- SQLSpec database configuration with extension_config["adk"] settings.
- abstractmethod async insert_artifact(record)[source]#
Insert an artifact version metadata row.
- Parameters:
record¶ (
StoredArtifact) -- Artifact metadata record to insert.- Return type:
- abstractmethod async get_artifact(app_name, user_id, filename, session_id=None, version=None)[source]#
Get a specific artifact version's metadata.
When
versionis None, returns the latest version.- Parameters:
- Return type:
- Returns:
Artifact record if found, None otherwise.
- abstractmethod async list_artifact_keys(app_name, user_id, session_id=None)[source]#
List distinct artifact filenames.
When
session_idis provided, returns filenames from both session-scoped and user-scoped artifacts. When None, returns only user-scoped artifact filenames.
- abstractmethod async list_artifact_versions(app_name, user_id, filename, session_id=None)[source]#
List all version records for an artifact, ordered by version ascending.
- abstractmethod async delete_artifact(app_name, user_id, filename, session_id=None)[source]#
Delete all version records for an artifact and return them.
The caller uses the returned records to clean up content from object storage. Metadata is deleted first (fail-fast); content cleanup is best-effort.
- abstractmethod async get_next_version(app_name, user_id, filename, session_id=None)[source]#
Get the next version number for an artifact.
Returns 0 if no versions exist (first version), otherwise
max(version) + 1.
- abstractmethod async create_table()[source]#
Create the artifact versions table if it does not exist.
- Return type:
- async delete_artifacts_older_than(before, app_name=None)[source]#
Delete artifact version rows created before a cutoff and return them.
Implementations delete and return the affected version rows in a single atomic operation where the database supports it, ordered deterministically so cleanup logs stay reproducible. The caller uses the returned records to remove content from object storage.
- Parameters:
- Return type:
- Returns:
List of deleted artifact records (needed for content cleanup).
- Raises:
NotImplementedError -- If the store does not implement artifact retention.
- class sqlspec.extensions.adk.BaseSyncADKArtifactStore[source]#
Bases:
_ADKArtifactStoreCommon[ConfigT],ABCBase class for sync SQLSpec-backed ADK artifact metadata stores.
Synchronous counterpart of
BaseAsyncADKArtifactStore.- Parameters:
config¶ (
TypeVar(ConfigT, bound= DatabaseConfigProtocol[Any, Any, Any])) -- SQLSpec database configuration with extension_config["adk"] settings.
- abstractmethod insert_artifact(record)[source]#
Insert an artifact version metadata row.
- Parameters:
record¶ (
StoredArtifact) -- Artifact metadata record to insert.- Return type:
- abstractmethod get_artifact(app_name, user_id, filename, session_id=None, version=None)[source]#
Get a specific artifact version's metadata.
When
versionis None, returns the latest version.- Parameters:
- Return type:
- Returns:
Artifact record if found, None otherwise.
- abstractmethod list_artifact_keys(app_name, user_id, session_id=None)[source]#
List distinct artifact filenames.
- abstractmethod list_artifact_versions(app_name, user_id, filename, session_id=None)[source]#
List all version records for an artifact, ordered by version ascending.
- abstractmethod delete_artifact(app_name, user_id, filename, session_id=None)[source]#
Delete all version records for an artifact and return them.
- abstractmethod get_next_version(app_name, user_id, filename, session_id=None)[source]#
Get the next version number for an artifact.
- abstractmethod create_table()[source]#
Create the artifact versions table if it does not exist.
- Return type:
- delete_artifacts_older_than(before, app_name=None)[source]#
Delete artifact version rows created before a cutoff and return them.
Implementations delete and return the affected version rows in a single atomic operation where the database supports it, ordered deterministically so cleanup logs stay reproducible. The caller uses the returned records to remove content from object storage.
- Parameters:
- Return type:
- Returns:
List of deleted artifact records (needed for content cleanup).
- Raises:
NotImplementedError -- If the store does not implement artifact retention.
Record Types#
- class sqlspec.extensions.adk.StoredSession[source]#
Bases:
TypedDictDatabase record for a session.
Represents the schema for sessions stored in the database.
- class sqlspec.extensions.adk.StoredEvent[source]#
Bases:
TypedDictDatabase record for an event.
Stores the full ADK Event as a single JSON blob (
event_data) alongside indexed scalar columns used for scoped query filtering.This design eliminates column drift with upstream ADK: new Event fields are automatically captured in
event_datawithout schema changes.
- class sqlspec.extensions.adk.StoredMemory[source]#
Bases:
TypedDictDatabase record for a memory entry.
Represents the schema for memory entries stored in the database. Contains extracted content from ADK events for searchable long-term memory.
- class sqlspec.extensions.adk.StoredArtifact[source]#
Bases:
TypedDictDatabase record for an artifact version.
Represents the schema for artifact metadata stored in the database. Content is stored separately in object storage; this record tracks versioning, ownership, and the canonical URI pointing to the content.
The composite key is (app_name, user_id, session_id, filename, version), where session_id may be NULL for user-scoped artifacts.
Configuration#
- class sqlspec.extensions.adk.ADKConfig[source]#
Bases:
TypedDictConfiguration options for ADK session and memory store extension.
All fields are optional with sensible defaults. Use in extension_config["adk"]:
- Configuration supports three deployment scenarios:
SQLSpec manages everything (runtime + migrations)
SQLSpec runtime only (external migration tools like Alembic/Flyway)
Selective features (sessions OR memory, not both)
- migrations_path: NotRequired[str | Path]#
Directory containing this extension's migrations, or a
'<dotted.module>:<subdir>'specification.Overrides the default
sqlspec.extensions.<name>lookup. Setting this auto-includes the extension inmigration_config["include_extensions"].
- manage_schema: NotRequired[bool]#
True.
- Type:
Apply additive target-schema reconciliation. Default
- create_schema: NotRequired[bool]#
True.
- Type:
Create missing ADK tables during managed reconciliation. Default
- run_migrations: NotRequired[bool]#
False.
- Type:
Run packaged versioned migrations when an integration supplies a runner. Default
- enable_sessions: NotRequired[bool]#
True.
When False the session service is unavailable, session store operations are disabled, and packaged ADK migrations emit no session, event, state, or metadata DDL.
- Type:
Enable the session store at runtime and in packaged migrations. Default
- enable_memory: NotRequired[bool]#
True.
When False the memory service is unavailable, memory store operations are disabled, and packaged ADK migrations emit no memory table DDL or PostgreSQL vector extension statement.
- Type:
Enable the memory store at runtime and in packaged migrations. Default
- session_table: NotRequired[str]#
'adk_session'
- Type:
Name of the sessions table. Default
- events_table: NotRequired[str]#
'adk_event'
- Type:
Name of the events table. Default
- app_state_table: NotRequired[str]#
'adk_app_state'
- Type:
Name of the app-scoped state table. Default
- user_state_table: NotRequired[str]#
'adk_user_state'
- Type:
Name of the user-scoped state table. Default
- metadata_table: NotRequired[str]#
'adk_internal_metadata'
- Type:
Name of the internal metadata table. Default
- memory_table: NotRequired[str]#
'adk_memory'
- Type:
Name of the memory entries table. Default
- artifact_table: NotRequired[str]#
'adk_artifact'
- Type:
Name of the artifact metadata table. Default
- artifact_storage_uri: NotRequired[str]#
Base URI for artifact content storage.
Points to a
sqlspec/storage/backend where artifact binary content is stored. Can be a direct URI (s3://bucket/path,file:///path) or a registered alias in the storage registry.
- memory_use_fts: NotRequired[bool]#
False.
When True, adapters will use their native FTS capabilities where available: - PostgreSQL: to_tsvector/to_tsquery with GIN index - SQLite: FTS5 virtual table - DuckDB: FTS extension with match_bm25 - Oracle: CONTAINS() with CTXSYS.CONTEXT index - Spanner: TOKENIZE_FULLTEXT with search index - MySQL: MATCH...AGAINST with FULLTEXT index
When False, adapters use simple LIKE/ILIKE queries (works without indexes).
- Type:
Enable full-text search when supported. Default
- memory_max_results: NotRequired[int]#
Limits the number of memory entries returned by search_memory(). Can be overridden per-query via the limit parameter.
- Type:
Maximum number of results for memory search queries. Default
- owner_id_column: NotRequired[str]#
Optional owner ID column definition to link sessions/memories to a user, tenant, team, or other entity.
Format: "column_name TYPE [NOT NULL] REFERENCES table(column) [options...]"
The entire definition is passed through to DDL verbatim. We only parse the column name (first word) for use in INSERT/SELECT statements.
This column is added to both session and memory tables for consistent multi-tenant isolation.
- Supports:
Foreign key constraints: REFERENCES table(column)
Nullable or NOT NULL
CASCADE options: ON DELETE CASCADE, ON UPDATE CASCADE
Dialect-specific options (DEFERRABLE, ENABLE VALIDATE, etc.)
Plain columns without FK (just extra column storage)
- vector_index_type: NotRequired[Literal['hnsw', 'ivfflat', 'scann']]#
'hnsw'.
- Type:
Vector index algorithm for memory embeddings ('hnsw', 'ivfflat', 'scann'). Default
- vector_dimensions: NotRequired[int]#
- Type:
Dimensionality of embedding vectors (e.g. 768 for gemini-embedding-001 with MRL). Default
- enable_bm25: NotRequired[bool]#
False.
- Type:
Enable native pg_textsearch BM25 full-text indexing on AlloyDB / PostgreSQL 17+. Default
- scann_num_leaves: NotRequired[int]#
- Type:
Number of partition leaves (clusters) for ScaNN tree quantization. Default
- scann_quantizer: NotRequired[str]#
'SQ8'.
- Type:
Quantization method for ScaNN index ('SQ8', 'FP32'). Default