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_states—app:anduser:prefixed state keys, shared across sessions and merged intosession.stateon read.temp:keys are never persisted.
Pass table_prefix= to change the adk_ prefix.
Limits
- The stale-session check in
append_eventis 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 subclassesBaseSessionService, 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8b192a9ac5137d44638c9a1a86bec34b97dbe40678f7c7c454e52d9db76605b
|
|
| MD5 |
24c5746f5f25b00d2a1c32b1013f97a4
|
|
| BLAKE2b-256 |
a7f76620e9df2beb47ffd0d2906205e70d9aebc6e06da3ae0c06eadf8991472c
|
Provenance
The following attestation bundles were made for google_adk_persql-0.1.0.tar.gz:
Publisher:
python-release-adk.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_adk_persql-0.1.0.tar.gz -
Subject digest:
f8b192a9ac5137d44638c9a1a86bec34b97dbe40678f7c7c454e52d9db76605b - Sigstore transparency entry: 1806531191
- Sigstore integration time:
-
Permalink:
persql/persql@2224964164159f280e81ba65880d1981b7e77164 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/persql
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release-adk.yml@2224964164159f280e81ba65880d1981b7e77164 -
Trigger Event:
push
-
Statement type:
File details
Details for the file google_adk_persql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: google_adk_persql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d421034d6f4fd30d3ff33377874642d59d1879d288a58cd89a4e0a916a96888c
|
|
| MD5 |
1b71581f9ef8ed51b8302dbec28c9b37
|
|
| BLAKE2b-256 |
9b638769389a9316e813c2530aff8f0aab86e47459bf5aa77a75657fd3a33467
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_adk_persql-0.1.0-py3-none-any.whl -
Subject digest:
d421034d6f4fd30d3ff33377874642d59d1879d288a58cd89a4e0a916a96888c - Sigstore transparency entry: 1806531219
- Sigstore integration time:
-
Permalink:
persql/persql@2224964164159f280e81ba65880d1981b7e77164 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/persql
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release-adk.yml@2224964164159f280e81ba65880d1981b7e77164 -
Trigger Event:
push
-
Statement type: