Persistent, pod-restart-safe A2A task store for Google Agent ADK. Drop-in replacement for InMemoryTaskStore.
Project description
adk-task-persistence
Persistent, pod-restart-safe A2A task store for Google Agent ADK.
Drop-in replacement for ADK's InMemoryTaskStore. Native fit with ADK's A2A stack — fully compatible with RemoteA2aAgent and SSE streaming. Works in multi-pod EKS / Kubernetes deployments today.
pip install adk-task-persistence
The Problem
Google ADK's get_fast_api_app(a2a=True) always creates an in-process InMemoryTaskStore. There is no parameter to inject a persistent one. In any non-trivial deployment this causes:
- Pod-restart data loss — every in-flight task vanishes silently when a container restarts
- Cross-pod 404s — status polls routed to a different pod return "not found"
- No horizontal scaling without sticky sessions — defeats the purpose of stateless web pods
ADK has already solved the equivalent problem for session state via DatabaseSessionService. This library applies the same pattern to A2A task state.
The Solution
SqlAlchemyTaskStore implements ADK's real a2a.server.tasks.TaskStore ABC. Tasks are written to your database (Postgres / MySQL / SQLite) instead of in-process memory.
The HTTP/SSE protocol is unchanged. RemoteA2aAgent callers see exactly the same A2A streaming responses they always have. The only difference is where task state is written.
Quick Start
from sqlalchemy.ext.asyncio import create_async_engine
from adk_task_persistence import SqlAlchemyTaskStore, create_a2a_app
engine = create_async_engine("postgresql+asyncpg://user:pass@db/mydb")
task_store = SqlAlchemyTaskStore(engine)
# Build the ADK A2A stack with persistent task state:
app = create_a2a_app(
runner=runner,
agent_card=agent_card,
task_store=task_store,
)
After ADK PR #4970 merges, pass it directly to get_fast_api_app:
from google.adk.cli.fast_api import get_fast_api_app
app = get_fast_api_app(
agents_dir="./agents",
a2a=True,
a2a_task_store=SqlAlchemyTaskStore(engine), # ← same class, one parameter
)
SqlAlchemyTaskStore is interface-compatible with the upstream PRs.
Optional: Celery for Agent-Run Survival
If your agents run for minutes and you need execution to survive an HTTP pod crash mid-run, use the optional Celery extension.
pip install "adk-task-persistence[celery]"
from adk_task_persistence.celery import AdkAgentRunner, registry
registry.register(
"my_agent",
agent_factory=lambda: AdkAgentRunner(my_runner),
session_service_factory=lambda: None,
task_store_factory=lambda: SqlAlchemyTaskStore(engine),
)
celery -A adk_task_persistence.celery worker --loglevel=info
License
Apache 2.0
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 adk_task_persistence-0.1.0.tar.gz.
File metadata
- Download URL: adk_task_persistence-0.1.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4152d59103ee906582a26a6f737a04e21faa90b77015001b78da38a23af44338
|
|
| MD5 |
78638ce9f2d715625791b30f992be5d0
|
|
| BLAKE2b-256 |
90974afb1f86d007b7905538949f520c22dd258b6c65fe816eec05355c860460
|
Provenance
The following attestation bundles were made for adk_task_persistence-0.1.0.tar.gz:
Publisher:
publish.yml on STHITAPRAJNAS/adk-task-persistence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adk_task_persistence-0.1.0.tar.gz -
Subject digest:
4152d59103ee906582a26a6f737a04e21faa90b77015001b78da38a23af44338 - Sigstore transparency entry: 1431305962
- Sigstore integration time:
-
Permalink:
STHITAPRAJNAS/adk-task-persistence@db5ebb3485843e0ca01ba861b60dd9c9c44110d9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/STHITAPRAJNAS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db5ebb3485843e0ca01ba861b60dd9c9c44110d9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file adk_task_persistence-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adk_task_persistence-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.3 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 |
b34fafa9e52b4d5e3c583cd43eae45bc02e8adf025eeee33c488032781ec487f
|
|
| MD5 |
56dad04788470747b7e859186310c64a
|
|
| BLAKE2b-256 |
42ca58d9f9a63be086c94daabc5bc42c0ee74edf7e8c694a29e28184c1b14a6d
|
Provenance
The following attestation bundles were made for adk_task_persistence-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on STHITAPRAJNAS/adk-task-persistence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adk_task_persistence-0.1.0-py3-none-any.whl -
Subject digest:
b34fafa9e52b4d5e3c583cd43eae45bc02e8adf025eeee33c488032781ec487f - Sigstore transparency entry: 1431306184
- Sigstore integration time:
-
Permalink:
STHITAPRAJNAS/adk-task-persistence@db5ebb3485843e0ca01ba861b60dd9c9c44110d9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/STHITAPRAJNAS
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db5ebb3485843e0ca01ba861b60dd9c9c44110d9 -
Trigger Event:
push
-
Statement type: