google / google/adk-python-community

feat: add FirestoreSessionService for serverless session persistence

Đang mở
#103 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
182
Fork
75
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với các quy ước của session service và entry point đã được lên kế hoạch tại src/google/adk_community/sessions/firestore_session_service.py, sau đó so sánh các triển khai session hiện có. Chạy hoặc bổ sung coverage trong tests/unittests/sessions/test_firestore_session_service.py, đồng thời kiểm tra các export trong __init__.py và các dependency tùy chọn trong pyproject.toml. Công việc được xem là hoàn tất khi service dựa trên Firestore theo kế hoạch, các test, các export và cấu hình dependency đã hoàn chỉnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
google-cloud, python
Lĩnh vực
backend, databases
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.