-
Notifications
You must be signed in to change notification settings - Fork 29
Feat/46-redis-agent memory-server-for-dynamic-session-and-long-term-memory #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…egration Implement RedisAgentMemoryService class that integrates with the Redis Agent Memory Server for production-grade long-term memory capabilities. Features: - Two-tier memory architecture (working memory + long-term memory) - Configurable extraction strategies (discrete, summary, preferences) - Recency-boosted semantic search with configurable weights - Namespace and user filtering support - Lazy client initialization with proper error handling The service implements the ADK BaseMemoryService interface with: - add_session_to_memory(): Stores session events in working memory - search_memory(): Retrieves relevant memories with semantic search - close(): Properly closes the client connection
Add RedisAgentMemoryService and RedisAgentMemoryServiceConfig to the public exports of the google.adk_community.memory module.
Add agent-memory-client>=0.13.0 as an optional dependency under the redis-agent-memory extra. Install with: pip install 'google-adk-community[redis-agent-memory]'
Add comprehensive unit tests covering: - Configuration validation and defaults - Session to memory conversion - Memory search with recency boosting - Error handling for missing dependencies - Client lifecycle management All 14 tests pass with mocked MemoryAPIClient.
Add a complete sample demonstrating RedisAgentMemoryService usage: - main.py: FastAPI server with URI scheme registration - redis_agent_memory_agent/: Sample agent with memory tools - README.md: Setup and usage documentation The sample shows how to: - Register the redis-agent-memory:// URI scheme - Configure extraction strategies and recency boosting - Use memory tools (load_memory, preload_memory) with the agent
…ryService - Rename redis_agent_memory_service.py to redis_long_term_memory_service.py - Rename class to better reflect its purpose (long-term memory storage) - Update imports and exports in __init__.py - Rename test file accordingly - No functional changes
…s_long_term_memory_service.py
- Implement BaseSessionService using Redis Agent Memory Server - Support session CRUD operations via working memory API - Add auto-summarization and context window management - Add configuration options (namespace, model, extraction strategy) - Unit tests
…m memory - Use RedisWorkingMemorySessionService for session management - Use RedisLongTermMemoryService for persistent memory - Add README with setup instructions
…ent memory server
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @nkanu17, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the ADK framework by integrating Redis Agent Memory Server-based services. It provides robust, production-ready solutions for agent session management and long-term memory, moving beyond volatile in-memory options. Agents can now leverage persistent, auto-summarizing sessions and semantic search capabilities for long-term knowledge retention, supported by a flexible two-tier memory architecture. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant and valuable feature by adding Redis-based memory services for session and long-term memory. The implementation is robust, well-documented, and includes comprehensive sample code and unit tests. The code quality is high, with good use of modern Python features and error handling. I've provided a few minor suggestions to further improve robustness in the sample code, fix some typos in documentation, and enhance consistency in the new services.
src/google/adk_community/sessions/redis_working_memory_session_service.py
Outdated
Show resolved
Hide resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…p and test mock injection
Add Redis Agent Memory Services for Session and Long-Term Memory
This PR adds two Redis Agent Memory Server-based services as optional dependencies, enabling agents to use persistent session management with auto-summarization and long-term memory with semantic search. This provides a production-ready, self-hosted alternative to in-memory services.
Related to issue #46
Changes
New Services (
src/google/adk_community/)RedisWorkingMemorySessionServiceBaseSessionServiceRedisLongTermMemoryServiceBaseMemoryServiceDependencies (
pyproject.toml)Installation:
pip install "google-adk-community[redis-agent-memory]"Sample Agents
Added two samples in
contributing/samples/:redis_agent_memory/redis_agent_memory_wo_working_session/Architecture
High-Level Overview
Two-Tier Memory Stack
Data Flow
Architecture Options
This integration supports two deployment architectures depending on your needs:
Option 1: Two-Tier Architecture (Recommended)
Uses both
RedisWorkingMemorySessionServiceandRedisLongTermMemoryServicefor full memory capabilities.Option 2: Long-Term Memory Only
Uses ADK's
InMemorySessionServicewithRedisLongTermMemoryServicefor simpler deployments.Comparison
add_session_to_memory()Agent Memory Server Features
The following capabilities from the Redis Agent Memory Server are exposed through this integration:
Memory Extraction
The server automatically extracts structured memories from conversations using LLM-based analysis.
Extraction strategies (configurable via
extraction_strategy):discretesummarypreferencescustomAuto-Summarization
When the context window limit is exceeded, the Working Memory service automatically:
Semantic Search
Long-term memory uses vector embeddings for semantic similarity search:
Recency Boosting
Balance semantic relevance with temporal freshness:
recency_boostTruerecency_weight0.3recency_decay_rate0.01Deduplication
The server automatically detects and merges similar memories:
Multi-User Support (Namespaces)
Isolate memories by application and user:
Feature Summary
Related Issues
Testing
Unit Tests
All 23 tests pass with mocked
agent-memory-clientdependencies.Manual E2E Testing
Prerequisites:
Test conversation:
Session 1:
Session 2 (new session):
Additional Notes
agent-memory-clientis only imported when the services are instantiateddiscrete,summary,preferences, andcustomextractionRequirements
agent-memory-client)E2E Test Screenshot

