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
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

citadeldb_google_adk-2.0.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

citadeldb_google_adk-2.0.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

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

Hashes for citadeldb_google_adk-2.0.0.tar.gz
Algorithm Hash digest
SHA256 0ed5230c1f7fb4dfff0b37642285772982156b2bcae126220170552a97b46af5
MD5 297c5837589f6a0270732618288e86ec
BLAKE2b-256 593ff5996576448fca9298559dae1f51efbc785c8e0be99a34de05b533073880

See more details on using hashes here.

Provenance

The following attestation bundles were made for citadeldb_google_adk-2.0.0.tar.gz:

Publisher: release-google-adk.yml on yp3y5akh0v/citadel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file citadeldb_google_adk-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for citadeldb_google_adk-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d7a535330d5ebdcc7d67de4121dc2f1ec8baeb085759584cf2b271df159321b
MD5 4fe0bc962ea09d720793f05a0eb5147f
BLAKE2b-256 1a871a32f3e0aa0dc2ee786e9a7f1d69951a52ddf4bc5d73071ee7454ff96e3c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

Supported by

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