Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fc64013
feat(adk): align memory service with clean-break contract
cofin May 23, 2026
5b51e1b
feat(adk): centralize identifier validation
cofin May 23, 2026
8155772
chore: ignore PLW0717 ruff rule
cofin May 23, 2026
54dc208
feat(adk): align event payload column name
cofin May 23, 2026
f90cd1e
feat(adk): unify session memory store contracts
cofin May 23, 2026
5f0f8a8
feat(adk): add shared store contract tests
cofin May 23, 2026
02152dd
feat(adk): define nested config model
cofin May 23, 2026
ee54548
feat(adk): add version planning model
cofin May 23, 2026
a9ed4dd
feat(adk): define lifecycle controls
cofin May 23, 2026
ba5e5ff
feat(adk): define capability overrides
cofin May 23, 2026
c5284fb
feat(adk): add base store ttl helpers
cofin May 23, 2026
970da47
feat(adk): add store cleanup hooks
cofin May 23, 2026
fadb8e7
feat(adk): renew sessions on read
cofin May 23, 2026
884d5c7
feat(adk): add table lifecycle controls
cofin May 23, 2026
9c81050
feat(adk): validate scoped state tables
cofin May 23, 2026
c49b7cb
feat: implement ADK scoped state tables
cofin May 24, 2026
73b7dc4
feat(adk): atomic scoped-state writes in single transaction
cofin May 24, 2026
198f0ab
test(adk): add clean-break grep guards + document recreate_tables cut…
cofin May 24, 2026
de3ed0a
feat(adk): add BigQuery analytics-replica store
cofin May 24, 2026
87bcd9f
feat(adk): embedding preset registry + Chapter 16 documentation
cofin May 24, 2026
6a02515
refactor(adk): streamline argument formatting in resolve_embedding_co…
cofin May 24, 2026
685f307
test(adk): cross-adapter scoped-state contract matrix
cofin May 24, 2026
24eab1a
test(adk): session-scope per-adapter ADK contract fixtures
cofin May 24, 2026
da350f4
test(adk): recreate_tables at end of table_lifecycle contract helper
cofin May 24, 2026
276317e
refactor(adk): align remaining adapters and tests with ADK 2.0 contract
cofin May 25, 2026
a259d3f
Refactor ADK tests and configurations for clarity and consistency
cofin May 26, 2026
cd1c9b9
refactor(adk): streamline code formatting for consistency and readabi…
cofin May 26, 2026
ae43112
refactor(adk): update parameter types in append_event_and_update_stat…
cofin May 26, 2026
3017d21
fix: address adk scoped state review
cofin May 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ tools/scripts/profiles/*.prof
.beads-credential-key
.codex
.mypy_worker*
.antigravitycli
9 changes: 6 additions & 3 deletions docs/examples/extensions/adk/backend_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ def test_adk_backend_config() -> None:
from sqlspec.adapters.adbc import AdbcConfig

adk_config = {
"session_table": "adk_sessions",
"events_table": "adk_events",
"memory_table": "adk_memory_entries",
"session_table": "adk_session",
"events_table": "adk_event",
"app_state_table": "adk_app_state",
"user_state_table": "adk_user_state",
"metadata_table": "adk_metadata",
"memory_table": "adk_memory",
"memory_use_fts": True,
}

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/extensions/adk/memory_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def _run() -> list[dict[str, object]]:
"invocation_id": "inv_1",
"author": "user",
"timestamp": datetime.now(timezone.utc),
"event_json": {
"event_data": {
"id": "evt_1",
"invocation_id": "inv_1",
"author": "user",
Expand Down
18 changes: 0 additions & 18 deletions docs/extensions/adk/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ Services
:show-inheritance:
:no-index:

.. autoclass:: sqlspec.extensions.adk.memory.SQLSpecSyncMemoryService
:members:
:undoc-members:
:show-inheritance:
:no-index:

.. autoclass:: SQLSpecArtifactService
:members:
:undoc-members:
Expand All @@ -40,12 +34,6 @@ Session Stores
:show-inheritance:
:no-index:

.. autoclass:: BaseSyncADKStore
:members:
:undoc-members:
:show-inheritance:
:no-index:

Memory Stores
=============

Expand All @@ -55,12 +43,6 @@ Memory Stores
:show-inheritance:
:no-index:

.. autoclass:: BaseSyncADKMemoryStore
:members:
:undoc-members:
:show-inheritance:
:no-index:

Artifact Stores
===============

Expand Down
51 changes: 40 additions & 11 deletions docs/extensions/adk/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ The table below classifies every backend by its ADK support level.
- Full
- Full
- Google Cloud Spanner (cloud-managed).
* - bigquery
- Analytics-replica
- Full (sync-wrapped)
- n/a
- BigQuery is seconds-latency. Use as the analytics-replica path only; pair
with an OLTP-grade ADK adapter for live sessions.

Status Definitions
------------------
Expand All @@ -120,19 +126,39 @@ Current scoped-state boundary
buckets across sessions. This is a shared store-contract boundary, not a
SQLite-specific limitation.

**Analytics-replica**
Implemented as a write-mostly mirror for downstream analytics, replay, and
audit. Not suitable for synchronous agent inner loops. Use alongside an
OLTP-grade ADK adapter (Spanner, PostgreSQL family) for live state.

**Removed**
Previously available but no longer supported. See the removal notice for
migration guidance.

Removed Backends
----------------
BigQuery (Analytics-Replica)
----------------------------

The BigQuery ADK store is positioned as the **analytics-replica** path. BigQuery
query jobs are seconds-latency and BigQuery DML is not transactional across
separate jobs, so do not use this store for synchronous agent inner loops. Use
it for analytics, replay, and audit workloads, paired with an OLTP-grade ADK
adapter (Spanner, PostgreSQL family) for live state.

Schema layout:

- ``adk_session`` — ``PARTITION BY DATE(create_time)``, ``CLUSTER BY app_name, user_id, id``
- ``adk_event`` — ``PARTITION BY DATE(timestamp)``, ``CLUSTER BY session_id``
- ``adk_app_state`` — ``CLUSTER BY app_name``
- ``adk_user_state`` — ``CLUSTER BY app_name, user_id``

Configuration knobs (``extension_config["adk"]["bigquery"]``):

- ``session_lookup_window_days`` — bounds ``list_sessions`` scans (default 30)
- ``require_partition_filter`` — adds ``OPTIONS(require_partition_filter = TRUE)``
on partitioned tables (default ``True``)

**BigQuery** was removed from the ADK backend surface. BigQuery's batch-oriented
architecture is incompatible with the low-latency, transactional write patterns
that ADK session and event storage require. If you were using BigQuery for ADK
storage, migrate to Spanner for a Google-managed operational backend, or to a
transactional OLTP backend such as PostgreSQL, MySQL, Oracle, SQLite, or
CockroachDB.
``ADKConfig.retention.event_ttl_seconds`` is converted to
``partition_expiration_days`` on the events table when set.

Artifact Storage
----------------
Expand Down Expand Up @@ -298,9 +324,12 @@ All backends are configured through ``extension_config["adk"]``:
connection_config={"dsn": "postgresql://localhost/mydb"},
extension_config={
"adk": {
"session_table": "adk_sessions",
"events_table": "adk_events",
"memory_table": "adk_memory_entries",
"session_table": "adk_session",
"events_table": "adk_event",
"app_state_table": "adk_app_state",
"user_state_table": "adk_user_state",
"metadata_table": "adk_metadata",
"memory_table": "adk_memory",
"memory_use_fts": True,
"owner_id_column": "tenant_id INTEGER NOT NULL",
}
Expand Down
14 changes: 14 additions & 0 deletions docs/extensions/adk/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ Choose a guide

Table layouts, EventRecord, scoped state, and artifact metadata.

.. grid-item-card:: Scoped State
:link: scoped_state
:link-type: doc

App, user, session, and runtime-only state behavior.

.. grid-item-card:: API Reference
:link: api
:link-type: doc
Expand All @@ -70,6 +76,12 @@ Choose a guide

Apply schema changes safely over time.

.. grid-item-card:: Optimizations
:link: optimizations
:link-type: doc

Latency-oriented variation catalog and memory embedding presets.

.. toctree::
:hidden:

Expand All @@ -78,5 +90,7 @@ Choose a guide
backends
adapters
schema
scoped_state
api
migrations
optimizations
36 changes: 30 additions & 6 deletions docs/extensions/adk/migrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ used by your ADK backend, then run them with the SQLSpec migration CLI.
Schema Bootstrapping
====================

You can programmatically create ADK session/event and memory tables with
You can programmatically create ADK session/event/scoped-state/metadata and
memory tables with
``create_tables()`` / ``ensure_tables()``:

.. code-block:: python
Expand Down Expand Up @@ -48,20 +49,43 @@ through your deployment workflow.
by extension name. Use ``migration_config={"enabled": False}`` to disable
migrations entirely for a given database config.

Programmatic Cutover with ``recreate_tables()``
================================================

The base store exposes ``await store.recreate_tables()``, which drops every
ADK-managed table in FK-safe order and recreates them from the current DDL.
This is the supported in-place cutover for deployments that own the database
end-to-end and can tolerate a full ADK schema reset:

.. code-block:: python

await store.recreate_tables()

``recreate_tables()`` does not touch the SQLSpec migrations runner state, so
the next ``sqlspec upgrade`` run still sees the unchanged migration history.
Use ``await store.drop_tables()`` if you need to remove the schema without
rebuilding it.

Clean-Break Migration Notes
============================

If you are upgrading from a pre-clean-break version of the ADK extension,
note the following schema changes:

- **Events table**: The column layout changed to full-event JSON storage.
The ``event_json`` column now stores the entire ADK Event as a JSON blob.
The ``event_data`` column now stores the entire ADK Event as a JSON blob.
Individual event columns (``content``, ``actions``, ``branch``, etc.) have
been replaced by indexed scalar columns (``invocation_id``, ``author``,
``timestamp``) plus ``event_json``.
- **Artifact table**: New table (``adk_artifact_versions``) for artifact
``timestamp``) plus ``event_data``.
- **Scoped state tables**: New ``adk_app_state`` and ``adk_user_state`` tables
store ``app:`` and ``user:`` scoped keys. Raw ``adk_session.state`` rows now
contain only session-scoped keys; ``SQLSpecSessionService.get_session()``
returns the merged ADK view.
- **Internal metadata table**: New ``adk_metadata`` table seeded with
``schema_version = 1``.
- **Artifact table**: New table (``adk_artifact``) for artifact
metadata. Create this table when enabling the artifact service.
- **BigQuery**: Removed. Migrate to Spanner, PostgreSQL, or any other
supported backend.
- **BigQuery**: Treated as an analytics-replica backend. Use Spanner or a
PostgreSQL-family adapter for latency-sensitive live session state.

See :doc:`/usage/migrations` for the full workflow and commands.
Loading
Loading