Membase for Google ADK
membase-google-adk gives a Google ADK agent your
Membase account as its long-term memory, in two ways that can be used
together:
| Piece | ADK type | What it does |
|---|---|---|
MembaseMemoryService |
BaseMemoryService |
What ADK's preload_memory and load_memory tools search. Recall is time-boxed and fails open. |
membase_tools() |
FunctionTools |
membase_search, membase_save and membase_profile for deliberate calls. |
Every passage names the Memory it came from, e.g. [Project decisions] We chose Postgres for the ledger., so the agent can cite it. There is no delete tool.
Install
pip install membase-google-adk
export MEMBASE_API_KEY="mbk_…" # Connect › Developer keys in the Membase app
A Read key can search and, with Profile ticked, read the profile. Saving needs a Read & write key whose writes have one place to go: a key that reaches a single Memory saves there.
Tools
from google.adk.agents import Agent
from membase_google_adk import membase_tools
root_agent = Agent(
name="assistant",
model="gemini-3.5-flash",
instruction="You are a helpful assistant with long-term memory.",
tools=membase_tools(), # MEMBASE_API_KEY from the environment
)
adk run path/to/your_agent
| Tool | What it does |
|---|---|
membase_search(query, limit?) |
Searches every Memory the key reaches; each passage is cited as [Memory name] …, and a Memory that could not answer is said so. |
membase_save(content) |
Saves a note in the user's words, only when the user asks. |
membase_profile() |
Reads the user's profile facts, newest first. Needs Profile access on the key. |
membase_tools(tools=("search", "profile")) leaves saving out, e.g. for a Read key.
Memory service
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.tools import preload_memory
from membase_google_adk import MembaseMemoryService
agent = Agent(name="assistant", model="gemini-3.5-flash", tools=[preload_memory])
runner = Runner(
app_name="my_app",
agent=agent,
session_service=InMemorySessionService(),
memory_service=MembaseMemoryService(),
)
preload_memory searches Membase with the user's message before each turn. That search gets
8 seconds by default (recall_timeout), because the first search after a quiet spell can take up
to a minute while the memory wakes. When it runs out, the turn goes on without memory and the
search keeps running, so the memory is awake for the next turn.
ADK can also write sessions to memory (add_session_to_memory, add_events_to_memory).
That is off by default: Membase saves what the user asked to keep, through membase_save.
MembaseMemoryService(capture=True) turns it on and keeps the user's own words only
(capture_roles=("user",)). add_session_to_memory saves the whole session each time, so call
it once when the session ends.
One key is one person
A Membase key belongs to one person's account. In a multi-user app, pass client_for: it
maps the user id ADK passes to that user's own client.
from membase import Membase
def client_for(user_id: str) -> Membase:
return Membase(api_key=keys.get(user_id)) # that user's key, stored by your app
memory_service = MembaseMemoryService(client_for=client_for)
tools = membase_tools(client_for=client_for)
Both also take a ready client, or api_key, base_url and local.
Local memory
pip install 'membase-google-adk[local]'
membase_tools(local="~/.membase")
MembaseMemoryService(local="~/.membase")
Requirements
Python 3.10+, google-adk and unibaseio-membase 0.4.0 or newer.
MIT licensed.
Metadata
Release files for membase-google-adk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| membase_google_adk-0.1.0.tar.gz | 12.3 kB | Without provenance | Details for membase_google_adk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| membase_google_adk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for membase_google_adk-0.1.0-py3-none-any.whl |
Total release size: 22.3 kB
Release files / membase_google_adk-0.1.0.tar.gz
| Download URL | membase_google_adk-0.1.0.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e9dd6966e140bd476cf353bdb6c645b009c051d9206f212e50fc0772cb80dfa
|
|
BLAKE2b-256 checksum How to use checksums |
554481947ea7dd71ad4e75f21e7a2a50495c4e07e4d4a053559745bbf1ea8c0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / membase_google_adk-0.1.0-py3-none-any.whl
| Download URL | membase_google_adk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d58044d3a0fb43edffa03899646b757d84c91c0a35613dc6ec3301081c30068
|
|
BLAKE2b-256 checksum How to use checksums |
dac02f9addd5430412d1414788eb646cee4c63e33aa3af4ee888f836f4e7cc6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Security for membase-google-adk 0.1.0
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.