Skip to main content

Goodmem plugin for Google ADK — persistent memory for AI agents

Project description

Goodmem ADK Plugin

Persistent memory plugin for Google ADK agents, powered by Goodmem.ai.

There are two main integration points for Goodmem ADK:

Approach Class Description Coverage
Plugin GoodmemPlugin Implicit but deterministic memory reads and writes at every agent–user turn, triggered by callbacks predefined in ADK. Saves all conversation turns, including file attachments. Retrieves memory at every turn.
Tools GoodmemSaveTool, GoodmemFetchTool Explicit but non-deterministic memory reads and writes, decided by the agent. Saves information that the agent decides is important to remember. Retrieves memory when the agent decides it needs to recall.

See examples/README.md for detailed usage of each integration point with runnable demo agents.

Quick Start

Installation

For stable release, install from PyPI.

pip install goodmem-adk

For local development, install in editable mode. Run the command below in the root of the repository.

pip install -e .

Set Environment Variables

export GOODMEM_BASE_URL="http://localhost:8080"
export GOODMEM_API_KEY="goodmem-api-key"
export GOOGLE_API_KEY="your-google-api-key"

Note that GOODMEM_BASE_URL shall not have the /v1 suffix.

Optional Environment Variables:

export GOODMEM_EMBEDDER_ID="your-embedder-id"
export GOODMEM_SPACE_ID="your-space-id"
export GOODMEM_SPACE_NAME="your-space-name"

Which space is used?

Condition Behavior
GOODMEM_SPACE_ID set Must exist — ValueError if not found
GOODMEM_SPACE_NAME set Looked up by name; auto-created if missing
Both set GOODMEM_SPACE_ID must exist and its name must match GOODMEM_SPACE_NAME
Neither set Auto-created as adk_chat_{user_id} (plugin) or adk_tool_{user_id} (tools)

Which embedder is used when creating a space?

Condition Behavior
GOODMEM_EMBEDDER_ID set Must exist — ValueError if not found
Not set, embedders exist in Goodmem instance First available embedder is used
Not set, no embedders in Goodmem instance gemini-embedding-001 auto-created via GOOGLE_API_KEY

Examples

We provide the following examples:

  • See examples/README.md for demos that can be immediately run with the command adk web ..
  • See tests/test_integration.py for integration tests that invoke agents and process agent responses which use the plugin and tools.

Using the plugin

import os
from google.adk.agents import LlmAgent
from google.adk.apps import App
from goodmem_adk import GoodmemPlugin

plugin = GoodmemPlugin(
    base_url=os.getenv("GOODMEM_BASE_URL"),
    api_key=os.getenv("GOODMEM_API_KEY"),
)

agent = LlmAgent(
    name="memory_agent",
    model="gemini-2.5-flash",
    instruction="You are a helpful assistant with persistent memory.",
)

app = App(name="GoodmemPluginDemo", root_agent=agent, plugins=[plugin])

Using the tools

import os
from google.adk.agents import LlmAgent
from google.adk.apps import App
from goodmem_adk import GoodmemSaveTool, GoodmemFetchTool


save_tool = GoodmemSaveTool(
    base_url=os.getenv("GOODMEM_BASE_URL"),
    api_key=os.getenv("GOODMEM_API_KEY"),
)
fetch_tool = GoodmemFetchTool(
    base_url=os.getenv("GOODMEM_BASE_URL"),
    api_key=os.getenv("GOODMEM_API_KEY"),
)

agent = LlmAgent(
    name="memory_agent",
    model="gemini-2.5-flash",
    instruction="You are a helpful assistant with persistent memory.",
    tools=[save_tool, fetch_tool],
)

app = App(name="GoodmemToolsDemo", root_agent=agent)

Testing

Unit tests (no server required):

pytest tests/test_client.py tests/test_plugin.py tests/test_tools.py -v

Integration tests (require a live Goodmem server and Gemini API key):

GOODMEM_BASE_URL=http://localhost:8080 \
GOODMEM_API_KEY=<key> \
GOOGLE_API_KEY=<key> \
pytest -m integration -v -s

We perform two integration tests:

Local Development

To use a local checkout instead of the PyPI release, install in editable mode. Run the command below in the root of the repository.

pip install -e .

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goodmem_adk-0.1.1.tar.gz (60.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goodmem_adk-0.1.1-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file goodmem_adk-0.1.1.tar.gz.

File metadata

  • Download URL: goodmem_adk-0.1.1.tar.gz
  • Upload date:
  • Size: 60.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for goodmem_adk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3b32c1e389f28617707b1709d7fe39b685ff3042a3e5c7145f401740df898fd7
MD5 f1ffa22a8484bde55c6f9754102d381d
BLAKE2b-256 ac7639bd0d8f3fb2c3becb2cf2f243515278dbbc1dedcfb121287c63b61c9df9

See more details on using hashes here.

File details

Details for the file goodmem_adk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: goodmem_adk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for goodmem_adk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed06227abeab878dcb8245e13267659ae82392a7503c2169bbbe335b16da5ca7
MD5 76084234053485b5866abae2d89e8b6c
BLAKE2b-256 c7be503d366e792d01a84c44790419a8a853f3dac0d71383fa496a15e9ba84d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page