Skip to main content

langgraph-store-core

Shared core for building LangGraph long-term-memory stores (BaseStore). Implement a backend by subclassing KVStore and supplying four small primitives — the core handles batch/abatch, timestamps, search filters, namespace prefix/suffix matching, list_namespaces, and semantic search.

from langgraph_store_core import KVStore

class MyStore(KVStore):
    def _read(self, prefix, key): ...        # -> row | None
    def _write(self, row): ...               # row = {prefix,key,value,created_at,updated_at,embedding}
    def _remove(self, prefix, key): ...
    def _scan(self, prefix): ...             # rows whose prefix starts with `prefix`

    # optional — native vector search; the default ranks `_scan` rows by cosine in Python
    def _vector_search(self, prefix, vector, filter, limit): ...   # -> [(row, score), ...]

Pass LangGraph's IndexConfig to any store built on the core and it embeds the configured fields on put and answers search(namespace, query="...") ranked by cosine similarity, with SearchItem.score populated:

store = MyStore(index={"dims": 1024, "embed": embedder, "fields": ["text"]})
store.put(("memories", "u1"), "k", {"text": "the user loves sushi"})
hits = store.search(("memories", "u1"), query="what food does the user like?")
  • embed: a LangChain Embeddings, a list[str] -> list[list[float]] callable, or a provider string ("openai:text-embedding-3-small"). bedrock_titan_embeddings() is included as a ready-made callable (needs boto3).
  • fields: JSON paths to embed; default ["$"] (whole value). put(..., index=False) skips one item; put(..., index=["title"]) overrides the fields.
  • A store without index is filter-only and ignores query, exactly as LangGraph documents.
  • Backends override _vector_search for native ANN (pgvector, Cosmos VectorDistance, Firestore find_nearest, DynamoDB SearchVectors); the core re-checks namespace and filter on what comes back, so a backend may push down only part of the filter.

langgraph_store_core.testing ships FakeEmbeddings (deterministic, no network) and MemoryKVStore for tests.

Concrete backends: langgraph-store-dynamodb, langgraph-store-postgres, langgraph-store-cosmosdb, langgraph-store-firestore.

Docs: https://skamalj.github.io/agentstate-reducer/

License

MIT

Release files for langgraph-store-core 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 langgraph-store-core 0.1.0
File Size Uploaded
langgraph_store_core-0.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-store-core 0.1.0
File Interpreter ABI Platform
langgraph_store_core-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size:16.5 kB

Release files / langgraph_store_core-0.1.0.tar.gz

Download URL langgraph_store_core-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
08b67ff1d6d748b8571c14e464e7d48ae2360a4ff358590cbaafc1fd125fe053
BLAKE2b-256 checksum
How to use checksums
274316fc2590bf2111f31cf777ffe9da703a431c4d61f4dc6b1aad0eb5099ef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL langgraph_store_core-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63c3668371a0117a60f4227ee9062bef64017c39dbd1a7e1fbe0037b31d4d641
BLAKE2b-256 checksum
How to use checksums
241b8dceb3e58bcd3cba460f882fc8c15f980e04b104020a377e3fc5974b0733
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

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