-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Summary
Add a FirestoreSessionService — a BaseSessionService implementation backed by Google Cloud Firestore, providing persistent, serverless session storage with zero database management.
This was originally submitted as google/adk-python#4439, where maintainer @rohityan directed it to this community repo.
Motivation
The ADK currently has:
InMemorySessionService— dev-only, no persistenceDatabaseSessionService— requires SQL infrastructure (PostgreSQL, MySQL, SQLite)VertexAiSessionService— requires a Reasoning EngineRedisSessionService(community) — requires a Redis instance
For GCP-native deployments (Cloud Run, Cloud Functions), Firestore offers a fully managed, serverless alternative with no infrastructure to provision.
Design
- Events stored in Firestore subcollections (avoids 1MB document size limit)
- Three-tier state management (app/user/session) matching ADK conventions
- Atomic state updates via Firestore transactions (addresses race conditions)
- Batch writes for bulk event deletion
- Server-side query limits for
num_recent_events google-cloud-firestoreas an optional dependency- Async context manager support for clean client lifecycle
Implementation Plan
src/google/adk_community/sessions/firestore_session_service.pytests/unittests/sessions/test_firestore_session_service.py- Update
__init__.pyexports andpyproject.tomloptional dependencies
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels