Skip to main content

GoodMem for Google ADK

Give your ADK agent memory across conversations. GoodMem stores and indexes messages and documents; the agent retrieves relevant passages when it needs them.

Choose tools when the agent should decide what to remember, or the plugin when you want automatic conversation capture and context retrieval.

Install

pip install goodmem-adk

You need a GoodMem server, an API key, and an existing embedder. Set GOODMEM_BASE_URL and GOODMEM_API_KEY; optionally select an embedder with GOODMEM_EMBEDDER_ID (required when creating a new space and more than one embedder is available). Your agent can use any ADK-supported model.

After a second embedder is added to the server, existing spaces selected by ID or name keep working, but a new user's default space fails to initialize until GOODMEM_EMBEDDER_ID or embedder_id is set; even a first fetch can hit this.

Give your agent memory tools

This example uses Cohere through ADK's LiteLLM adapter. Install litellm>=1.84 and set COHERE_API_KEY separately from your GoodMem credentials.

from google.adk.agents import LlmAgent
from google.adk.apps import App
from google.adk.models.lite_llm import LiteLlm
from goodmem_adk import GoodmemFetchTool, GoodmemSaveTool

root_agent = LlmAgent(
    name="assistant",
    model=LiteLlm(model="cohere_chat/command-a-03-2025"),
    instruction=(
        "Save facts when asked to remember them. Before answering questions "
        "about saved facts, call goodmem_fetch, even in a fresh conversation. "
        "Check tool results and report errors honestly."
    ),
    tools=[GoodmemSaveTool(), GoodmemFetchTool()],
)
app = App(name="memory_agent", root_agent=root_agent)

Save this as memory_agent/agent.py, then run adk run memory_agent. Ask it to remember a fact, start a fresh session with the same user ID, and ask for that fact. Complete examples include both integration paths.

Automatic memory

Instead of adding memory tools, attach the plugin to your app:

from google.adk.agents import LlmAgent
from google.adk.apps import App
from google.adk.models.lite_llm import LiteLlm
from goodmem_adk import GoodmemPlugin

root_agent = LlmAgent(
    name="assistant",
    model=LiteLlm(model="cohere_chat/command-a-03-2025"),
    instruction="Answer using relevant memory context.",
)
app = App(
    name="memory_agent",
    root_agent=root_agent,
    plugins=[GoodmemPlugin()],
)

The plugin saves visible user and model messages, uploads inline attachments, and supplies relevant context before model calls.

Scopes and results

Defaults are adk_tool_{user_id} for tools and adk_chat_{user_id} for the plugin. Set the same space_id or space_name on both to share memory. Explicit scopes are shared by everyone using that configuration; defaults separate users, not applications. Explicit arguments override the environment scope settings GOODMEM_SPACE_ID, GOODMEM_SPACE_NAME and GOODMEM_EMBEDDER_ID. space_id, embedder_id, GOODMEM_SPACE_ID and GOODMEM_EMBEDDER_ID must be GoodMem UUIDs; anything else is refused before a request is sent, because a space ID becomes part of a request URL where ../embedders/<id> would reach another resource.

The model sees two tools: goodmem_save with a content argument and goodmem_fetch with query and an optional top_k. Every write records app_name, user_id, session_id, role (user or model) and source (adk_tool or adk_plugin) as memory metadata, returned with fetched chunks.

Writes return accepted IDs and processing states. Indexing happens asynchronously; empty searches are never retried automatically. Failed attachments are reported alongside accepted writes. Automatic persistence failures raise an error containing those IDs. Fetch results preserve distinct chunks, source metadata, statuses, and a partial flag when retrieval may be incomplete.

For connection pooling or custom TLS, pass a caller-owned AsyncGoodmem as client=. Otherwise each operation creates and closes its own asynchronous SDK.

See the 0.2 migration notes and validation guide.

Metadata

Release files for goodmem-adk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for goodmem-adk 0.2.1
File Size Uploaded Provenance Actions
goodmem_adk-0.2.1.tar.gz 46.5 kB Without provenance Details for goodmem_adk-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for goodmem-adk 0.2.1
File Interpreter ABI Platform Actions
goodmem_adk-0.2.1-py3-none-any.whl Python 3 none any Details for goodmem_adk-0.2.1-py3-none-any.whl

Total release size: 68.1 kB

Release files / goodmem_adk-0.2.1.tar.gz

Download URL goodmem_adk-0.2.1.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e196768349e20054ef7a3256571eea154909f018650f007c9ab3be0088a89f9e
BLAKE2b-256 checksum
How to use checksums
7a23f5c8fd3041c1907dc46a6298e9e7aa356a463c457ae74009cc8803d8b361
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / goodmem_adk-0.2.1-py3-none-any.whl

Download URL goodmem_adk-0.2.1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9218ff830668e5e937330590329e44fcff082de8124064d2aaa99ccbdf53c708
BLAKE2b-256 checksum
How to use checksums
0d4f3bca881ba13354218ae76d9751830cc1ce5a99ccaf2853ec1c2071365cc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for goodmem-adk 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page