Skip to main content

citadeldb-google-adk

A Google ADK BaseMemoryService backed by Citadel. Encrypted at rest, embedded in your process, and deletes that destroy the key, not just the row.

pip install citadeldb-google-adk
import citadeldb
from google.adk.runners import Runner
from citadeldb_google_adk import CitadelMemoryService

memory = CitadelMemoryService(
    "adk_memory.cdl",
    key="your-passphrase",
    embedder=citadeldb.MockEmbedder(dim=64),  # see Notes for a real model
)

runner = Runner(
    app_name="my_app",
    agent=agent,  # your root agent
    session_service=session_service,  # your session service
    memory_service=memory,
)

Search is ranked recall, not word matching

ADK hands the service a query string, so Citadel embeds it and runs hybrid recall: vector distance, keyword rank and recency, fused into one score. The reference InMemoryMemoryService returns only turns sharing a word with the query; nothing here is dropped for lacking one. With MockEmbedder that ranking is still lexical:

await memory.add_session_to_memory(session)  # a Session your Runner already ran

await memory.search_memory(
    app_name="my_app", user_id="alice", query="why did the release break?"
)
# SearchMemoryResponse(memories=[MemoryEntry(...disk was full...)])

Deletes destroy the key

Every event is sealed under its own key. Erasing destroys those keys, so the bytes on disk stay unreadable. A backup taken before the delete carries its own copy of the wrapped key and is out of scope.

memory.forget_user("my_app", "alice")  # returns the number erased
memory.forget_session("my_app", "alice", "s-42")

ADK's own memory services expose no erasure method.

Direct writes are supported

add_memory writes memories without going through a session. The reference InMemoryMemoryService raises NotImplementedError for it.

from google.adk.memory.memory_entry import MemoryEntry
from google.genai import types

entry = MemoryEntry(content=types.Content(parts=[types.Part(text="prefers dark mode")]))
await memory.add_memory(app_name="my_app", user_id="alice", memories=[entry])

add_events_to_memory likewise persists the events you pass rather than a whole session. An event with an existing id replaces that event; anonymous events are always appended.

Notes

add_session_to_memory sets the session's events, as InMemoryMemoryService does: re-adding never duplicates rows, and an event dropped from the session is dropped from memory. add_events_to_memory is additive across ids, replacing an existing id rather than duplicating it.

Citadel is embedded and one process owns the file. A path already open on this thread, under the same passphrase, is shared, so this can sit on the same database as another Citadel adapter; construct them on the same thread.

embedder= is required. There is no default: quietly substituting MockEmbedder would change ranking semantics and persist different provenance. MockEmbedder needs no download and is enough to run an agent and to test, so pass it explicitly if that is what you want. For semantic recall pass a real embedder. CandleEmbedder is not in the default citadeldb wheel and needs a source build (maturin build --features candle-embed); any object exposing dim, metric, model_id, embed and embed_queries works too:

import citadeldb

memory = CitadelMemoryService(
    "adk_memory.cdl",
    key="your-passphrase",
    embedder=citadeldb.CandleEmbedder("/path/to/e5-large", preset="e5-large"),
)

License

Apache-2.0

Release files for citadeldb-google-adk 2.1.0

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

Source distribution (sdist)

Source distribution for citadeldb-google-adk 2.1.0
File Size Uploaded
citadeldb_google_adk-2.1.0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for citadeldb-google-adk 2.1.0
File Interpreter ABI Platform
citadeldb_google_adk-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / citadeldb_google_adk-2.1.0.tar.gz

Download URL citadeldb_google_adk-2.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f0fec1adcca6c266a0a83a8182c292d667b6302c77a93a9344a3e615131870c6
BLAKE2b-256 checksum
How to use checksums
fed09c59bb6d73f6d8feab5f541b2f973a251c0aa33832a6e0df676e15a46f43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / citadeldb_google_adk-2.1.0-py3-none-any.whl

Download URL citadeldb_google_adk-2.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
460932567c16c65e07b99b025b0ead96576fbd1cbcefefa3a9d6729a1cdaa174
BLAKE2b-256 checksum
How to use checksums
0575012f8d157eb842729a4d96db4f95e117cfcf88552a1b57a5df0419e06e89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release history Release notifications | RSS feed

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

This release

2.1.0 This release

2 release files

2.0.0

2 release files

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