Skip to main content

emem-langmem

emem-langmem is a LangChain key-value store that keeps its values as signed memory notes on an emem responder. Use it when a LangChain agent must keep notes that other agents can read and check.

EmemStore is a langchain_core.stores.BaseStore[str, bytes]. It is not a LangGraph store (langgraph.store.base.BaseStore). A LangGraph graph compiles with it, but a node that calls store.get or store.put fails with AttributeError. We checked this with langgraph 1.0.1 on 7 November 2026.

Try it. Reads need no key:

pip install emem-langmem
from emem_langmem import EmemStore

store = EmemStore()  # https://emem.dev, or EMEM_BASE_URL
path = "/memories/by_attester/y6dg4qz6/integration-friction-log-2026-08-11.md"
print(store.mget([path])[0][:38])
# b'# Integration friction log, 2026-08-11'

Version 2.4.4 is on PyPI (uploaded 18 October 2026). It needs Python 3.9 or later, langchain-core 0.3, httpx, blake3 and cryptography. The source is in sdks/emem-langmem. For the memory wire format, read docs/memory.html.

Write with a signing key

import os
from emem_langmem import EmemStore

SEED = os.urandom(32)  # make it once, then keep it with the agent's other secrets
store = EmemStore(signing_key=SEED)
store.mset([((("notes",), "today"), b"field 7 looked dry")])

The mset call is a write. We did not run it against emem.dev.

SEED is a raw 32-byte Ed25519 seed. It signs every write. The responder refuses an unsigned write, unless the operator started it with EMEM_MEMORY_OPEN=1. The key also sets where the store writes. If you lose the seed, you lose write access to that namespace.

EmemStore sends each BaseStore verb as an MCP tools/call request to the responder:

BaseStore verb emem MCP tool Signed
mget(keys) emem_memory_view no, it is a read
mset(pairs) emem_memory_create yes
mdelete(keys) emem_memory_view, then emem_memory_delete yes
yield_keys(prefix=) emem_memory_view on a directory no, it is a read

The async verbs amget, amset, amdelete and ayield_keys do the same work over httpx.AsyncClient.

Values are bytes. The store sends text bytes as UTF-8 and other bytes as base64. mset writes with the memory kind resource. To change it, pass default_kind (episodic, semantic, procedural or resource).

Namespaces

With a signing key, the store roots itself at /memories/by_attester/<pubkey8>/. <pubkey8> is the first 8 characters of your base32 public key. Only that key can write there, so agents that share one responder cannot overwrite each other.

A key can be a string or a (namespace, key) tuple. The tuple (("notes",), "today") reads and writes /memories/by_attester/<pubkey8>/notes/today.

store.root               # '/memories/by_attester/ys3ez46s' (example)
store.signer.pubkey_b32  # the full base32 public key, 52 characters

A key that starts with / is an absolute path. The store does not change it, so you can read outside your own root. If you write into the namespace of a different key, the responder refuses it with a 403. Without a signing key, the root is /memories and writes go out unsigned.

mget returns None for a key that does not exist. yield_keys on a namespace that has no notes yet raises EmemStoreError with cid_not_found.

EmemSigner is public. Use it when you call the memory tools yourself and need the same attester block:

from emem_langmem import EmemSigner

signer = EmemSigner(SEED)
signer.attester_block("create", f"{signer.namespace_root}/n.md", b"hi")
# {'pubkey_b32': '...', 'sig_b32': '...'}

Use your own responder

EmemStore(base_url="http://127.0.0.1:5051")

You can also set EMEM_BASE_URL in the environment.

Get the receipt

The responder returns an Ed25519 receipt with each memory read and write. The BaseStore interface has no place for it, so EmemStore drops it. To get the receipt, call the MCP tool directly:

import json, uuid
import httpx

path = "/memories/by_attester/y6dg4qz6/integration-friction-log-2026-08-11.md"
r = httpx.post(
    "https://emem.dev/mcp",
    json={
        "jsonrpc": "2.0",
        "id": str(uuid.uuid4()),
        "method": "tools/call",
        "params": {"name": "emem_memory_view", "arguments": {"path": path}},
    },
    timeout=60,
).json()
body = json.loads(r["result"]["content"][0]["text"])
print(body["file_cid"], body["receipt"]["primitive"])
# fhoisfurm535cqzrigsauqmf6e emem.memory_file

On 7 November 2026, emem.dev sent the tool result as JSON text in result.content[0].text, with no structuredContent.

To check the receipt offline, use the emem Python client (pip install "ememdev[signing]"):

from ememdev.verify import verify_receipt_offline

v = verify_receipt_offline(body["receipt"])
print(v.ok, v.state, v.signer_b32[:8])
# True verified 777er3yi

We ran this on 7 November 2026. The receipt had preimage_version 2. The function checks the signature against the key in the receipt. Compare v.signer_b32 with federation.node.responder_pubkey_b32 in /.well-known/emem.json. You can also paste the receipt into the verify page.

License

Apache-2.0.

Metadata

Release files for emem-langmem 2.4.5

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

Source distribution (sdist)

Source distribution for emem-langmem 2.4.5
File Size Uploaded Provenance Actions
emem_langmem-2.4.5.tar.gz 21.3 kB With provenance Details for emem_langmem-2.4.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for emem-langmem 2.4.5
File Interpreter ABI Platform Actions
emem_langmem-2.4.5-py3-none-any.whl Python 3 none any Details for emem_langmem-2.4.5-py3-none-any.whl

Total release size: 37.1 kB

Release files / emem_langmem-2.4.5.tar.gz

Download URL emem_langmem-2.4.5.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1e952cd75c1964b87f1073d0d6fb5a2b803ed7c5c308ebfa2f50824a760245db
BLAKE2b-256 checksum
How to use checksums
8ab465a4f8a5f064c846fcee6edacc6151a97350d8211b4f1cd97c9c1c5d1877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / emem_langmem-2.4.5-py3-none-any.whl

Download URL emem_langmem-2.4.5-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2352ff61c508382d5360d27d9446b15ba685b7ec22fe5da738fca17d062d65d
BLAKE2b-256 checksum
How to use checksums
c77aa82b97d828915455b2565839fdf55c8b228149002ffc69354abdc92a70f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Security for emem-langmem 2.4.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for emem_langmem-2.4.5.tar.gz

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 Nov 9, 2026.

Transparency log

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.

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