langgraph-api 0.2.115__py3-none-any.whl → 0.2.120__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/__init__.py +1 -1
- langgraph_api/api/runs.py +4 -4
- langgraph_api/api/threads.py +2 -2
- langgraph_api/api/ui.py +3 -1
- langgraph_api/js/client.mts +9 -1
- langgraph_api/js/package.json +5 -5
- langgraph_api/js/yarn.lock +28 -45
- langgraph_api/schema.py +3 -1
- langgraph_api/stream.py +24 -6
- langgraph_api/thread_ttl.py +3 -0
- {langgraph_api-0.2.115.dist-info → langgraph_api-0.2.120.dist-info}/METADATA +1 -1
- {langgraph_api-0.2.115.dist-info → langgraph_api-0.2.120.dist-info}/RECORD +16 -16
- openapi.json +164 -1
- {langgraph_api-0.2.115.dist-info → langgraph_api-0.2.120.dist-info}/WHEEL +0 -0
- {langgraph_api-0.2.115.dist-info → langgraph_api-0.2.120.dist-info}/entry_points.txt +0 -0
- {langgraph_api-0.2.115.dist-info → langgraph_api-0.2.120.dist-info}/licenses/LICENSE +0 -0
langgraph_api/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.120"
|
langgraph_api/api/runs.py
CHANGED
|
@@ -93,6 +93,7 @@ async def stream_run(
|
|
|
93
93
|
payload = await request.json(RunCreateStateful)
|
|
94
94
|
on_disconnect = payload.get("on_disconnect", "continue")
|
|
95
95
|
run_id = uuid6()
|
|
96
|
+
stream_mode = payload.get("stream_mode", [])
|
|
96
97
|
sub = asyncio.create_task(Runs.Stream.subscribe(run_id))
|
|
97
98
|
|
|
98
99
|
try:
|
|
@@ -117,7 +118,7 @@ async def stream_run(
|
|
|
117
118
|
thread_id=thread_id,
|
|
118
119
|
cancel_on_disconnect=on_disconnect == "cancel",
|
|
119
120
|
stream_channel=await sub,
|
|
120
|
-
stream_mode=
|
|
121
|
+
stream_mode=stream_mode,
|
|
121
122
|
last_event_id=None,
|
|
122
123
|
),
|
|
123
124
|
headers={
|
|
@@ -134,6 +135,7 @@ async def stream_run_stateless(
|
|
|
134
135
|
payload = await request.json(RunCreateStateless)
|
|
135
136
|
on_disconnect = payload.get("on_disconnect", "continue")
|
|
136
137
|
run_id = uuid6()
|
|
138
|
+
stream_mode = payload.get("stream_mode", [])
|
|
137
139
|
sub = asyncio.create_task(Runs.Stream.subscribe(run_id))
|
|
138
140
|
|
|
139
141
|
try:
|
|
@@ -159,7 +161,7 @@ async def stream_run_stateless(
|
|
|
159
161
|
ignore_404=True,
|
|
160
162
|
cancel_on_disconnect=on_disconnect == "cancel",
|
|
161
163
|
stream_channel=await sub,
|
|
162
|
-
stream_mode=
|
|
164
|
+
stream_mode=stream_mode,
|
|
163
165
|
last_event_id=None,
|
|
164
166
|
),
|
|
165
167
|
headers={
|
|
@@ -211,7 +213,6 @@ async def wait_run(request: ApiRequest):
|
|
|
211
213
|
if mode == b"values":
|
|
212
214
|
vchunk = chunk
|
|
213
215
|
elif mode == b"updates" and b"__interrupt__" in chunk:
|
|
214
|
-
# Include the interrupt message in the values
|
|
215
216
|
vchunk = chunk
|
|
216
217
|
elif mode == b"error":
|
|
217
218
|
vchunk = orjson.dumps({"__error__": orjson.Fragment(chunk)})
|
|
@@ -296,7 +297,6 @@ async def wait_run_stateless(request: ApiRequest):
|
|
|
296
297
|
if mode == b"values":
|
|
297
298
|
vchunk = chunk
|
|
298
299
|
elif mode == b"updates" and b"__interrupt__" in chunk:
|
|
299
|
-
# Include the interrupt message in the values
|
|
300
300
|
vchunk = chunk
|
|
301
301
|
elif mode == b"error":
|
|
302
302
|
vchunk = orjson.dumps({"__error__": orjson.Fragment(chunk)})
|
langgraph_api/api/threads.py
CHANGED
|
@@ -172,7 +172,7 @@ async def get_thread_history(
|
|
|
172
172
|
"""Get all past states for a thread."""
|
|
173
173
|
thread_id = request.path_params["thread_id"]
|
|
174
174
|
validate_uuid(thread_id, "Invalid thread ID: must be a UUID")
|
|
175
|
-
limit_ = request.query_params.get("limit",
|
|
175
|
+
limit_ = request.query_params.get("limit", 1)
|
|
176
176
|
try:
|
|
177
177
|
limit = int(limit_)
|
|
178
178
|
except ValueError:
|
|
@@ -205,7 +205,7 @@ async def get_thread_history_post(
|
|
|
205
205
|
for c in await Threads.State.list(
|
|
206
206
|
conn,
|
|
207
207
|
config=config,
|
|
208
|
-
limit=int(payload.get("limit") or
|
|
208
|
+
limit=int(payload.get("limit") or 1),
|
|
209
209
|
before=payload.get("before"),
|
|
210
210
|
metadata=payload.get("metadata"),
|
|
211
211
|
)
|
langgraph_api/api/ui.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
|
+
import re
|
|
3
4
|
|
|
4
5
|
from anyio import open_file
|
|
5
6
|
from orjson import loads
|
|
@@ -58,6 +59,7 @@ async def handle_ui(request: ApiRequest) -> Response:
|
|
|
58
59
|
return host.startswith(needle + ":") or host == needle
|
|
59
60
|
|
|
60
61
|
protocol = "http:" if is_host("localhost") or is_host("127.0.0.1") else ""
|
|
62
|
+
valid_js_name = re.sub(r"[^a-zA-Z0-9]", "_", graph_id)
|
|
61
63
|
|
|
62
64
|
if ext == ".css":
|
|
63
65
|
result.append(
|
|
@@ -66,7 +68,7 @@ async def handle_ui(request: ApiRequest) -> Response:
|
|
|
66
68
|
elif ext == ".js":
|
|
67
69
|
result.append(
|
|
68
70
|
f'<script src="{protocol}//{host}/ui/{graph_id}/{basename}" '
|
|
69
|
-
f"onload='__LGUI_{
|
|
71
|
+
f"onload='__LGUI_{valid_js_name}.render({json.dumps(message['name'])}, \"{{{{shadowRootId}}}}\")'>"
|
|
70
72
|
"</script>"
|
|
71
73
|
)
|
|
72
74
|
|
langgraph_api/js/client.mts
CHANGED
|
@@ -576,6 +576,8 @@ export class RemoteStore extends BaseStore {
|
|
|
576
576
|
const StreamModeSchema = z.union([
|
|
577
577
|
z.literal("updates"),
|
|
578
578
|
z.literal("debug"),
|
|
579
|
+
z.literal("tasks"),
|
|
580
|
+
z.literal("checkpoints"),
|
|
579
581
|
z.literal("values"),
|
|
580
582
|
z.literal("custom"),
|
|
581
583
|
]);
|
|
@@ -654,7 +656,13 @@ async function* streamEventsRequest(
|
|
|
654
656
|
: [payload.stream_mode];
|
|
655
657
|
|
|
656
658
|
const graphStreamMode: Set<
|
|
657
|
-
|
|
659
|
+
| "updates"
|
|
660
|
+
| "debug"
|
|
661
|
+
| "values"
|
|
662
|
+
| "tasks"
|
|
663
|
+
| "checkpoints"
|
|
664
|
+
| "messages"
|
|
665
|
+
| "custom"
|
|
658
666
|
> = new Set();
|
|
659
667
|
if (payload.stream_mode) {
|
|
660
668
|
for (const mode of userStreamMode) {
|
langgraph_api/js/package.json
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@hono/node-server": "^1.12.0",
|
|
11
11
|
"@hono/zod-validator": "^0.2.2",
|
|
12
|
-
"@langchain/core": "^0.3.
|
|
12
|
+
"@langchain/core": "^0.3.59",
|
|
13
13
|
"@langchain/langgraph": "^0.2.65",
|
|
14
|
-
"@langchain/langgraph-api": "~0.0.
|
|
14
|
+
"@langchain/langgraph-api": "~0.0.56",
|
|
15
|
+
"@langchain/langgraph-ui": "~0.0.56",
|
|
15
16
|
"@langchain/langgraph-checkpoint": "~0.0.18",
|
|
16
|
-
"@langchain/langgraph-ui": "~0.0.38",
|
|
17
17
|
"@types/json-schema": "^7.0.15",
|
|
18
18
|
"@typescript/vfs": "^1.6.0",
|
|
19
19
|
"dedent": "^1.5.3",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"uuid": "^10.0.0",
|
|
28
28
|
"vite": "^6.1.6",
|
|
29
29
|
"winston": "^3.17.0",
|
|
30
|
-
"zod": "^3.
|
|
30
|
+
"zod": "^3.25.32"
|
|
31
31
|
},
|
|
32
32
|
"resolutions": {
|
|
33
33
|
"esbuild": "^0.25.0",
|
|
34
34
|
"vite": "^6.1.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@langchain/langgraph-sdk": "^0.0.
|
|
37
|
+
"@langchain/langgraph-sdk": "^0.0.104",
|
|
38
38
|
"@types/node": "^22.2.0",
|
|
39
39
|
"@types/react": "^19.0.8",
|
|
40
40
|
"@types/react-dom": "^19.0.3",
|
langgraph_api/js/yarn.lock
CHANGED
|
@@ -185,40 +185,40 @@
|
|
|
185
185
|
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a"
|
|
186
186
|
integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==
|
|
187
187
|
|
|
188
|
-
"@langchain/core@^0.3.
|
|
189
|
-
version "0.3.
|
|
190
|
-
resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.3.
|
|
191
|
-
integrity sha512-
|
|
188
|
+
"@langchain/core@^0.3.59":
|
|
189
|
+
version "0.3.66"
|
|
190
|
+
resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.3.66.tgz#cd20687f29a07148436cd8b72b88c66d076c500c"
|
|
191
|
+
integrity sha512-d3SgSDOlgOjdIbReIXVQl9HaQzKqO/5+E+o3kJwoKXLGP9dxi7+lMyaII7yv7G8/aUxMWLwFES9zc1jFoeJEZw==
|
|
192
192
|
dependencies:
|
|
193
193
|
"@cfworker/json-schema" "^4.0.2"
|
|
194
194
|
ansi-styles "^5.0.0"
|
|
195
195
|
camelcase "6"
|
|
196
196
|
decamelize "1.2.0"
|
|
197
197
|
js-tiktoken "^1.0.12"
|
|
198
|
-
langsmith "
|
|
198
|
+
langsmith "^0.3.46"
|
|
199
199
|
mustache "^4.2.0"
|
|
200
200
|
p-queue "^6.6.2"
|
|
201
201
|
p-retry "4"
|
|
202
202
|
uuid "^10.0.0"
|
|
203
|
-
zod "^3.
|
|
203
|
+
zod "^3.25.32"
|
|
204
204
|
zod-to-json-schema "^3.22.3"
|
|
205
205
|
|
|
206
|
-
"@langchain/langgraph-api@~0.0.
|
|
207
|
-
version "0.0.
|
|
208
|
-
resolved "https://registry.yarnpkg.com/@langchain/langgraph-api/-/langgraph-api-0.0.
|
|
209
|
-
integrity sha512-
|
|
206
|
+
"@langchain/langgraph-api@~0.0.56":
|
|
207
|
+
version "0.0.56"
|
|
208
|
+
resolved "https://registry.yarnpkg.com/@langchain/langgraph-api/-/langgraph-api-0.0.56.tgz#9e0a6e5dd9af2f6ec259a32ca9081b19457a0825"
|
|
209
|
+
integrity sha512-BhrbMKSc3f4CXXDXgvHR8mE2bsgD/G6dDzr+yDkEC7a9eeFI7C8bPhkGmegFJ+q7i6GWtqlQOYSCWHqQFZxynQ==
|
|
210
210
|
dependencies:
|
|
211
211
|
"@babel/code-frame" "^7.26.2"
|
|
212
212
|
"@hono/node-server" "^1.12.0"
|
|
213
213
|
"@hono/zod-validator" "^0.2.2"
|
|
214
|
-
"@langchain/langgraph-ui" "0.0.
|
|
214
|
+
"@langchain/langgraph-ui" "0.0.56"
|
|
215
215
|
"@types/json-schema" "^7.0.15"
|
|
216
216
|
"@typescript/vfs" "^1.6.0"
|
|
217
217
|
dedent "^1.5.3"
|
|
218
218
|
dotenv "^16.4.7"
|
|
219
219
|
exit-hook "^4.0.0"
|
|
220
220
|
hono "^4.5.4"
|
|
221
|
-
langsmith "^0.
|
|
221
|
+
langsmith "^0.3.33"
|
|
222
222
|
open "^10.1.0"
|
|
223
223
|
semver "^7.7.1"
|
|
224
224
|
stacktrace-parser "^0.1.10"
|
|
@@ -236,10 +236,10 @@
|
|
|
236
236
|
dependencies:
|
|
237
237
|
uuid "^10.0.0"
|
|
238
238
|
|
|
239
|
-
"@langchain/langgraph-sdk@^0.0.
|
|
240
|
-
version "0.0.
|
|
241
|
-
resolved "https://registry.yarnpkg.com/@langchain/langgraph-sdk/-/langgraph-sdk-0.0.
|
|
242
|
-
integrity sha512-
|
|
239
|
+
"@langchain/langgraph-sdk@^0.0.104":
|
|
240
|
+
version "0.0.104"
|
|
241
|
+
resolved "https://registry.yarnpkg.com/@langchain/langgraph-sdk/-/langgraph-sdk-0.0.104.tgz#1a7c4a56442f13094e288b068de1767de8f99d06"
|
|
242
|
+
integrity sha512-wUO6GMy65Y7DsWtjTJ3dA59enrZy2wN4o48AMYN7dF7u/PMXXYyBjBCKSzgVWqO6uWH2yNpyGDrcMwKuk5kQLA==
|
|
243
243
|
dependencies:
|
|
244
244
|
"@types/json-schema" "^7.0.15"
|
|
245
245
|
p-queue "^6.6.2"
|
|
@@ -256,10 +256,10 @@
|
|
|
256
256
|
p-retry "4"
|
|
257
257
|
uuid "^9.0.0"
|
|
258
258
|
|
|
259
|
-
"@langchain/langgraph-ui@0.0.
|
|
260
|
-
version "0.0.
|
|
261
|
-
resolved "https://registry.yarnpkg.com/@langchain/langgraph-ui/-/langgraph-ui-0.0.
|
|
262
|
-
integrity sha512-
|
|
259
|
+
"@langchain/langgraph-ui@0.0.56", "@langchain/langgraph-ui@~0.0.56":
|
|
260
|
+
version "0.0.56"
|
|
261
|
+
resolved "https://registry.yarnpkg.com/@langchain/langgraph-ui/-/langgraph-ui-0.0.56.tgz#b566afa4ad940fc6bd942205a00b3afac7fd7363"
|
|
262
|
+
integrity sha512-cRU+fMCz1NAOjRLcreNa64Gap89yio0p8baRigehtL1SNsXJEaZ2xdGjbnjaWIl8rTrriDak4oisx07whwcBjQ==
|
|
263
263
|
dependencies:
|
|
264
264
|
"@commander-js/extra-typings" "^13.0.0"
|
|
265
265
|
commander "^13.0.0"
|
|
@@ -738,11 +738,6 @@ colorspace@1.1.x:
|
|
|
738
738
|
color "^3.1.3"
|
|
739
739
|
text-hex "1.0.x"
|
|
740
740
|
|
|
741
|
-
commander@^10.0.1:
|
|
742
|
-
version "10.0.1"
|
|
743
|
-
resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06"
|
|
744
|
-
integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==
|
|
745
|
-
|
|
746
741
|
commander@^13.0.0:
|
|
747
742
|
version "13.1.0"
|
|
748
743
|
resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46"
|
|
@@ -1060,10 +1055,10 @@ kuler@^2.0.0:
|
|
|
1060
1055
|
resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3"
|
|
1061
1056
|
integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==
|
|
1062
1057
|
|
|
1063
|
-
|
|
1064
|
-
version "0.3.
|
|
1065
|
-
resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.3.
|
|
1066
|
-
integrity sha512-
|
|
1058
|
+
langsmith@^0.3.33, langsmith@^0.3.46:
|
|
1059
|
+
version "0.3.48"
|
|
1060
|
+
resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.3.48.tgz#32cdbe5e7e5ca73866ed3a38a654468bac034155"
|
|
1061
|
+
integrity sha512-oEsj0Z8S2Chgb3vJzRX2vplLu4RWR1cpraIaVwv2PsNZ57VbHgZEdXdeh5kh16iP8PAv04JkBncP+KLRoKBFEw==
|
|
1067
1062
|
dependencies:
|
|
1068
1063
|
"@types/uuid" "^10.0.0"
|
|
1069
1064
|
chalk "^4.1.2"
|
|
@@ -1073,18 +1068,6 @@ kuler@^2.0.0:
|
|
|
1073
1068
|
semver "^7.6.3"
|
|
1074
1069
|
uuid "^10.0.0"
|
|
1075
1070
|
|
|
1076
|
-
langsmith@^0.2.15:
|
|
1077
|
-
version "0.2.15"
|
|
1078
|
-
resolved "https://registry.yarnpkg.com/langsmith/-/langsmith-0.2.15.tgz#0692a00fc310817cb9b5939488468c93d4ba2c9d"
|
|
1079
|
-
integrity sha512-homtJU41iitqIZVuuLW7iarCzD4f39KcfP9RTBWav9jifhrsDa1Ez89Ejr+4qi72iuBu8Y5xykchsGVgiEZ93w==
|
|
1080
|
-
dependencies:
|
|
1081
|
-
"@types/uuid" "^10.0.0"
|
|
1082
|
-
commander "^10.0.1"
|
|
1083
|
-
p-queue "^6.6.2"
|
|
1084
|
-
p-retry "4"
|
|
1085
|
-
semver "^7.6.3"
|
|
1086
|
-
uuid "^10.0.0"
|
|
1087
|
-
|
|
1088
1071
|
lightningcss-darwin-arm64@1.29.2:
|
|
1089
1072
|
version "1.29.2"
|
|
1090
1073
|
resolved "https://registry.yarnpkg.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.29.2.tgz#6ceff38b01134af48e859394e1ca21e5d49faae6"
|
|
@@ -1743,7 +1726,7 @@ zod-to-json-schema@^3.22.3:
|
|
|
1743
1726
|
resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.23.5.tgz#ec23def47dcafe3a4d640eba6a346b34f9a693a5"
|
|
1744
1727
|
integrity sha512-5wlSS0bXfF/BrL4jPAbz9da5hDlDptdEppYfe+x4eIJ7jioqKG9uUxOwPzqof09u/XeVdrgFu29lZi+8XNDJtA==
|
|
1745
1728
|
|
|
1746
|
-
zod@^3.
|
|
1747
|
-
version "3.
|
|
1748
|
-
resolved "https://registry.yarnpkg.com/zod/-/zod-3.
|
|
1749
|
-
integrity sha512-
|
|
1729
|
+
zod@^3.23.8, zod@^3.25.32:
|
|
1730
|
+
version "3.25.76"
|
|
1731
|
+
resolved "https://registry.yarnpkg.com/zod/-/zod-3.25.76.tgz#26841c3f6fd22a6a2760e7ccb719179768471e34"
|
|
1732
|
+
integrity sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==
|
langgraph_api/schema.py
CHANGED
|
@@ -14,7 +14,9 @@ RunStatus = Literal["pending", "running", "error", "success", "timeout", "interr
|
|
|
14
14
|
|
|
15
15
|
ThreadStatus = Literal["idle", "busy", "interrupted", "error"]
|
|
16
16
|
|
|
17
|
-
StreamMode = Literal[
|
|
17
|
+
StreamMode = Literal[
|
|
18
|
+
"values", "messages", "updates", "events", "debug", "tasks", "checkpoints", "custom"
|
|
19
|
+
]
|
|
18
20
|
|
|
19
21
|
MultitaskStrategy = Literal["reject", "rollback", "interrupt", "enqueue"]
|
|
20
22
|
|
langgraph_api/stream.py
CHANGED
|
@@ -229,16 +229,25 @@ async def astream_state(
|
|
|
229
229
|
),
|
|
230
230
|
[message_chunk_to_message(messages[msg.id])],
|
|
231
231
|
)
|
|
232
|
-
elif mode in stream_mode
|
|
232
|
+
elif mode in stream_mode:
|
|
233
|
+
if subgraphs and ns:
|
|
234
|
+
yield f"{mode}|{'|'.join(ns)}", chunk
|
|
235
|
+
else:
|
|
236
|
+
yield mode, chunk
|
|
237
|
+
elif (
|
|
233
238
|
mode == "updates"
|
|
234
239
|
and isinstance(chunk, dict)
|
|
235
240
|
and "__interrupt__" in chunk
|
|
241
|
+
and len(chunk["__interrupt__"]) > 0
|
|
236
242
|
and only_interrupt_updates
|
|
237
243
|
):
|
|
244
|
+
# We always want to return interrupt events by default.
|
|
245
|
+
# If updates aren't specified as a stream mode, we return these as values events.
|
|
246
|
+
# If the interrupt doesn't have any actions (e.g. interrupt before or after a node is specified), we don't return the interrupt at all today.
|
|
238
247
|
if subgraphs and ns:
|
|
239
|
-
yield f"
|
|
248
|
+
yield f"values|{'|'.join(ns)}", chunk
|
|
240
249
|
else:
|
|
241
|
-
yield
|
|
250
|
+
yield "values", chunk
|
|
242
251
|
# --- end shared logic with astream ---
|
|
243
252
|
elif "events" in stream_mode:
|
|
244
253
|
yield "events", event
|
|
@@ -300,16 +309,25 @@ async def astream_state(
|
|
|
300
309
|
),
|
|
301
310
|
[message_chunk_to_message(messages[msg.id])],
|
|
302
311
|
)
|
|
303
|
-
elif mode in stream_mode
|
|
312
|
+
elif mode in stream_mode:
|
|
313
|
+
if subgraphs and ns:
|
|
314
|
+
yield f"{mode}|{'|'.join(ns)}", chunk
|
|
315
|
+
else:
|
|
316
|
+
yield mode, chunk
|
|
317
|
+
elif (
|
|
304
318
|
mode == "updates"
|
|
305
319
|
and isinstance(chunk, dict)
|
|
306
320
|
and "__interrupt__" in chunk
|
|
321
|
+
and len(chunk["__interrupt__"]) > 0
|
|
307
322
|
and only_interrupt_updates
|
|
308
323
|
):
|
|
324
|
+
# We always want to return interrupt events by default.
|
|
325
|
+
# If updates aren't specified as a stream mode, we return these as values events.
|
|
326
|
+
# If the interrupt doesn't have any actions (e.g. interrupt before or after a node is specified), we don't return the interrupt at all today.
|
|
309
327
|
if subgraphs and ns:
|
|
310
|
-
yield
|
|
328
|
+
yield "values|{'|'.join(ns)}", chunk
|
|
311
329
|
else:
|
|
312
|
-
yield
|
|
330
|
+
yield "values", chunk
|
|
313
331
|
# --- end shared logic with astream_events ---
|
|
314
332
|
if is_remote_pregel:
|
|
315
333
|
# increment the remote runs
|
langgraph_api/thread_ttl.py
CHANGED
|
@@ -29,6 +29,7 @@ async def thread_ttl_sweep_loop():
|
|
|
29
29
|
strategy=strategy,
|
|
30
30
|
interval_minutes=sweep_interval_minutes,
|
|
31
31
|
)
|
|
32
|
+
loop = asyncio.get_running_loop()
|
|
32
33
|
|
|
33
34
|
from langgraph_runtime.ops import Threads
|
|
34
35
|
|
|
@@ -36,12 +37,14 @@ async def thread_ttl_sweep_loop():
|
|
|
36
37
|
await asyncio.sleep(sweep_interval_minutes * 60)
|
|
37
38
|
try:
|
|
38
39
|
async with connect() as conn:
|
|
40
|
+
sweep_start = loop.time()
|
|
39
41
|
threads_processed, threads_deleted = await Threads.sweep_ttl(conn)
|
|
40
42
|
if threads_processed > 0:
|
|
41
43
|
await logger.ainfo(
|
|
42
44
|
f"Thread TTL sweep completed. Processed {threads_processed}",
|
|
43
45
|
threads_processed=threads_processed,
|
|
44
46
|
threads_deleted=threads_deleted,
|
|
47
|
+
duration=loop.time() - sweep_start,
|
|
45
48
|
)
|
|
46
49
|
except Exception as exc:
|
|
47
50
|
logger.exception("Thread TTL sweep iteration failed", exc_info=exc)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
langgraph_api/__init__.py,sha256=
|
|
1
|
+
langgraph_api/__init__.py,sha256=NPbiQUuQv5qG-lMY2A17R8G0t9UC2DCgiLLTdyVo0pk,24
|
|
2
2
|
langgraph_api/asgi_transport.py,sha256=eqifhHxNnxvI7jJqrY1_8RjL4Fp9NdN4prEub2FWBt8,5091
|
|
3
3
|
langgraph_api/asyncio.py,sha256=Wv4Rwm-a-Cf6JpfgJmVuVlXQ7SlwrjbTn0eq1ux8I2Q,9652
|
|
4
4
|
langgraph_api/cli.py,sha256=xQojITwmmKSJw48Lr2regcnRPRq2FJqWlPpeyr5TgbU,16158
|
|
@@ -15,14 +15,14 @@ langgraph_api/metadata.py,sha256=fVsbwxVitAj4LGVYpCcadYeIFANEaNtcx6LBxQLcTqg,694
|
|
|
15
15
|
langgraph_api/patch.py,sha256=Dgs0PXHytekX4SUL6KsjjN0hHcOtGLvv1GRGbh6PswU,1408
|
|
16
16
|
langgraph_api/queue_entrypoint.py,sha256=hC8j-A4cUxibusiiPJBlK0mkmChNZxNcXn5GVwL0yic,4889
|
|
17
17
|
langgraph_api/route.py,sha256=4VBkJMeusfiZtLzyUaKm1HwLHTq0g15y2CRiRhM6xyA,4773
|
|
18
|
-
langgraph_api/schema.py,sha256=
|
|
18
|
+
langgraph_api/schema.py,sha256=1L7g4TUJjmsaBUCSThycH11-hrdPLxB6mtc3tIHmpbM,6371
|
|
19
19
|
langgraph_api/serde.py,sha256=0ALETUn582vNF-m0l_WOZGF_scL1VPA39fDkwMJQPrg,5187
|
|
20
20
|
langgraph_api/server.py,sha256=KBnMFt3f9RVLVu_NqyeRc13D_Lq62Rk_2czZKEUMU5E,6994
|
|
21
21
|
langgraph_api/sse.py,sha256=SLdtZmTdh5D8fbWrQjuY9HYLd2dg8Rmi6ZMmFMVc2iE,4204
|
|
22
22
|
langgraph_api/state.py,sha256=P2mCo-0bqPu2v9FSFGJtUCjPPNvv6wLUKQh8SdxAtc8,4387
|
|
23
23
|
langgraph_api/store.py,sha256=srRI0fQXNFo_RSUs4apucr4BEp_KrIseJksZXs32MlQ,4635
|
|
24
|
-
langgraph_api/stream.py,sha256=
|
|
25
|
-
langgraph_api/thread_ttl.py,sha256
|
|
24
|
+
langgraph_api/stream.py,sha256=lMfb-tjhXtho6OSA1NrVvIQO30FpaNkBJysKHtWEO-o,15616
|
|
25
|
+
langgraph_api/thread_ttl.py,sha256=7H3gFlWcUiODPoaEzcwB0LR61uvcuyjD0ew_4BztB7k,1902
|
|
26
26
|
langgraph_api/traceblock.py,sha256=2aWS6TKGTcQ0G1fOtnjVrzkpeGvDsR0spDbfddEqgRU,594
|
|
27
27
|
langgraph_api/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
langgraph_api/validation.py,sha256=zMuKmwUEBjBgFMwAaeLZmatwGVijKv2sOYtYg7gfRtc,4950
|
|
@@ -33,10 +33,10 @@ langgraph_api/api/assistants.py,sha256=ecHaID71ReTAZF4qsJzDe5L-2T5iOL2v8p6kQVHLK
|
|
|
33
33
|
langgraph_api/api/mcp.py,sha256=qe10ZRMN3f-Hli-9TI8nbQyWvMeBb72YB1PZVbyqBQw,14418
|
|
34
34
|
langgraph_api/api/meta.py,sha256=fmc7btbtl5KVlU_vQ3Bj4J861IjlqmjBKNtnxSV-S-Q,4198
|
|
35
35
|
langgraph_api/api/openapi.py,sha256=KToI2glOEsvrhDpwdScdBnL9xoLOqkTxx5zKq2pMuKQ,11957
|
|
36
|
-
langgraph_api/api/runs.py,sha256=
|
|
36
|
+
langgraph_api/api/runs.py,sha256=kV2TpqBpjzvS_9DOHK0jDVtqCRJV_i5G6-XZHeMoA_E,20890
|
|
37
37
|
langgraph_api/api/store.py,sha256=TSeMiuMfrifmEnEbL0aObC2DPeseLlmZvAMaMzPgG3Y,5535
|
|
38
|
-
langgraph_api/api/threads.py,sha256=
|
|
39
|
-
langgraph_api/api/ui.py,sha256=
|
|
38
|
+
langgraph_api/api/threads.py,sha256=Cpw1LIWRAF3YBq65OMVXNu9K86WCITaJ5fGWZlzmnUE,9724
|
|
39
|
+
langgraph_api/api/ui.py,sha256=SPnOxILvbINzp5ObUFaPXCpZeC6Aicqsr3WnW7rLggw,2568
|
|
40
40
|
langgraph_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
41
|
langgraph_api/auth/custom.py,sha256=ZtNSQ4hIldbd2HvRsilwKzN_hjCWIiIOHClmYyPi8FM,22206
|
|
42
42
|
langgraph_api/auth/middleware.py,sha256=jDA4t41DUoAArEY_PNoXesIUBJ0nGhh85QzRdn5EPD0,1916
|
|
@@ -51,17 +51,17 @@ langgraph_api/js/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
51
51
|
langgraph_api/js/base.py,sha256=GORqRDbGAOQX2ygT6dMcqBDCA9tdAp8EpG4bfqUPMg4,1198
|
|
52
52
|
langgraph_api/js/build.mts,sha256=bRQo11cglDFXlLN7Y48CQPTSMLenp7MqIWuP1DkSIo0,3139
|
|
53
53
|
langgraph_api/js/client.http.mts,sha256=AGA-p8J85IcNh2oXZjDxHQ4PnQdJmt-LPcpZp6j0Cws,4687
|
|
54
|
-
langgraph_api/js/client.mts,sha256=
|
|
54
|
+
langgraph_api/js/client.mts,sha256=egwta8-jqZRPInAlkphsQGGAObF3R8zKChaKoSTqKYk,32102
|
|
55
55
|
langgraph_api/js/errors.py,sha256=Cm1TKWlUCwZReDC5AQ6SgNIVGD27Qov2xcgHyf8-GXo,361
|
|
56
56
|
langgraph_api/js/global.d.ts,sha256=j4GhgtQSZ5_cHzjSPcHgMJ8tfBThxrH-pUOrrJGteOU,196
|
|
57
|
-
langgraph_api/js/package.json,sha256=
|
|
57
|
+
langgraph_api/js/package.json,sha256=93_RZHDEggtEUJ-DburVd5D9Y9ceD_5mSc23go1BfPw,1335
|
|
58
58
|
langgraph_api/js/remote.py,sha256=iMsdDsixqWDCASMkaxVTK4S1XB9cXgwAIF9XaNYl9EY,38000
|
|
59
59
|
langgraph_api/js/schema.py,sha256=M4fLtr50O1jck8H1hm_0W4cZOGYGdkrB7riLyCes4oY,438
|
|
60
60
|
langgraph_api/js/sse.py,sha256=lsfp4nyJyA1COmlKG9e2gJnTttf_HGCB5wyH8OZBER8,4105
|
|
61
61
|
langgraph_api/js/traceblock.mts,sha256=QtGSN5VpzmGqDfbArrGXkMiONY94pMQ5CgzetT_bKYg,761
|
|
62
62
|
langgraph_api/js/tsconfig.json,sha256=imCYqVnqFpaBoZPx8k1nO4slHIWBFsSlmCYhO73cpBs,341
|
|
63
63
|
langgraph_api/js/ui.py,sha256=XNT8iBcyT8XmbIqSQUWd-j_00HsaWB2vRTVabwFBkik,2439
|
|
64
|
-
langgraph_api/js/yarn.lock,sha256=
|
|
64
|
+
langgraph_api/js/yarn.lock,sha256=6OAHOACcieOA-r_nSh26qpGLuJaWvqXiZBcRkvkUtsU,84904
|
|
65
65
|
langgraph_api/js/src/graph.mts,sha256=9zTQNdtanI_CFnOwNRoamoCVHHQHGbNlbm91aRxDeOc,2675
|
|
66
66
|
langgraph_api/js/src/load.hooks.mjs,sha256=xNVHq75W0Lk6MUKl1pQYrx-wtQ8_neiUyI6SO-k0ecM,2235
|
|
67
67
|
langgraph_api/js/src/preload.mjs,sha256=ORV7xwMuZcXWL6jQxNAcCYp8GZVYIvVJbUhmle8jbno,759
|
|
@@ -93,9 +93,9 @@ langgraph_runtime/retry.py,sha256=V0duD01fO7GUQ_btQkp1aoXcEOFhXooGVP6q4yMfuyY,11
|
|
|
93
93
|
langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,114
|
|
94
94
|
LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
95
95
|
logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
|
|
96
|
-
openapi.json,sha256=
|
|
97
|
-
langgraph_api-0.2.
|
|
98
|
-
langgraph_api-0.2.
|
|
99
|
-
langgraph_api-0.2.
|
|
100
|
-
langgraph_api-0.2.
|
|
101
|
-
langgraph_api-0.2.
|
|
96
|
+
openapi.json,sha256=SPCrzYpta2xTl-WE2W6qwosYdQqLeB8qpzaYEbcK44k,150725
|
|
97
|
+
langgraph_api-0.2.120.dist-info/METADATA,sha256=U7soH68I42TpDdER1bIfUXBv9ylPIDdk0IYxLx_iYIE,3890
|
|
98
|
+
langgraph_api-0.2.120.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
99
|
+
langgraph_api-0.2.120.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
|
|
100
|
+
langgraph_api-0.2.120.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
101
|
+
langgraph_api-0.2.120.dist-info/RECORD,,
|
openapi.json
CHANGED
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
{
|
|
29
29
|
"name": "Store",
|
|
30
30
|
"description": "Store is an API for managing persistent key-value store (long-term memory) that is available from any thread."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "MCP",
|
|
34
|
+
"description": "Model Context Protocol related endpoints for exposing an agent as an MCP server."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "System",
|
|
38
|
+
"description": "System endpoints for health checks, metrics, and server information."
|
|
31
39
|
}
|
|
32
40
|
],
|
|
33
41
|
"paths": {
|
|
@@ -2996,6 +3004,153 @@
|
|
|
2996
3004
|
"MCP"
|
|
2997
3005
|
]
|
|
2998
3006
|
}
|
|
3007
|
+
},
|
|
3008
|
+
"/info": {
|
|
3009
|
+
"get": {
|
|
3010
|
+
"tags": [
|
|
3011
|
+
"System"
|
|
3012
|
+
],
|
|
3013
|
+
"summary": "Server Information",
|
|
3014
|
+
"description": "Get server version information, feature flags, and metadata.",
|
|
3015
|
+
"operationId": "server_info_info_get",
|
|
3016
|
+
"responses": {
|
|
3017
|
+
"200": {
|
|
3018
|
+
"description": "Success",
|
|
3019
|
+
"content": {
|
|
3020
|
+
"application/json": {
|
|
3021
|
+
"schema": {
|
|
3022
|
+
"type": "object",
|
|
3023
|
+
"properties": {
|
|
3024
|
+
"version": {
|
|
3025
|
+
"type": "string",
|
|
3026
|
+
"title": "Version",
|
|
3027
|
+
"description": "LangGraph API version"
|
|
3028
|
+
},
|
|
3029
|
+
"langgraph_py_version": {
|
|
3030
|
+
"type": "string",
|
|
3031
|
+
"title": "LangGraph Python Version",
|
|
3032
|
+
"description": "LangGraph Python library version"
|
|
3033
|
+
},
|
|
3034
|
+
"flags": {
|
|
3035
|
+
"type": "object",
|
|
3036
|
+
"title": "Feature Flags",
|
|
3037
|
+
"description": "Enabled features and capabilities"
|
|
3038
|
+
},
|
|
3039
|
+
"metadata": {
|
|
3040
|
+
"type": "object",
|
|
3041
|
+
"title": "Metadata",
|
|
3042
|
+
"description": "Server deployment metadata"
|
|
3043
|
+
}
|
|
3044
|
+
},
|
|
3045
|
+
"required": ["version", "langgraph_py_version", "flags", "metadata"],
|
|
3046
|
+
"title": "ServerInfo"
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
},
|
|
3054
|
+
"/metrics": {
|
|
3055
|
+
"get": {
|
|
3056
|
+
"tags": [
|
|
3057
|
+
"System"
|
|
3058
|
+
],
|
|
3059
|
+
"summary": "System Metrics",
|
|
3060
|
+
"description": "Get system metrics in Prometheus or JSON format for monitoring and observability.",
|
|
3061
|
+
"operationId": "system_metrics_metrics_get",
|
|
3062
|
+
"parameters": [
|
|
3063
|
+
{
|
|
3064
|
+
"name": "format",
|
|
3065
|
+
"in": "query",
|
|
3066
|
+
"required": false,
|
|
3067
|
+
"schema": {
|
|
3068
|
+
"type": "string",
|
|
3069
|
+
"enum": ["prometheus", "json"],
|
|
3070
|
+
"default": "prometheus",
|
|
3071
|
+
"title": "Output Format",
|
|
3072
|
+
"description": "Response format: prometheus (default) or json"
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
],
|
|
3076
|
+
"responses": {
|
|
3077
|
+
"200": {
|
|
3078
|
+
"description": "Success",
|
|
3079
|
+
"content": {
|
|
3080
|
+
"text/plain": {
|
|
3081
|
+
"schema": {
|
|
3082
|
+
"type": "string",
|
|
3083
|
+
"title": "Prometheus Metrics",
|
|
3084
|
+
"description": "Metrics in Prometheus exposition format"
|
|
3085
|
+
}
|
|
3086
|
+
},
|
|
3087
|
+
"application/json": {
|
|
3088
|
+
"schema": {
|
|
3089
|
+
"type": "object",
|
|
3090
|
+
"title": "JSON Metrics",
|
|
3091
|
+
"description": "Metrics in JSON format including queue stats, worker stats, and HTTP metrics"
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
},
|
|
3099
|
+
"/ok": {
|
|
3100
|
+
"get": {
|
|
3101
|
+
"tags": [
|
|
3102
|
+
"System"
|
|
3103
|
+
],
|
|
3104
|
+
"summary": "Health Check",
|
|
3105
|
+
"description": "Check the health status of the server. Optionally check database connectivity.",
|
|
3106
|
+
"operationId": "health_check_ok_get",
|
|
3107
|
+
"parameters": [
|
|
3108
|
+
{
|
|
3109
|
+
"name": "check_db",
|
|
3110
|
+
"in": "query",
|
|
3111
|
+
"required": false,
|
|
3112
|
+
"schema": {
|
|
3113
|
+
"type": "integer",
|
|
3114
|
+
"enum": [0, 1],
|
|
3115
|
+
"default": 0,
|
|
3116
|
+
"title": "Check Database",
|
|
3117
|
+
"description": "Whether to check database connectivity (0=false, 1=true)"
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
],
|
|
3121
|
+
"responses": {
|
|
3122
|
+
"200": {
|
|
3123
|
+
"description": "Success",
|
|
3124
|
+
"content": {
|
|
3125
|
+
"application/json": {
|
|
3126
|
+
"schema": {
|
|
3127
|
+
"type": "object",
|
|
3128
|
+
"properties": {
|
|
3129
|
+
"ok": {
|
|
3130
|
+
"type": "boolean",
|
|
3131
|
+
"const": true,
|
|
3132
|
+
"title": "OK",
|
|
3133
|
+
"description": "Indicates the server is healthy"
|
|
3134
|
+
}
|
|
3135
|
+
},
|
|
3136
|
+
"required": ["ok"],
|
|
3137
|
+
"title": "HealthResponse"
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
},
|
|
3142
|
+
"500": {
|
|
3143
|
+
"description": "Internal Server Error",
|
|
3144
|
+
"content": {
|
|
3145
|
+
"application/json": {
|
|
3146
|
+
"schema": {
|
|
3147
|
+
"$ref": "#/components/schemas/ErrorResponse"
|
|
3148
|
+
}
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
2999
3154
|
}
|
|
3000
3155
|
},
|
|
3001
3156
|
"components": {
|
|
@@ -3852,6 +4007,8 @@
|
|
|
3852
4007
|
"values",
|
|
3853
4008
|
"messages",
|
|
3854
4009
|
"messages-tuple",
|
|
4010
|
+
"tasks",
|
|
4011
|
+
"checkpoints",
|
|
3855
4012
|
"updates",
|
|
3856
4013
|
"events",
|
|
3857
4014
|
"debug",
|
|
@@ -3866,6 +4023,8 @@
|
|
|
3866
4023
|
"values",
|
|
3867
4024
|
"messages",
|
|
3868
4025
|
"messages-tuple",
|
|
4026
|
+
"tasks",
|
|
4027
|
+
"checkpoints",
|
|
3869
4028
|
"updates",
|
|
3870
4029
|
"events",
|
|
3871
4030
|
"debug",
|
|
@@ -4096,6 +4255,8 @@
|
|
|
4096
4255
|
"values",
|
|
4097
4256
|
"messages",
|
|
4098
4257
|
"messages-tuple",
|
|
4258
|
+
"tasks",
|
|
4259
|
+
"checkpoints",
|
|
4099
4260
|
"updates",
|
|
4100
4261
|
"events",
|
|
4101
4262
|
"debug",
|
|
@@ -4110,6 +4271,8 @@
|
|
|
4110
4271
|
"values",
|
|
4111
4272
|
"messages",
|
|
4112
4273
|
"messages-tuple",
|
|
4274
|
+
"tasks",
|
|
4275
|
+
"checkpoints",
|
|
4113
4276
|
"updates",
|
|
4114
4277
|
"events",
|
|
4115
4278
|
"debug",
|
|
@@ -4583,7 +4746,7 @@
|
|
|
4583
4746
|
"type": "integer",
|
|
4584
4747
|
"title": "Limit",
|
|
4585
4748
|
"description": "The maximum number of states to return.",
|
|
4586
|
-
"default":
|
|
4749
|
+
"default": 1,
|
|
4587
4750
|
"maximum": 1000,
|
|
4588
4751
|
"minimum": 1
|
|
4589
4752
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|