-
Notifications
You must be signed in to change notification settings - Fork 17
Add OpenMemory service integration for ADK community #20
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
Conversation
- Implement OpenMemoryService with required API key authentication - Add comprehensive error handling and logging - Include metadata tags for app-level filtering - Add sample agent with auto-save callback for testing - Update default port to 8080 to match OpenMemory standard - Add unit tests for service functionality
Summary of ChangesHello @rakshith-git, 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 integrates OpenMemory as a new memory service within ADK Community, offering a self-hostable and open-source alternative to existing cloud-dependent memory solutions. The primary goal is to provide users with greater control over their data, enable on-premise deployments, and offer a cost-effective option for managing AI agent memories. The implementation leverages direct HTTP calls for flexibility and includes features for multi-user isolation and configurable memory behavior, ensuring a seamless and secure experience for various deployment scenarios. Highlights
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 valuable integration with OpenMemory as a self-hosted memory service for ADK. The implementation is well-structured, including a core service, a Pydantic configuration model, a sample agent, and comprehensive unit tests. The use of httpx for direct API calls is a sound decision, and the error handling appears robust.
My review focuses on improving consistency in configuration, ensuring code examples are clear, and adhering to best practices by avoiding reliance on private attributes. I've also noted a potentially unrelated import that could be cleaned up. Overall, this is a solid contribution that expands the capabilities of ADK Community.
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>
|
Hi team 👋, |
|
Thanks for the contribution! @rakshith-git Could you share what manual testing(queries and scenarios) you have done? For example, update the memory and retrieve it etc. |
I performed various manual tests to make sure it got the memories and the memories were in the right chronological order These are the manual tests i performed: Basic write and recall:
Then in a new session
Update / overwrite:
Missing memory behavior:
notethis implementation is exactly like the vertex ai memory bank in which explicit update of memories is not yet supported but unlike vertex ai memory bank users can have control over how long memories are retained and also can adjust preference for newer memories by configuring openmemory and also can build tools to update using the REST API's provided by openmemory |
…emory/__init__.py
| - Memory tools (`load_memory_tool`, `preload_memory_tool`) for retrieving past conversations | ||
| - Auto-save callback that saves sessions to memory after each agent turn | ||
| - Time context for the agent to use current time in responses | ||
|
|
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.
could you provide one sample query or script to show case how this agent works with memory?
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.
addressed.
|
|
||
| """Community memory services for ADK.""" | ||
|
|
||
| from .open_memory_service import OpenMemoryService |
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.
let's do lazy loading here. @wuliang229 to help provide some guidance on what's the proper way.
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.
let's do it in a separate PR.
|
Thanks for your contribution! |
|
Thanks a lot @hangfei I really appreciate the help! 🙏 |

Add OpenMemory Service Integration
This PR adds support for OpenMemory, a self-hosted, open-source memory system for AI agents, as a new memory service in ADK Community. OpenMemory provides brain-inspired multi-sector embeddings, graceful memory decay, and server-side filtering for efficient multi-user agent deployments.
Summary
This PR includes:
OpenMemoryServiceimplementingBaseMemoryServiceinterfaceProblem
ADK currently supports Vertex AI-based memory services, but users need self-hostable, open-source alternatives for:
Solution
OpenMemory fills this gap by providing a production-ready, self-hosted memory backend that integrates seamlessly with ADK's
BaseMemoryServiceinterface. This implementation uses directhttpxcalls for maximum control and reliability.Changes
Core Implementation
New file:
src/google/adk_community/memory/open_memory_service.pyOpenMemoryService: ImplementsBaseMemoryServiceinterfaceOpenMemoryServiceConfig: Pydantic config model for user-configurable behaviorhttpxintegration (no SDK dependency)user_idfor multi-tenant isolationNew file:
src/google/adk_community/memory/utils.pyNew file:
src/google/adk_community/memory/__init__.pySample Agent
samples/open_memory/agent.py: Sample agent with memory tools and auto-save callbackREADME.md: Setup instructions for OpenMemory backend and ADK integrationTests
tests/unittests/memory/test_open_memory_service.py: Comprehensive unit tests with mocked HTTP clientDependencies
httpx>=0.27.0, <1.0.0as a core dependency inpyproject.tomlKey Features
search_top_k: Number of memories to retrieve (default: 10)timeout: Request timeout in seconds (default: 30.0)user_content_salience: Importance score for user messages (default: 0.8)model_content_salience: Importance score for model responses (default: 0.7)default_salience: Fallback salience value (default: 0.6)enable_metadata_tags: Toggle session/app tagging (default: true)Technical Decisions
Direct HTTP Integration with httpx
This implementation uses
httpxfor direct REST API calls rather than a client SDK. This provides:Enriched Content Format
Since OpenMemory's query endpoint returns lightweight results, we embed author/timestamp directly in content during storage:
On retrieval, regex parsing extracts this metadata and returns clean content to users. This design:
Server-Side Filtering
user_idis passed as a top-level parameter (not metadata) to leverage OpenMemory's indexed database column for fast, secure multi-user isolation.API Key Authentication
API key is required for all OpenMemory operations, ensuring secure communication with the backend. The service validates that an API key is provided at initialization.
Testing
Unit Tests
All unit tests use mocked
httpx.AsyncClientto avoid external dependencies. Tests cover:All tests pass:
Installation & Usage
Install dependencies:
Setup OpenMemory Backend:
Follow the OpenMemory Quick Start Guide to set up your OpenMemory server.
Configure ADK Agent:
See
samples/open_memory/README.mdfor complete setup instructions and examples.Checklist