langgraph-store-cosmosdb
An Azure Cosmos DB (NoSQL) long-term-memory store (BaseStore) for LangGraph — namespaced key/value memory with prefix search, filters, list_namespaces, and native semantic search via Cosmos DB vector search.
pip install langgraph-store-cosmosdb
from langgraph_store_cosmosdb import CosmosDBStore
store = CosmosDBStore(
endpoint="https://<acct>.documents.azure.com:443/", key="<key>",
database_name="langgraph", container_name="store",
)
store.put(("users", "1", "memories"), "food", {"text": "loves sushi", "kind": "pref"})
item = store.get(("users", "1", "memories"), "food")
hits = store.search(("users", "1"), filter={"kind": "pref"})
Use it as a LangGraph store: graph.compile(store=CosmosDBStore(...)). Async methods work too (sync calls run in a thread).
Semantic search (Cosmos DB vector search)
Pass a LangGraph IndexConfig and the store embeds the configured fields on put and ranks search(query=...) by cosine similarity using VectorDistance in the container's SQL:
from langgraph_store_core import bedrock_titan_embeddings
from langgraph_store_cosmosdb import CosmosDBStore
store = CosmosDBStore(endpoint=..., key=..., database_name="langgraph", container_name="memory",
index={"dims": 1024, "embed": bedrock_titan_embeddings(dimensions=1024), "fields": ["text"]})
store.put(("memories", "kamal"), "k1", {"text": "the user loves sushi", "kind": "pref"})
hits = store.search(("memories", "kamal"), query="what food does the user like?", filter={"kind": "pref"})
print(hits[0].score, hits[0].value)
embed may be any LangChain Embeddings, a list[str] -> list[list[float]] callable, or a provider string. fields defaults to ["$"] (whole value as JSON). put(..., index=False) skips embedding for one item.
With index the container is created with a vector embedding policy on /embedding (cosine, dims) and a diskANN vector index (vector_index_type="quantizedFlat" / "flat" to change). The policy must be set at container creation, so use a new container name when enabling semantic search on an existing store. The account needs the Vector Search for NoSQL capability enabled (az cosmosdb update ... --capabilities EnableNoSQLVectorSearch, keeping any existing capabilities). Namespace prefix and plain-equality filters run inside the query; operator filters ($gt, $in, …) are applied on the returned candidates.
Data model
A container partitioned by /prefix (the namespace), each item {id, prefix, key, value, created_at, updated_at[, embedding]} (id is the URL-encoded key). Database and container are auto-created under key-based auth. Search is a STARTSWITH prefix query; filters and namespace matching are evaluated in the core.
Docs: https://skamalj.github.io/agentstate-reducer/
License
MIT
Metadata
Release files for langgraph-store-cosmosdb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langgraph_store_cosmosdb-0.1.0.tar.gz | 6.3 kB | Without provenance | Details for langgraph_store_cosmosdb-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langgraph_store_cosmosdb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langgraph_store_cosmosdb-0.1.0-py3-none-any.whl |
Total release size: 11.5 kB
Release files / langgraph_store_cosmosdb-0.1.0.tar.gz
| Download URL | langgraph_store_cosmosdb-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d447cdbc8abe12ed0c7b5735b3c54704960779d4996bbd4b4381548cc0d92d6
|
|
BLAKE2b-256 checksum How to use checksums |
0e44879e2951085171cf9e263df794ae7b2faf72326de6928fa130fd2b043933
|
| 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_cosmosdb-0.1.0-py3-none-any.whl
| Download URL | langgraph_store_cosmosdb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65065419be023b50501e23ad67e00958bf9d095c9df857c65e1e06bb5b7b08fc
|
|
BLAKE2b-256 checksum How to use checksums |
a4316fc0cdcb763e1de37803f3ce4b800338b6b45da9a109422543e69bbf7d58
|
| 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}
|
Security for langgraph-store-cosmosdb 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.