langgraph-cosmosdb-checkpointer
State-of-the-art Azure Cosmos DB checkpointer implementation for LangGraph with:
- strict config semantics (
thread_id,checkpoint_ns,checkpoint_id) - deterministic/idempotent
put_writesordering rules - optimistic concurrency handling for special writes
- payload guardrails for Cosmos 2MB item limit (compression + chunking)
Install
pip install langgraph-cosmosdb-checkpointer
Usage
from langgraph_cosmosdb_checkpointer import CosmosDBSaver, CosmosDBSettings
settings = CosmosDBSettings(
database_name="langgraph",
checkpoint_container_name="checkpoints",
writes_container_name="writes",
blob_container_name="checkpoint_blobs",
)
saver = CosmosDBSaver.from_endpoint(
endpoint="https://<account>.documents.azure.com:443/",
credential="<account-key>",
settings=settings,
)
You can also use AsyncCosmosDBSaver for async graph execution.
By default (create_containers=True), the saver creates the database and containers automatically if they don't exist.
Cosmos DB indexing policy
The writes container must have a composite index to support the multi-field sort used when loading pending writes:
ORDER BY c.task_id ASC, c.idx ASC
If you create the container using this library, it will include the required composite index. If the container already
exists, Cosmos DB will keep the existing indexing policy (i.e., create_container_if_not_exists(...) will not update
it), so you must update the container indexing policy in Azure or recreate the container.
Azure AD / Entra ID authentication
from_endpoint supports DefaultAzureCredential for Azure AD auth:
from azure.identity import DefaultAzureCredential
from langgraph_cosmosdb_checkpointer import CosmosDBSaver
saver = CosmosDBSaver.from_endpoint(
endpoint="https://<account>.documents.azure.com:443/",
credential=DefaultAzureCredential(),
)
If credential is omitted, from_endpoint will use DefaultAzureCredential() automatically.
Metadata
Release files for langgraph-cosmosdb-checkpointer 1.0.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 | |
|---|---|---|---|
| langgraph_cosmosdb_checkpointer-1.0.0.tar.gz | 22.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langgraph_cosmosdb_checkpointer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.8 kB
Release files / langgraph_cosmosdb_checkpointer-1.0.0.tar.gz
| Download URL | langgraph_cosmosdb_checkpointer-1.0.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d0cc160f9598fa5164dd27a8d3d86a26cbe33819ce27dcae0829cd9e6e9439e
|
|
BLAKE2b-256 checksum How to use checksums |
015b0a7f94d3459d9befdc08321a314b81425b4aee4630665d71753f81b4f5e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / langgraph_cosmosdb_checkpointer-1.0.0-py3-none-any.whl
| Download URL | langgraph_cosmosdb_checkpointer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2566da46d7159f0d52573a791d92cadf36cd311f57b5824f682dac9882d8236b
|
|
BLAKE2b-256 checksum How to use checksums |
f5b8f1d2b4ccf819b6f5ea336fa05d00617e14dedd10e0250c6e0eee444d6371
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|