langgraph-api 0.0.36__py3-none-any.whl → 0.0.37__py3-none-any.whl
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.
Potentially problematic release.
This version of langgraph-api might be problematic. Click here for more details.
- langgraph_api/cli.py +2 -0
- langgraph_api/serde.py +12 -3
- {langgraph_api-0.0.36.dist-info → langgraph_api-0.0.37.dist-info}/METADATA +2 -1
- {langgraph_api-0.0.36.dist-info → langgraph_api-0.0.37.dist-info}/RECORD +9 -9
- langgraph_storage/checkpoint.py +4 -1
- langgraph_storage/store.py +11 -2
- {langgraph_api-0.0.36.dist-info → langgraph_api-0.0.37.dist-info}/LICENSE +0 -0
- {langgraph_api-0.0.36.dist-info → langgraph_api-0.0.37.dist-info}/WHEEL +0 -0
- {langgraph_api-0.0.36.dist-info → langgraph_api-0.0.37.dist-info}/entry_points.txt +0 -0
langgraph_api/cli.py
CHANGED
|
@@ -130,6 +130,7 @@ def run_server(
|
|
|
130
130
|
auth: AuthConfig | None = None,
|
|
131
131
|
http: typing.Optional["HttpConfig"] = None,
|
|
132
132
|
studio_url: str | None = None,
|
|
133
|
+
disable_persistence: bool = False,
|
|
133
134
|
**kwargs: typing.Any,
|
|
134
135
|
):
|
|
135
136
|
"""Run the LangGraph API server."""
|
|
@@ -189,6 +190,7 @@ def run_server(
|
|
|
189
190
|
LANGGRAPH_AUTH=json.dumps(auth) if auth else None,
|
|
190
191
|
LANGGRAPH_HTTP=json.dumps(http) if http else None,
|
|
191
192
|
LANGGRAPH_API_URL=local_url,
|
|
193
|
+
LANGGRAPH_DISABLE_FILE_PERSISTENCE=str(disable_persistence).lower(),
|
|
192
194
|
# See https://developer.chrome.com/blog/private-network-access-update-2024-03
|
|
193
195
|
ALLOW_PRIVATE_NETWORK="true",
|
|
194
196
|
)
|
langgraph_api/serde.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import pickle
|
|
3
2
|
import uuid
|
|
4
3
|
from base64 import b64encode
|
|
5
4
|
from collections import deque
|
|
@@ -18,9 +17,13 @@ from re import Pattern
|
|
|
18
17
|
from typing import Any, NamedTuple
|
|
19
18
|
from zoneinfo import ZoneInfo
|
|
20
19
|
|
|
20
|
+
import cloudpickle
|
|
21
21
|
import orjson
|
|
22
|
+
import structlog
|
|
22
23
|
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer
|
|
23
24
|
|
|
25
|
+
logger = structlog.stdlib.get_logger(__name__)
|
|
26
|
+
|
|
24
27
|
|
|
25
28
|
class Fragment(NamedTuple):
|
|
26
29
|
buf: bytes
|
|
@@ -122,9 +125,15 @@ class Serializer(JsonPlusSerializer):
|
|
|
122
125
|
try:
|
|
123
126
|
return super().dumps_typed(obj)
|
|
124
127
|
except TypeError:
|
|
125
|
-
return "pickle",
|
|
128
|
+
return "pickle", cloudpickle.dumps(obj)
|
|
126
129
|
|
|
127
130
|
def loads_typed(self, data: tuple[str, bytes]) -> Any:
|
|
128
131
|
if data[0] == "pickle":
|
|
129
|
-
|
|
132
|
+
try:
|
|
133
|
+
return cloudpickle.loads(data[1])
|
|
134
|
+
except Exception as e:
|
|
135
|
+
logger.warning(
|
|
136
|
+
"Failed to unpickle object, replacing w None", exc_info=e
|
|
137
|
+
)
|
|
138
|
+
return None
|
|
130
139
|
return super().loads_typed(data)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: langgraph-api
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.37
|
|
4
4
|
Summary:
|
|
5
5
|
License: Elastic-2.0
|
|
6
6
|
Author: Nuno Campos
|
|
@@ -10,6 +10,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Dist: cloudpickle (>=3.0.0,<4.0.0)
|
|
13
14
|
Requires-Dist: cryptography (>=43.0.3,<44.0.0)
|
|
14
15
|
Requires-Dist: httpx (>=0.25.0)
|
|
15
16
|
Requires-Dist: jsonschema-rs (>=0.20.0,<0.30)
|
|
@@ -18,7 +18,7 @@ langgraph_api/auth/langsmith/client.py,sha256=eKchvAom7hdkUXauD8vHNceBDDUijrFgdT
|
|
|
18
18
|
langgraph_api/auth/middleware.py,sha256=jU8aDSIZHdzCGdifejRF7ndHkSjBtqIHcBwFIuUdHEA,1875
|
|
19
19
|
langgraph_api/auth/noop.py,sha256=Bk6Nf3p8D_iMVy_OyfPlyiJp_aEwzL-sHrbxoXpCbac,586
|
|
20
20
|
langgraph_api/auth/studio_user.py,sha256=FzFQRROKDlA9JjtBuwyZvk6Mbwno5M9RVYjDO6FU3F8,186
|
|
21
|
-
langgraph_api/cli.py,sha256=
|
|
21
|
+
langgraph_api/cli.py,sha256=76wJLx1ekaRmXR5DxGy1_RuA0lQq2jBUzHAAVUKV2Ho,12163
|
|
22
22
|
langgraph_api/command.py,sha256=3O9v3i0OPa96ARyJ_oJbLXkfO8rPgDhLCswgO9koTFA,768
|
|
23
23
|
langgraph_api/config.py,sha256=MwTyJUr2wwZdUbL0gIvol_cCGi24Py9DvBnSozE1ai8,9342
|
|
24
24
|
langgraph_api/cron_scheduler.py,sha256=9yzbbGxzNgJdIg4ZT7yu2oTwT_wRuPxD1c2sbbd52xs,2630
|
|
@@ -72,7 +72,7 @@ langgraph_api/patch.py,sha256=82xjuFqY7tgrUm-k1XWHI6k8S6QovSD0zhe--8_xW4o,1296
|
|
|
72
72
|
langgraph_api/queue_entrypoint.py,sha256=4xICUxXarNV8DhnaqAMhVi3xCmyVKCL3J5NzHxPA9Xc,1835
|
|
73
73
|
langgraph_api/route.py,sha256=fM4qYCGbmH0a3_cV8uKocb1sLklehxO6HhdRXqLK6OM,4421
|
|
74
74
|
langgraph_api/schema.py,sha256=hNbg6ep2wiGBBtBJVNBgMYA8uC33AfaqhRXXVUY_At8,5361
|
|
75
|
-
langgraph_api/serde.py,sha256=
|
|
75
|
+
langgraph_api/serde.py,sha256=D5t_HeABMYKRAsoXWaWG0IsdaYM8yOXIez2wJUTIgT8,3963
|
|
76
76
|
langgraph_api/server.py,sha256=bnXOOYztQmqR-QVpEFoRWB5Fzd33PuEIlwBK2R7W8NE,4849
|
|
77
77
|
langgraph_api/sse.py,sha256=2wNodCOP2eg7a9mpSu0S3FQ0CHk2BBV_vv0UtIgJIcc,4034
|
|
78
78
|
langgraph_api/state.py,sha256=8jx4IoTCOjTJuwzuXJKKFwo1VseHjNnw_CCq4x1SW14,2284
|
|
@@ -86,18 +86,18 @@ langgraph_license/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
86
86
|
langgraph_license/middleware.py,sha256=_ODIYzQkymr6W9_Fp9wtf1kAQspnpsmr53xuzyF2GA0,612
|
|
87
87
|
langgraph_license/validation.py,sha256=Uu_G8UGO_WTlLsBEY0gTVWjRR4czYGfw5YAD3HLZoj0,203
|
|
88
88
|
langgraph_storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
|
-
langgraph_storage/checkpoint.py,sha256=
|
|
89
|
+
langgraph_storage/checkpoint.py,sha256=Qq0y6vdh27qdF3h5nOLT5CcX9Rj2bcFqkVOMeCaGoK4,4036
|
|
90
90
|
langgraph_storage/database.py,sha256=I0AgFeJ-NSTT34vxKxQBUf1z2syFP0S8QpKCqTixrzY,5652
|
|
91
91
|
langgraph_storage/inmem_stream.py,sha256=8bxkILIuFpr7P7RQ37SQAxrpRKvmbHdRB_nbfFiomlk,3263
|
|
92
92
|
langgraph_storage/ops.py,sha256=S0QHbnquEXvAM63NQMgqtyTjm-8nlq0pOvgJgFD38Z8,75312
|
|
93
93
|
langgraph_storage/queue.py,sha256=UDgsUTtUMfBSRDrQ8Onis-FJO4n7KTsX6sdpbY8Hs0A,5055
|
|
94
94
|
langgraph_storage/retry.py,sha256=XmldOP4e_H5s264CagJRVnQMDFcEJR_dldVR1Hm5XvM,763
|
|
95
|
-
langgraph_storage/store.py,sha256=
|
|
95
|
+
langgraph_storage/store.py,sha256=JB9jZ87GE19MVN9wgl3-esgR2eIkeipws9q6qsPWkgc,3399
|
|
96
96
|
langgraph_storage/ttl_dict.py,sha256=FlpEY8EANeXWKo_G5nmIotPquABZGyIJyk6HD9u6vqY,1533
|
|
97
97
|
logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
|
|
98
98
|
openapi.json,sha256=-25y3NRQ88e_944UXo76Goa34HJhC7pj6I9tjYUwvuE,131492
|
|
99
|
-
langgraph_api-0.0.
|
|
100
|
-
langgraph_api-0.0.
|
|
101
|
-
langgraph_api-0.0.
|
|
102
|
-
langgraph_api-0.0.
|
|
103
|
-
langgraph_api-0.0.
|
|
99
|
+
langgraph_api-0.0.37.dist-info/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
100
|
+
langgraph_api-0.0.37.dist-info/METADATA,sha256=zawmEdZt_TgVBU6iHpMFrfdREjAYy9PqXU6lyy1dBb8,4071
|
|
101
|
+
langgraph_api-0.0.37.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
102
|
+
langgraph_api-0.0.37.dist-info/entry_points.txt,sha256=3EYLgj89DfzqJHHYGxPH4A_fEtClvlRbWRUHaXO7hj4,77
|
|
103
|
+
langgraph_api-0.0.37.dist-info/RECORD,,
|
langgraph_storage/checkpoint.py
CHANGED
|
@@ -16,6 +16,9 @@ from langgraph_api.serde import Serializer
|
|
|
16
16
|
logger = logging.getLogger(__name__)
|
|
17
17
|
|
|
18
18
|
_EXCLUDED_KEYS = {"checkpoint_ns", "checkpoint_id", "run_id", "thread_id"}
|
|
19
|
+
DISABLE_FILE_PERSISTENCE = (
|
|
20
|
+
os.getenv("LANGGRAPH_DISABLE_FILE_PERSISTENCE", "false").lower() == "true"
|
|
21
|
+
)
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
class InMemorySaver(MemorySaver):
|
|
@@ -56,7 +59,7 @@ class InMemorySaver(MemorySaver):
|
|
|
56
59
|
|
|
57
60
|
super().__init__(
|
|
58
61
|
serde=serde if serde is not None else Serializer(),
|
|
59
|
-
factory=factory,
|
|
62
|
+
factory=factory if not DISABLE_FILE_PERSISTENCE else None,
|
|
60
63
|
)
|
|
61
64
|
|
|
62
65
|
def put(
|
langgraph_storage/store.py
CHANGED
|
@@ -13,13 +13,22 @@ from langgraph.store.memory import InMemoryStore
|
|
|
13
13
|
from langgraph_api.graph import resolve_embeddings
|
|
14
14
|
|
|
15
15
|
_STORE_CONFIG = None
|
|
16
|
+
DISABLE_FILE_PERSISTENCE = (
|
|
17
|
+
os.getenv("LANGGRAPH_DISABLE_FILE_PERSISTENCE", "false").lower() == "true"
|
|
18
|
+
)
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
class DiskBackedInMemStore(InMemoryStore):
|
|
19
22
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
20
23
|
super().__init__(*args, **kwargs)
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
if not DISABLE_FILE_PERSISTENCE:
|
|
25
|
+
self._data = PersistentDict(dict, filename=_STORE_FILE)
|
|
26
|
+
self._vectors = PersistentDict(
|
|
27
|
+
lambda: defaultdict(dict), filename=_VECTOR_FILE
|
|
28
|
+
)
|
|
29
|
+
else:
|
|
30
|
+
self._data = InMemoryStore._data
|
|
31
|
+
self._vectors = InMemoryStore._vectors
|
|
23
32
|
self._load_data(self._data, which="data")
|
|
24
33
|
self._load_data(self._vectors, which="vectors")
|
|
25
34
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|