google / google/adk-python-community

feat: add FirestoreSessionService for serverless session persistence

オープン
#103 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
182
フォーク
75
PR マージ指標
30日以内にマージされた PR はありません

説明

## 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](https://github.com/google/adk-python/pull/4439), where maintainer @rohityan directed it to this community repo.

## Motivation

The ADK currently has:
- `InMemorySessionService` — dev-only, no persistence
- `DatabaseSessionService` — requires SQL infrastructure (PostgreSQL, MySQL, SQLite)
- `VertexAiSessionService` — requires a Reasoning Engine
- `RedisSessionService` (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-firestore` as an optional dependency
- Async context manager support for clean client lifecycle

## Implementation Plan

1. `src/google/adk_community/sessions/firestore_session_service.py`
2. `tests/unittests/sessions/test_firestore_session_service.py`
3. Update `__init__.py` exports and `pyproject.toml` optional dependencies

Ref: [google/adk-python#3776](https://github.com/google/adk-python/issues/3776)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まずセッションサービスの規約と、src/google/adk_community/sessions/firestore_session_service.py にある予定のエントリポイントを確認し、その後、既存のセッション実装と比較します。tests/unittests/sessions/test_firestore_session_service.py でテストを実行するか、カバレッジを追加し、__init__.py のエクスポートと pyproject.toml のオプション依存関係を確認します。予定されている Firestore ベースのサービス、テスト、エクスポート、依存関係の設定が完了していれば、完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
google-cloud, python
領域
backend, databases
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。