Custom implementations of Google ADK services (Session, Artifact, Memory) with multiple storage backends
Project description
Google ADK Custom Services
Custom implementations of Google ADK services (Session, Artifact, Memory) with multiple storage backends.
Features
This package provides custom implementations for Google ADK services with various storage backends:
Session Services
- SQLSessionService: Store sessions in SQL databases (SQLite, PostgreSQL, MySQL, etc.)
- MongoSessionService: Store sessions in MongoDB
- RedisSessionService: Store sessions in Redis
- YamlFileSessionService: Store sessions in YAML files
Artifact Services
- SQLArtifactService: Store artifacts in SQL databases
- MongoArtifactService: Store artifacts in MongoDB
- LocalFolderArtifactService: Store artifacts in local file system
- S3ArtifactService: Store artifacts in AWS S3 or S3-compatible services
Memory Services
- SQLMemoryService: Store memories in SQL databases
- MongoMemoryService: Store memories in MongoDB
- RedisMemoryService: Store memories in Redis
- YamlFileMemoryService: Store memories in YAML files
Installation
pip install google-adk-extras
Usage
Session Services
from google_adk_extras.sessions import SQLSessionService
# Initialize SQL session service
session_service = SQLSessionService("sqlite:///sessions.db")
await session_service.initialize()
# Create a session
session = await session_service.create_session(
app_name="my_app",
user_id="user_123",
state={"theme": "dark"}
)
Artifact Services
from google_adk_extras.artifacts import LocalFolderArtifactService
from google.genai import types
# Initialize local folder artifact service
artifact_service = LocalFolderArtifactService("./artifacts")
await artifact_service.initialize()
# Save an artifact
text_blob = types.Blob(data=b"Hello, world!", mime_type="text/plain")
text_part = types.Part(inline_data=text_blob)
version = await artifact_service.save_artifact(
app_name="my_app",
user_id="user_123",
session_id="session_456",
filename="hello.txt",
artifact=text_part
)
Memory Services
from google_adk_extras.memory import RedisMemoryService
from google.adk.sessions.session import Session
from google.adk.events.event import Event
# Initialize Redis memory service
memory_service = RedisMemoryService(host="localhost", port=6379)
await memory_service.initialize()
# Add a session to memory
session = Session(id="session_1", app_name="my_app", user_id="user_123", events=[])
await memory_service.add_session_to_memory(session)
# Search memory
response = await memory_service.search_memory(
app_name="my_app",
user_id="user_123",
query="important information"
)
Examples
See the examples directory for complete working examples of each service.
Requirements
- Python 3.10+
- Google ADK
- Storage backend dependencies (installed automatically):
- SQLAlchemy for SQL services
- PyMongo for MongoDB services
- redis-py for Redis services
- PyYAML for YAML file services
- boto3 for S3 services
Development
Setup
# Clone the repository
git clone https://github.com/DeadMeme5441/google-adk-extras.git
cd google-adk-extras
# Install with uv (recommended)
uv sync
# Or install with pip
pip install -e .
Running Tests
# Run all tests
uv run pytest tests/
# Run specific test suite
uv run pytest tests/unit/
uv run pytest tests/integration/
uv run pytest tests/e2e/
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
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_extras-0.1.1.tar.gz.
File metadata
- Download URL: google_adk_extras-0.1.1.tar.gz
- Upload date:
- Size: 36.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e2fee686128f5c8353e4de9c40482dbe3f8ae785eea24a9d70f7a25ab06d0e9
|
|
| MD5 |
af689a535a3445b8e659dd340f86263e
|
|
| BLAKE2b-256 |
aec5a9f31b434c76df43f0618fddb554805cb44480e348a7ee2f0a8e409e12dc
|
File details
Details for the file google_adk_extras-0.1.1-py3-none-any.whl.
File metadata
- Download URL: google_adk_extras-0.1.1-py3-none-any.whl
- Upload date:
- Size: 38.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
200fc85a9ea82d8e41f16b772b10418e15e4346f62b5c234bcb6aa3fad3c65e0
|
|
| MD5 |
69ec80931e27ab0294edcde124686751
|
|
| BLAKE2b-256 |
f23b92fb8e3962fdddc41ab0186a2f3b8c434fac1b30111450e4ca2569a2f03c
|