Azure CosmosDB checkpoint saver implementation for LangGraph
Project description
LangGraph Checkpoint CosmosDB
This project provides an implementation of a checkpoint saver for LangGraph using Azure CosmosDB.
Features
- Save and retrieve langgraph checkpoints in Azure CosmosDB.
- Suppports both sync and async saver functionality
Installation
To install the package, ensure you have Python 3.9 or higher, and run:
pip install langgraph-checkpoint-cosmosdb
Usage
Setting Up Environment
To use the CosmosDBSaver
- You need to set CosmosDB endpoint and key if you want it to create your specified database and container.
export COSMOSDB_ENDPOINT='your_cosmosdb_endpoint'
export COSMOSDB_KEY='your_cosmosdb_key'
- If database and container already exists then this can work via default RBAC credentials. Ex. az login or by setting TENANT_ID, CLIENT_ID and CLIENT_SECRET in environment.
- For user-assigned managed identity, ensure AZURE_CLIENT_ID environment variable is set to the identity's client ID.
- Note that in this case error will be thrown if database and container do not exist.
Import
from langgraph_checkpoint_cosmosdb import CosmosDBSaver
Initialize the saver
Database and Container is created if it does not exists
saver = CosmosDBSaver(database_name='your_database', container_name='your_container')
Limitations
List function does not support filters. You can only pass config on thread id to get the list.
print(list(memory.list(config=config)))
License
This project is licensed under the MIT License.
Project details
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_checkpoint_cosmosdb-0.2.5.tar.gz.
File metadata
- Download URL: langgraph_checkpoint_cosmosdb-0.2.5.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f49287ed6f6b377c5bdb4dd00ff9bbc56beef9b39d9a0d062621aeea68455522
|
|
| MD5 |
b4d21dca02821d08f54442bf13ed8c4d
|
|
| BLAKE2b-256 |
4c10f5ef6cca7c00725e5984818bd7a5e6e4aa60fbf2636c3b493aadf26db92e
|
File details
Details for the file langgraph_checkpoint_cosmosdb-0.2.5-py3-none-any.whl.
File metadata
- Download URL: langgraph_checkpoint_cosmosdb-0.2.5-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abc148262cc64909aca7b832f811d0f4077bed464e6c4ead4ca336dfdf9be477
|
|
| MD5 |
c784fcdfdede096bc4b51119d5e1e153
|
|
| BLAKE2b-256 |
feedf4323a651f1384dae54f5388bbfe6b7d0ee8dfb53a9d3193479b025d9ae8
|