Skip to main content

saihm-adapters

One memory store your agents own — portable across every model and framework, sealed client-side, and provably erasable.

saihm-adapters gives a Python AI agent a single persistent memory backed by SAIHM: every cell is encrypted inside your process by a bundled Node sidecar — Python never holds a key — so the store is yours, not a vendor's. Point LangChain, LlamaIndex, a RAG retriever, CrewAI, and AutoGen at the same store and the memory travels with your user across frameworks and across model providers. Erase a memory and it is cryptographically shredded (GDPR Art. 17), not merely de-indexed.

  • Owned & sovereign — you hold the keys; the server stores ciphertext it cannot read.
  • Portable across models & frameworks — one source of truth behind every adapter below.
  • Provably erasable — deletion is cryptographic and irreversible, and observable in recall.
  • Drop-in — each adapter implements the framework's own memory/history/retriever/storage interface, so it slots into code you already have.

Install

The core client needs only mcp. Each framework adapter is an optional extra, imported lazily — install only what you use:

pip install saihm-adapters                 # core client (any Python app)
pip install "saihm-adapters[langchain]"    # + LangChain chat history
pip install "saihm-adapters[langgraph]"    # + LangGraph BaseStore
pip install "saihm-adapters[llamaindex]"   # + LlamaIndex memory
pip install "saihm-adapters[rag]"          # + LlamaIndex retriever for RAG
pip install "saihm-adapters[crewai]"       # + CrewAI storage backend
pip install "saihm-adapters[autogen]"      # + AutoGen memory
pip install "saihm-adapters[all]"          # every adapter

Node.js ≥ 20 must be on PATH. The wheel ships only the tiny sidecar sources (server.mjs / sandbox.mjs + a pinned lockfile); its Node dependencies are installed once into a per-user cache on first use (npm ci). Python performs no cryptography — the Node sidecar seals every cell. For air-gapped or CI installs, pre-provision the sidecar and set SAIHM_SIDECAR_DIR; SAIHM_SKIP_BOOTSTRAP=1 forbids any network install.

Quickstart

The core client works on its own — remember, recall, and erase, from any Python app:

from saihm_adapters import SaihmMemoryClient

client = SaihmMemoryClient()          # reads SAIHM_* env for your account
cid = client.remember("Ada prefers metric units.")
for cell in client.recall("units"):
    print(cell.content)
client.forget(cid)                    # cryptographic erase

Per-framework adapters

Each adapter accepts a shared client= so a whole app (or a whole crew) reads and writes one store:

# LangChain — a BaseChatMessageHistory
from saihm_adapters import SaihmChatMessageHistory
history = SaihmChatMessageHistory(client=client)

# LangGraph — a BaseStore for long-term, cross-thread memory
from saihm_adapters import SaihmStore
store = SaihmStore(client=client)

# RAG — a LlamaIndex BaseRetriever over a corpus you own
from saihm_adapters import SaihmRetriever
retriever = SaihmRetriever(client=client, similarity_top_k=3)

# CrewAI — a Storage backend for ExternalMemory
from saihm_adapters import SaihmStorageBackend
backend = SaihmStorageBackend(client=client)

# AutoGen — an autogen_core.memory.Memory
from saihm_adapters.autogen_memory import SaihmMemory as AutoGenMemory
memory = AutoGenMemory(client=client)

# LlamaIndex — a BaseMemory
from saihm_adapters.llamaindex_memory import SaihmMemory as LlamaIndexMemory
memory = LlamaIndexMemory.from_defaults(client=client)

Why SaihmMemory is imported from a submodule: AutoGen and LlamaIndex each define a class named SaihmMemory, and they are different classes. Importing from saihm_adapters.autogen_memory / saihm_adapters.llamaindex_memory keeps the two unambiguous. The other adapter classes have unique names and import straight from the top level.

How it works

Python drives a bundled Node MCP sidecar over stdio. Your plaintext is sealed (ML-KEM-768 + AES-256-GCM, signed with ML-DSA-65) inside that sidecar before anything leaves the process; the SAIHM service stores only ciphertext. Recall decrypts in-process. Because the store is keyed to you, the same memory is reachable from any framework and any model — and an erase removes the key material, so the data cannot be recovered.

Live demos

Runnable notebooks and end-to-end examples: https://citw2.github.io/saihm-demos/

License

Apache-2.0.

Release files for saihm-adapters 0.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 saihm-adapters 0.1.0
File Size Uploaded
saihm_adapters-0.1.0.tar.gz 61.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for saihm-adapters 0.1.0
File Interpreter ABI Platform
saihm_adapters-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 114.3 kB

Release files / saihm_adapters-0.1.0.tar.gz

Download URL saihm_adapters-0.1.0.tar.gz
Size 61.8 kB
Tags Source
SHA-256 checksum
How to use checksums
62da5e75f9ba5dcd585ebce69c464dd18338f2cfb89c9a00ceb952c5daadf82f
BLAKE2b-256 checksum
How to use checksums
561c705b729364b3ec3a0f8b08434fbe8e70a3d6fcfc68d8490731b71922780f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / saihm_adapters-0.1.0-py3-none-any.whl

Download URL saihm_adapters-0.1.0-py3-none-any.whl
Size 52.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d98bf914848b5fc9df08ff335a08b80a31f163b2fdec90fb7c029abbd91a8b25
BLAKE2b-256 checksum
How to use checksums
9d1141579c276b69f57bccb20a1fe6307e5c997c7d3853853e1acc08efd18dd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

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