Skip to main content

Google ADK session service backed by PerSQL — durable sessions, events, and state in an isolated SQLite database per agent.

Project description

google-adk-persql

Google ADK session service backed by PerSQL — durable sessions, events, and state in an isolated SQLite database per agent, provisioned instantly.

pip install google-adk-persql

Usage

import os
from google.adk.runners import Runner
from persql import PerSQL
from google_adk_persql import PerSQLSessionService

client = PerSQL(token=os.environ["PERSQL_TOKEN"])
service = PerSQLSessionService(client.database("acme/agent-state"))

runner = Runner(agent=agent, app_name="my-app", session_service=service)

Or let the service own the client:

with PerSQLSessionService.from_token(os.environ["PERSQL_TOKEN"], "acme/agent-state") as service:
    ...

AsyncPerSQL databases are awaited natively; sync databases run via asyncio.to_thread.

What it stores

The same four-table layout and state-scope semantics as ADK's built-in SqliteSessionService:

  • adk_sessions — one row per session, with session-scoped state.
  • adk_events — one row per event, stored as opaque JSON so ADK event fields can evolve without schema migrations.
  • adk_app_states / adk_user_statesapp: and user: prefixed state keys, shared across sessions and merged into session.state on read. temp: keys are never persisted.

Pass table_prefix= to change the adk_ prefix.

Limits

  • The stale-session check in append_event is read-then-write over HTTP, not a single database transaction — two writers racing the same session can both pass it. Keep one writer per session.
  • Event payloads are JSON; binary artifacts should go through ADK's artifact service, not session state.
  • Requires google-adk >= 2.2, < 3 — the package subclasses BaseSessionService, so an ADK major version can change the contract.

Local mode for tests

from persql import PerSQL
service = PerSQLSessionService(PerSQL(local=":memory:").database("test/db"))

Runs against in-process SQLite — no network, no token.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_adk_persql-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_adk_persql-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file google_adk_persql-0.1.0.tar.gz.

File metadata

  • Download URL: google_adk_persql-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for google_adk_persql-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8b192a9ac5137d44638c9a1a86bec34b97dbe40678f7c7c454e52d9db76605b
MD5 24c5746f5f25b00d2a1c32b1013f97a4
BLAKE2b-256 a7f76620e9df2beb47ffd0d2906205e70d9aebc6e06da3ae0c06eadf8991472c

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_adk_persql-0.1.0.tar.gz:

Publisher: python-release-adk.yml on persql/persql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file google_adk_persql-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_adk_persql-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d421034d6f4fd30d3ff33377874642d59d1879d288a58cd89a4e0a916a96888c
MD5 1b71581f9ef8ed51b8302dbec28c9b37
BLAKE2b-256 9b638769389a9316e813c2530aff8f0aab86e47459bf5aa77a75657fd3a33467

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_adk_persql-0.1.0-py3-none-any.whl:

Publisher: python-release-adk.yml on persql/persql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page