langgraph_checkpoint_cosmosdb 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+
11
+ # Virtual environments
12
+ venv/
13
+ env/
14
+ .env/
15
+ .venv/
16
+ ENV/
17
+
18
+ # IDE specific files
19
+ .idea/
20
+ .vscode/
21
+ *.swp
22
+ *.swo
23
+
24
+ # Unit test / coverage reports
25
+ htmcov/
26
+ .tox/
27
+ .coverage
28
+ .coverage.*
29
+ .cache
30
+ nosetests.xml
31
+ coverage.xml
32
+ *.cover
33
+
34
+ # Jupyter Notebook
35
+ .ipynb_checkpoints
36
+
37
+ # Environment variables
38
+ .env
39
+
40
+ # Local development settings
41
+ *.log
42
+ .DS_Store
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: langgraph_checkpoint_cosmosdb
3
+ Version: 0.2.6
4
+ Summary: Azure CosmosDB checkpoint saver implementation for LangGraph
5
+ Author-email: Kamal <skamalj@github.com>
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: azure-cosmos
11
+ Requires-Dist: azure-identity
12
+ Requires-Dist: langchain-core
13
+ Requires-Dist: langgraph
14
+ Provides-Extra: dev
15
+ Requires-Dist: black; extra == 'dev'
16
+ Requires-Dist: isort; extra == 'dev'
17
+ Requires-Dist: mypy; extra == 'dev'
18
+ Requires-Dist: pytest-cov; extra == 'dev'
19
+ Requires-Dist: pytest>=7.0; extra == 'dev'
20
+ Provides-Extra: reducer
21
+ Requires-Dist: agentstate-reducer>=0.1.1; extra == 'reducer'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # LangGraph Checkpoint CosmosDB
25
+
26
+ This project provides an implementation of a checkpoint saver for LangGraph using Azure CosmosDB.
27
+
28
+ ## Features
29
+ - Save and retrieve langgraph checkpoints in Azure CosmosDB.
30
+ - Suppports both sync and async saver functionality
31
+
32
+ ## Installation
33
+
34
+ To install the package, ensure you have Python 3.9 or higher, and run:
35
+
36
+ ```pip install langgraph-checkpoint-cosmosdb```
37
+
38
+ ## Usage
39
+
40
+ ### Setting Up Environment
41
+
42
+ To use the `CosmosDBSaver`
43
+ - You need to set CosmosDB endpoint and key if you want it to create your specified database and container.
44
+ ```
45
+ export COSMOSDB_ENDPOINT='your_cosmosdb_endpoint'
46
+ export COSMOSDB_KEY='your_cosmosdb_key'
47
+ ```
48
+ - 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.
49
+ - For user-assigned managed identity, ensure AZURE_CLIENT_ID environment variable is set to the identity's client ID.
50
+ - Note that in this case error will be thrown if database and container do not exist.
51
+
52
+
53
+
54
+ ## Import
55
+
56
+ ```
57
+ from langgraph_checkpoint_cosmosdb import CosmosDBSaver
58
+ ```
59
+
60
+ ## Initialize the saver
61
+ Database and Container is created if it does not exists
62
+ ```
63
+ saver = CosmosDBSaver(database_name='your_database', container_name='your_container')
64
+ ```
65
+
66
+ ## Limitations
67
+ List function does not support filters. You can only pass config on thread id to get the list.
68
+
69
+ ```
70
+ print(list(memory.list(config=config)))
71
+ ```
72
+ ## License
73
+
74
+ This project is licensed under the MIT License.
@@ -0,0 +1,51 @@
1
+ # LangGraph Checkpoint CosmosDB
2
+
3
+ This project provides an implementation of a checkpoint saver for LangGraph using Azure CosmosDB.
4
+
5
+ ## Features
6
+ - Save and retrieve langgraph checkpoints in Azure CosmosDB.
7
+ - Suppports both sync and async saver functionality
8
+
9
+ ## Installation
10
+
11
+ To install the package, ensure you have Python 3.9 or higher, and run:
12
+
13
+ ```pip install langgraph-checkpoint-cosmosdb```
14
+
15
+ ## Usage
16
+
17
+ ### Setting Up Environment
18
+
19
+ To use the `CosmosDBSaver`
20
+ - You need to set CosmosDB endpoint and key if you want it to create your specified database and container.
21
+ ```
22
+ export COSMOSDB_ENDPOINT='your_cosmosdb_endpoint'
23
+ export COSMOSDB_KEY='your_cosmosdb_key'
24
+ ```
25
+ - 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.
26
+ - For user-assigned managed identity, ensure AZURE_CLIENT_ID environment variable is set to the identity's client ID.
27
+ - Note that in this case error will be thrown if database and container do not exist.
28
+
29
+
30
+
31
+ ## Import
32
+
33
+ ```
34
+ from langgraph_checkpoint_cosmosdb import CosmosDBSaver
35
+ ```
36
+
37
+ ## Initialize the saver
38
+ Database and Container is created if it does not exists
39
+ ```
40
+ saver = CosmosDBSaver(database_name='your_database', container_name='your_container')
41
+ ```
42
+
43
+ ## Limitations
44
+ List function does not support filters. You can only pass config on thread id to get the list.
45
+
46
+ ```
47
+ print(list(memory.list(config=config)))
48
+ ```
49
+ ## License
50
+
51
+ This project is licensed under the MIT License.
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "langgraph_checkpoint_cosmosdb"
7
+ version = "0.2.6"
8
+ description = "Azure CosmosDB checkpoint saver implementation for LangGraph"
9
+ authors = [{name = "Kamal", email = "skamalj@github.com"}]
10
+ readme = "README.md"
11
+ requires-python = ">=3.10"
12
+ dependencies = [
13
+ "langchain-core",
14
+ "langgraph",
15
+ "azure-cosmos",
16
+ "azure-identity"
17
+ ]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ ]
23
+
24
+ [project.optional-dependencies]
25
+ reducer = [
26
+ "agentstate-reducer>=0.1.1",
27
+ ]
28
+ dev = [
29
+ "pytest>=7.0",
30
+ "pytest-cov",
31
+ "black",
32
+ "isort",
33
+ "mypy"
34
+ ]
35
+
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "pytest>=7.0",
40
+ "pytest-cov",
41
+ "langchain-openai",
42
+ "langgraph-checkpoint-cosmosdb[reducer]",
43
+ ]
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/langgraph_checkpoint_cosmosdb"]
47
+
48
+ [tool.black]
49
+ line-length = 88
50
+ target-version = ['py39']
51
+
52
+ [tool.isort]
53
+ profile = "black"
54
+ multi_line_output = 3
@@ -0,0 +1,51 @@
1
+ # LangGraph Checkpoint CosmosDB
2
+
3
+ This project provides an implementation of a checkpoint saver for LangGraph using Azure CosmosDB.
4
+
5
+ ## Features
6
+ - Save and retrieve langgraph checkpoints in Azure CosmosDB.
7
+ - Suppports both sync and async saver functionality
8
+
9
+ ## Installation
10
+
11
+ To install the package, ensure you have Python 3.9 or higher, and run:
12
+
13
+ ```pip install langgraph-checkpoint-cosmosdb```
14
+
15
+ ## Usage
16
+
17
+ ### Setting Up Environment
18
+
19
+ To use the `CosmosDBSaver`
20
+ - You need to set CosmosDB endpoint and key if you want it to create your specified database and container.
21
+ ```
22
+ export COSMOSDB_ENDPOINT='your_cosmosdb_endpoint'
23
+ export COSMOSDB_KEY='your_cosmosdb_key'
24
+ ```
25
+ - 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.
26
+ - For user-assigned managed identity, ensure AZURE_CLIENT_ID environment variable is set to the identity's client ID.
27
+ - Note that in this case error will be thrown if database and container do not exist.
28
+
29
+
30
+
31
+ ## Import
32
+
33
+ ```
34
+ from langgraph_checkpoint_cosmosdb import CosmosDBSaver
35
+ ```
36
+
37
+ ## Initialize the saver
38
+ Database and Container is created if it does not exists
39
+ ```
40
+ saver = CosmosDBSaver(database_name='your_database', container_name='your_container')
41
+ ```
42
+
43
+ ## Limitations
44
+ List function does not support filters. You can only pass config on thread id to get the list.
45
+
46
+ ```
47
+ print(list(memory.list(config=config)))
48
+ ```
49
+ ## License
50
+
51
+ This project is licensed under the MIT License.
File without changes
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+
2
+
3
+ from langgraph_checkpoint_cosmosdb.cosmosdbSaver import CosmosDBSaver
4
+ from .cosmosSerializer import CosmosSerializer
5
+
6
+ __all__ = ["CosmosDBSaver", "CosmosSerializer"]
7
+
@@ -0,0 +1,24 @@
1
+ import base64
2
+
3
+ class CosmosSerializer:
4
+ def __init__(self, serde):
5
+ self.serde = serde
6
+
7
+ def dumps_typed(self, obj):
8
+ type_, data = self.serde.dumps_typed(obj)
9
+ data_base64 = base64.b64encode(data).decode('utf-8')
10
+ return type_, data_base64
11
+
12
+ def loads_typed(self, data):
13
+ type_name, serialized_obj = data
14
+ serialized_obj = base64.b64decode(serialized_obj.encode('utf-8'))
15
+ return self.serde.loads_typed((type_name, serialized_obj))
16
+
17
+ def dumps(self, obj):
18
+ data = self.serde.dumps(obj)
19
+ data_base64 = base64.b64encode(data).decode('utf-8')
20
+ return data_base64
21
+
22
+ def loads(self, serialized_obj):
23
+ serialized_obj = base64.b64decode(serialized_obj.encode('utf-8'))
24
+ return self.serde.loads(serialized_obj)