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
from google.adk.runners import Runner
from citadeldb_google_adk import CitadelMemoryService
memory = CitadelMemoryService("adk_memory.cdl", key="your-passphrase")
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 the default 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.
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 the additive one, skipping ids already stored.
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.
MockEmbedder is the default and needs no download, which is enough to run an agent and to
test. 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file citadeldb_google_adk-2.0.0.tar.gz.
File metadata
- Download URL: citadeldb_google_adk-2.0.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ed5230c1f7fb4dfff0b37642285772982156b2bcae126220170552a97b46af5
|
|
| MD5 |
297c5837589f6a0270732618288e86ec
|
|
| BLAKE2b-256 |
593ff5996576448fca9298559dae1f51efbc785c8e0be99a34de05b533073880
|
Provenance
The following attestation bundles were made for citadeldb_google_adk-2.0.0.tar.gz:
Publisher:
release-google-adk.yml on yp3y5akh0v/citadel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
citadeldb_google_adk-2.0.0.tar.gz -
Subject digest:
0ed5230c1f7fb4dfff0b37642285772982156b2bcae126220170552a97b46af5 - Sigstore transparency entry: 2517280708
- Sigstore integration time:
-
Permalink:
yp3y5akh0v/citadel@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/yp3y5akh0v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-google-adk.yml@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file citadeldb_google_adk-2.0.0-py3-none-any.whl.
File metadata
- Download URL: citadeldb_google_adk-2.0.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d7a535330d5ebdcc7d67de4121dc2f1ec8baeb085759584cf2b271df159321b
|
|
| MD5 |
4fe0bc962ea09d720793f05a0eb5147f
|
|
| BLAKE2b-256 |
1a871a32f3e0aa0dc2ee786e9a7f1d69951a52ddf4bc5d73071ee7454ff96e3c
|
Provenance
The following attestation bundles were made for citadeldb_google_adk-2.0.0-py3-none-any.whl:
Publisher:
release-google-adk.yml on yp3y5akh0v/citadel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
citadeldb_google_adk-2.0.0-py3-none-any.whl -
Subject digest:
5d7a535330d5ebdcc7d67de4121dc2f1ec8baeb085759584cf2b271df159321b - Sigstore transparency entry: 2517280751
- Sigstore integration time:
-
Permalink:
yp3y5akh0v/citadel@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/yp3y5akh0v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-google-adk.yml@f616907085e6f66daed0d67f020bc729cb49d2c4 -
Trigger Event:
workflow_dispatch
-
Statement type: