LangGraph BaseStore backed by mnestic — embedded agent memory with atomic batches and one-call BM25+vector hybrid search.
Project description
langgraph-store-mnestic
A LangGraph BaseStore backed by
mnestic — an embedded graph + vector +
full-text database (a maintained fork of CozoDB). One process, one file, no
server: agent long-term memory with atomic batches and in-engine hybrid
retrieval (BM25 + vector fused with Reciprocal Rank Fusion — a fusion that
Postgres + pgvector, LangGraph's default production store, cannot do in one
system).
mnestic is a maintained fork of CozoDB; it is not the official CozoDB. Original design credit belongs to Ziyang Hu and the Cozo Project Authors.
pip install langgraph-store-mnestic
from langgraph_store_mnestic import MnesticStore
store = MnesticStore(
engine="sqlite", path="memory.db", # or engine="mem" for ephemeral
index={"dims": 1536, "embed": my_embed_fn}, # any LangGraph IndexConfig embed
ttl={"default_ttl": 60 * 24, "refresh_on_read": True}, # optional
)
store.put(("users", "u1"), "pref", {"text": "prefers window seats"})
hits = store.search(("users", "u1"), query="seating preference")
Use it in a graph like any store:
graph = builder.compile(store=store)
What you get
- Atomic
batch()— every write in a batch lands in one engine transaction. Under LangGraph's parallel fan-out this is the difference between correct recall and silently losing reads (a non-atomic prototype lost 36% of concurrent semantic reads; this store's concurrency suite gates on zero). - Hybrid
search(query=...)— BM25 keyword + HNSW vector legs, namespace filter pushed into both index searches, RRF-fused and hydrated in a single engine snapshot. Without anindexconfig the store is BM25-only (keyword search still works, no embeddings needed). - Collision-safe namespaces — any label content stays distinct
(
('a.b',)can never collide with('a', 'b')). - TTL — per-item or
default_ttl(minutes), lazy expiry on every read path, optional refresh-on-read, and astart_ttl_sweeper()background reclaimer. - Sync + async — full
BaseStoresurface;a*methods run the sync engine calls on the default executor.
LangGraph Platform (langgraph.json)
Custom stores are loadable by import path (alpha upstream feature):
# src/agent/store.py
from contextlib import asynccontextmanager
from langgraph_store_mnestic import MnesticStore
@asynccontextmanager
async def generate_store():
store = MnesticStore(engine="sqlite", path="memory.db", index={...})
try:
yield store
finally:
store.close()
{ "store": { "path": "./src/agent/store.py:generate_store" } }
Notes
- Requires Python ≥ 3.10 and
langgraph-checkpoint >= 4.1. - The wheel build of
mnesticshipsmem,sqlite, androcksdbengines (the sdist has no rocksdb). - The text index applies English stemming + stopwords: queries made only of
very common words match nothing on the keyword leg (the vector leg still
answers when an
indexconfig is present). - Filter operators supported in
search(filter=...):$eq,$ne,$gt,$gte,$lt,$lte, withInMemoryStore-parity semantics.
License
Mozilla Public License 2.0.
Project details
Release history Release notifications | RSS feed
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 langgraph_store_mnestic-0.1.0.tar.gz.
File metadata
- Download URL: langgraph_store_mnestic-0.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66b0d970f9844939deea615ea50c26bded24ecf36d35934e3bb1d445579c6459
|
|
| MD5 |
b32e62b7fbcd7368f1f6e5cae1f18b9b
|
|
| BLAKE2b-256 |
8cdee98a4bd40c4eb2c1ac98233b9369da851a8a8082ff7f63d39cba6fe3e3bc
|
Provenance
The following attestation bundles were made for langgraph_store_mnestic-0.1.0.tar.gz:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_store_mnestic-0.1.0.tar.gz -
Subject digest:
66b0d970f9844939deea615ea50c26bded24ecf36d35934e3bb1d445579c6459 - Sigstore transparency entry: 2194843149
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@aecfd1fcf4aecf09675ebba5d78fc61f6c69da6d -
Branch / Tag:
refs/tags/py-v0.13.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@aecfd1fcf4aecf09675ebba5d78fc61f6c69da6d -
Trigger Event:
push
-
Statement type:
File details
Details for the file langgraph_store_mnestic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_store_mnestic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9958be245e41a48921a65f0b7bbd4f4b2aa696a727721fe9e63bc37002f8dcda
|
|
| MD5 |
70cf8bc4d96f4ebd569dd842a8db15e3
|
|
| BLAKE2b-256 |
079f7d32f0a1e5157e33aa0204d39bf0820f92b0843a8946f4ca51360aa51bf7
|
Provenance
The following attestation bundles were made for langgraph_store_mnestic-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on shuruheel/mnestic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_store_mnestic-0.1.0-py3-none-any.whl -
Subject digest:
9958be245e41a48921a65f0b7bbd4f4b2aa696a727721fe9e63bc37002f8dcda - Sigstore transparency entry: 2194843168
- Sigstore integration time:
-
Permalink:
shuruheel/mnestic@aecfd1fcf4aecf09675ebba5d78fc61f6c69da6d -
Branch / Tag:
refs/tags/py-v0.13.0 - Owner: https://github.com/shuruheel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@aecfd1fcf4aecf09675ebba5d78fc61f6c69da6d -
Trigger Event:
push
-
Statement type: