langgraph-api 0.4.20__py3-none-any.whl → 0.4.22__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/a2a.py +395 -24
- langgraph_api/api/assistants.py +4 -4
- langgraph_api/api/runs.py +181 -117
- langgraph_api/cli.py +139 -42
- langgraph_api/command.py +1 -1
- langgraph_api/js/package.json +1 -1
- langgraph_api/js/remote.py +1 -1
- langgraph_api/js/yarn.lock +4 -4
- langgraph_api/metadata.py +37 -0
- langgraph_api/models/run.py +1 -1
- langgraph_api/patch.py +3 -1
- langgraph_api/serde.py +2 -1
- langgraph_api/server.py +4 -2
- langgraph_api/stream.py +46 -13
- {langgraph_api-0.4.20.dist-info → langgraph_api-0.4.22.dist-info}/METADATA +2 -2
- {langgraph_api-0.4.20.dist-info → langgraph_api-0.4.22.dist-info}/RECORD +20 -20
- {langgraph_api-0.4.20.dist-info → langgraph_api-0.4.22.dist-info}/WHEEL +0 -0
- {langgraph_api-0.4.20.dist-info → langgraph_api-0.4.22.dist-info}/entry_points.txt +0 -0
- {langgraph_api-0.4.20.dist-info → langgraph_api-0.4.22.dist-info}/licenses/LICENSE +0 -0
langgraph_api/models/run.py
CHANGED
langgraph_api/patch.py
CHANGED
|
@@ -3,7 +3,7 @@ from typing import Any
|
|
|
3
3
|
from starlette.responses import Response, StreamingResponse
|
|
4
4
|
from starlette.types import Send
|
|
5
5
|
|
|
6
|
-
from langgraph_api.serde import Fragment
|
|
6
|
+
from langgraph_api.serde import Fragment, json_dumpb
|
|
7
7
|
|
|
8
8
|
"""
|
|
9
9
|
Patch Response.render and StreamingResponse.stream_response
|
|
@@ -32,6 +32,8 @@ async def StreamingResponse_stream_response(self, send: Send) -> None:
|
|
|
32
32
|
continue
|
|
33
33
|
if isinstance(chunk, Fragment):
|
|
34
34
|
chunk = chunk.buf
|
|
35
|
+
if isinstance(chunk, dict):
|
|
36
|
+
chunk = json_dumpb(chunk)
|
|
35
37
|
if not isinstance(chunk, (bytes, bytearray, memoryview)): # noqa: UP038
|
|
36
38
|
chunk = chunk.encode(self.charset)
|
|
37
39
|
await send({"type": "http.response.body", "body": chunk, "more_body": True})
|
langgraph_api/serde.py
CHANGED
|
@@ -149,9 +149,10 @@ def json_loads(content: bytes | Fragment | dict) -> Any:
|
|
|
149
149
|
content = content.buf
|
|
150
150
|
if isinstance(content, dict):
|
|
151
151
|
return content
|
|
152
|
-
return orjson.loads(
|
|
152
|
+
return orjson.loads(content)
|
|
153
153
|
|
|
154
154
|
|
|
155
|
+
# Do not use. orjson holds the GIL the entire time it's running anyway.
|
|
155
156
|
async def ajson_loads(content: bytes | Fragment) -> Any:
|
|
156
157
|
return await asyncio.to_thread(json_loads, content)
|
|
157
158
|
|
langgraph_api/server.py
CHANGED
|
@@ -53,11 +53,13 @@ middleware = []
|
|
|
53
53
|
if config.ALLOW_PRIVATE_NETWORK:
|
|
54
54
|
middleware.append(Middleware(PrivateNetworkMiddleware))
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
JS_PROXY_MIDDLEWARE_ENABLED = (
|
|
57
57
|
config.HTTP_CONFIG
|
|
58
58
|
and (app := config.HTTP_CONFIG.get("app"))
|
|
59
59
|
and is_js_path(app.split(":")[0])
|
|
60
|
-
)
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if JS_PROXY_MIDDLEWARE_ENABLED:
|
|
61
63
|
from langgraph_api.js.remote import JSCustomHTTPProxyMiddleware
|
|
62
64
|
|
|
63
65
|
middleware.append(Middleware(JSCustomHTTPProxyMiddleware))
|
langgraph_api/stream.py
CHANGED
|
@@ -8,9 +8,11 @@ import langgraph.version
|
|
|
8
8
|
import langsmith
|
|
9
9
|
import structlog
|
|
10
10
|
from langchain_core.messages import (
|
|
11
|
+
AIMessageChunk,
|
|
11
12
|
# TODO: Remove explicit dependency
|
|
12
13
|
BaseMessage,
|
|
13
14
|
BaseMessageChunk,
|
|
15
|
+
ToolMessageChunk,
|
|
14
16
|
convert_to_messages,
|
|
15
17
|
message_chunk_to_message,
|
|
16
18
|
)
|
|
@@ -286,11 +288,23 @@ async def astream_state(
|
|
|
286
288
|
msg_, meta = cast(
|
|
287
289
|
tuple[BaseMessage | dict, dict[str, Any]], chunk
|
|
288
290
|
)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
is_chunk = False
|
|
292
|
+
if isinstance(msg_, dict):
|
|
293
|
+
if (
|
|
294
|
+
"chunk" in msg_.get("type", "").lower()
|
|
295
|
+
or "chunk" in msg_.get("role", "").lower()
|
|
296
|
+
):
|
|
297
|
+
if "ai" in msg_.get("role", "").lower():
|
|
298
|
+
msg = AIMessageChunk(**msg_) # type: ignore[arg-type]
|
|
299
|
+
elif "tool" in msg_.get("role", "").lower():
|
|
300
|
+
msg = ToolMessageChunk(**msg_) # type: ignore[arg-type]
|
|
301
|
+
else:
|
|
302
|
+
msg = BaseMessageChunk(**msg_) # type: ignore[arg-type]
|
|
303
|
+
is_chunk = True
|
|
304
|
+
else:
|
|
305
|
+
msg = convert_to_messages([msg_])[0]
|
|
306
|
+
else:
|
|
307
|
+
msg = msg_
|
|
294
308
|
if msg.id in messages:
|
|
295
309
|
messages[msg.id] += msg
|
|
296
310
|
else:
|
|
@@ -302,7 +316,11 @@ async def astream_state(
|
|
|
302
316
|
if isinstance(msg, BaseMessageChunk)
|
|
303
317
|
else "messages/complete"
|
|
304
318
|
),
|
|
305
|
-
[
|
|
319
|
+
[
|
|
320
|
+
message_chunk_to_message(messages[msg.id])
|
|
321
|
+
if not is_chunk
|
|
322
|
+
else messages[msg.id]
|
|
323
|
+
],
|
|
306
324
|
)
|
|
307
325
|
elif mode in stream_mode:
|
|
308
326
|
if subgraphs and ns:
|
|
@@ -370,12 +388,23 @@ async def astream_state(
|
|
|
370
388
|
msg_, meta = cast(
|
|
371
389
|
tuple[BaseMessage | dict, dict[str, Any]], chunk
|
|
372
390
|
)
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
391
|
+
is_chunk = False
|
|
392
|
+
if isinstance(msg_, dict):
|
|
393
|
+
if (
|
|
394
|
+
"chunk" in msg_.get("type", "").lower()
|
|
395
|
+
or "chunk" in msg_.get("role", "").lower()
|
|
396
|
+
):
|
|
397
|
+
if "ai" in msg_.get("role", "").lower():
|
|
398
|
+
msg = AIMessageChunk(**msg_) # type: ignore[arg-type]
|
|
399
|
+
elif "tool" in msg_.get("role", "").lower():
|
|
400
|
+
msg = ToolMessageChunk(**msg_) # type: ignore[arg-type]
|
|
401
|
+
else:
|
|
402
|
+
msg = BaseMessageChunk(**msg_) # type: ignore[arg-type]
|
|
403
|
+
is_chunk = True
|
|
404
|
+
else:
|
|
405
|
+
msg = convert_to_messages([msg_])[0]
|
|
406
|
+
else:
|
|
407
|
+
msg = msg_
|
|
379
408
|
if msg.id in messages:
|
|
380
409
|
messages[msg.id] += msg
|
|
381
410
|
else:
|
|
@@ -387,7 +416,11 @@ async def astream_state(
|
|
|
387
416
|
if isinstance(msg, BaseMessageChunk)
|
|
388
417
|
else "messages/complete"
|
|
389
418
|
),
|
|
390
|
-
[
|
|
419
|
+
[
|
|
420
|
+
message_chunk_to_message(messages[msg.id])
|
|
421
|
+
if not is_chunk
|
|
422
|
+
else messages[msg.id]
|
|
423
|
+
],
|
|
391
424
|
)
|
|
392
425
|
elif mode in stream_mode:
|
|
393
426
|
if subgraphs and ns:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langgraph-api
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.22
|
|
4
4
|
Author-email: Nuno Campos <nuno@langchain.dev>, Will Fu-Hinthorn <will@langchain.dev>
|
|
5
5
|
License: Elastic-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -11,7 +11,7 @@ Requires-Dist: httpx>=0.25.0
|
|
|
11
11
|
Requires-Dist: jsonschema-rs<0.30,>=0.20.0
|
|
12
12
|
Requires-Dist: langchain-core>=0.3.64
|
|
13
13
|
Requires-Dist: langgraph-checkpoint>=2.0.23
|
|
14
|
-
Requires-Dist: langgraph-runtime-inmem<0.
|
|
14
|
+
Requires-Dist: langgraph-runtime-inmem<0.14.0,>=0.13.0
|
|
15
15
|
Requires-Dist: langgraph-sdk>=0.2.0
|
|
16
16
|
Requires-Dist: langgraph>=0.4.0
|
|
17
17
|
Requires-Dist: langsmith>=0.3.45
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
langgraph_api/__init__.py,sha256=
|
|
1
|
+
langgraph_api/__init__.py,sha256=dTG-jzL6gT1bOj-aXPys00hnioYMNGLuF9EnbsEF7HI,23
|
|
2
2
|
langgraph_api/asgi_transport.py,sha256=XtiLOu4WWsd-xizagBLzT5xUkxc9ZG9YqwvETBPjBFE,5161
|
|
3
3
|
langgraph_api/asyncio.py,sha256=FEEkLm_N-15cbElo4vQ309MkDKBZuRqAYV8VJ1DocNw,9860
|
|
4
|
-
langgraph_api/cli.py,sha256
|
|
5
|
-
langgraph_api/command.py,sha256=
|
|
4
|
+
langgraph_api/cli.py,sha256=DrTkO5JSX6jpv-aFXZfRP5Fa9j121nvnrjDgQQzqlHs,19576
|
|
5
|
+
langgraph_api/command.py,sha256=Bh-rvuTLwdHCqFWryCjB1M8oWxPBwRBUjMNj_04KPxM,852
|
|
6
6
|
langgraph_api/config.py,sha256=r9mmbyZlhBuJLpnTkaOLcNH6ufFNqm_2eCiuOmhqRl0,12241
|
|
7
7
|
langgraph_api/cron_scheduler.py,sha256=25wYzEQrhPEivZrAPYOmzLPDOQa-aFogU37mTXc9TJk,2566
|
|
8
8
|
langgraph_api/errors.py,sha256=zlnl3xXIwVG0oGNKKpXf1an9Rn_SBDHSyhe53hU6aLw,1858
|
|
@@ -12,29 +12,29 @@ langgraph_api/graph.py,sha256=h1m6rsLiCocvMO283LLU03A5cBycxAIxixXu9mwzqsQ,25056
|
|
|
12
12
|
langgraph_api/http.py,sha256=fyK-H-0UfNy_BzuVW3aWWGvhRavmGAVMkDwDArryJ_4,5659
|
|
13
13
|
langgraph_api/http_metrics.py,sha256=MU9ccXt7aBb0AJ2SWEjwtbtbJEWmeqSdx7-CI51e32o,5594
|
|
14
14
|
langgraph_api/logging.py,sha256=qB6q_cUba31edE4_D6dBGhdiUTpW7sXAOepUjYb_R50,5216
|
|
15
|
-
langgraph_api/metadata.py,sha256=
|
|
16
|
-
langgraph_api/patch.py,sha256=
|
|
15
|
+
langgraph_api/metadata.py,sha256=0eGYhXOW6UIVDj2Y5mOdSJz_RadgJG8xmUsC9WqwsiE,8342
|
|
16
|
+
langgraph_api/patch.py,sha256=J0MmcfpZG15SUVaVcI0Z4x_c0-0rbbT7Pwh9fDAQOpA,1566
|
|
17
17
|
langgraph_api/queue_entrypoint.py,sha256=Y0Hu4QXNV7HPZWlBwuNCm8ehqD_n79AMk7ZWDZfBc4U,5631
|
|
18
18
|
langgraph_api/route.py,sha256=EBhELuJ1He-ZYcAnR5YTImcIeDtWthDae5CHELBxPkM,5056
|
|
19
19
|
langgraph_api/schema.py,sha256=AsgF0dIjBvDd_PDy20mGqB_IkBLgVvSj8qRKG_lPlec,8440
|
|
20
|
-
langgraph_api/serde.py,sha256=
|
|
21
|
-
langgraph_api/server.py,sha256=
|
|
20
|
+
langgraph_api/serde.py,sha256=Jkww6ixP5o2YZmnXtM7ihuAYC6YSuNDNPvE-8ILoqVo,5499
|
|
21
|
+
langgraph_api/server.py,sha256=C9TO7N0mzyrLulT_2FtaJfgfFbm2B4yyYTdAGPxgIeE,7255
|
|
22
22
|
langgraph_api/sse.py,sha256=SLdtZmTdh5D8fbWrQjuY9HYLd2dg8Rmi6ZMmFMVc2iE,4204
|
|
23
23
|
langgraph_api/state.py,sha256=AjkLbUQakIwK7oGzJ8oqubazRsXxG3vDMnRa0s0mzDM,4716
|
|
24
24
|
langgraph_api/store.py,sha256=NIoNZojs6NbtG3VLBPQEFNttvp7XPkHAfjbQ3gY7aLY,4701
|
|
25
|
-
langgraph_api/stream.py,sha256=
|
|
25
|
+
langgraph_api/stream.py,sha256=XSsCM3DRkP_5qu6polnwI41ywi7GBT3wiPvyAzujn_s,20923
|
|
26
26
|
langgraph_api/thread_ttl.py,sha256=KyHnvD0e1p1cV4Z_ZvKNVzDztuI2RBCUsUO2V7GlOSw,1951
|
|
27
27
|
langgraph_api/traceblock.py,sha256=Qq5CUdefnMDaRDnyvBSWGBClEj-f3oO7NbH6fedxOSE,630
|
|
28
28
|
langgraph_api/validation.py,sha256=86jftgOsMa7tkeshBw6imYe7zyUXPoVuf5Voh6dFiR8,5285
|
|
29
29
|
langgraph_api/webhook.py,sha256=SvSM1rdnNtiH4q3JQYmAqJUk2Sable5xAcwOLuRhtlo,1723
|
|
30
30
|
langgraph_api/worker.py,sha256=FQRw3kL9ynDv_LNgY_OjjPZQBuAvSQpsW6nECnABvDg,15354
|
|
31
31
|
langgraph_api/api/__init__.py,sha256=raFkYH50tsO-KjRmDbGVoHCuxuH58u1lrZbr-MlITIY,6262
|
|
32
|
-
langgraph_api/api/a2a.py,sha256=
|
|
33
|
-
langgraph_api/api/assistants.py,sha256=
|
|
32
|
+
langgraph_api/api/a2a.py,sha256=QEx-g0bTOREL-YaFsrcwA7oaix4VsaOr8hoQ7PF4Zwk,49382
|
|
33
|
+
langgraph_api/api/assistants.py,sha256=OX83GCWwGR8MuEJKIzAPEC4LC3Aghs5vD3NGLNnijaU,17268
|
|
34
34
|
langgraph_api/api/mcp.py,sha256=qe10ZRMN3f-Hli-9TI8nbQyWvMeBb72YB1PZVbyqBQw,14418
|
|
35
35
|
langgraph_api/api/meta.py,sha256=Qyj6r5czkVJ81tpD6liFY7tlrmFDsiSfBr-4X8HJpRc,4834
|
|
36
36
|
langgraph_api/api/openapi.py,sha256=If-z1ckXt-Yu5bwQytK1LWyX_T7G46UtLfixgEP8hwc,11959
|
|
37
|
-
langgraph_api/api/runs.py,sha256=
|
|
37
|
+
langgraph_api/api/runs.py,sha256=keHlFu1iy-l1IICJHc6AKrSUoQA-LZi6FYsja7la9Xw,25436
|
|
38
38
|
langgraph_api/api/store.py,sha256=xGcPFx4v-VxlK6HRU9uCjzCQ0v66cvc3o_PB5_g7n0Q,5550
|
|
39
39
|
langgraph_api/api/threads.py,sha256=5-ZEcs48bL3vot_yCt3ImuA9hzg93LxuAd_DXd2xj4Y,12915
|
|
40
40
|
langgraph_api/api/ui.py,sha256=_genglTUy5BMHlL0lkQypX524yFv6Z5fraIvnrxp7yE,2639
|
|
@@ -55,14 +55,14 @@ langgraph_api/js/client.http.mts,sha256=cvn8JV9go4pUMWkcug8FfSYWsp1wTaT8SgJaskqE
|
|
|
55
55
|
langgraph_api/js/client.mts,sha256=gDvYiW7Qfl4re2YhZ5oNqtuvffnW_Sf7DK5aUbKB3vw,32330
|
|
56
56
|
langgraph_api/js/errors.py,sha256=Cm1TKWlUCwZReDC5AQ6SgNIVGD27Qov2xcgHyf8-GXo,361
|
|
57
57
|
langgraph_api/js/global.d.ts,sha256=j4GhgtQSZ5_cHzjSPcHgMJ8tfBThxrH-pUOrrJGteOU,196
|
|
58
|
-
langgraph_api/js/package.json,sha256=
|
|
59
|
-
langgraph_api/js/remote.py,sha256=
|
|
58
|
+
langgraph_api/js/package.json,sha256=TLyPB9pZyZ1KQXC08NvbBbf8X5dKAF8WXc5cyjFtWZE,1335
|
|
59
|
+
langgraph_api/js/remote.py,sha256=gBk273R7esmXg8aR6InxasNFc5E6Qju2bv2DhmmGJyU,38676
|
|
60
60
|
langgraph_api/js/schema.py,sha256=M4fLtr50O1jck8H1hm_0W4cZOGYGdkrB7riLyCes4oY,438
|
|
61
61
|
langgraph_api/js/sse.py,sha256=hHkbncnYnXNIbHhAWneGWYkHp4UhhhGB7-MYtDrY264,4141
|
|
62
62
|
langgraph_api/js/traceblock.mts,sha256=QtGSN5VpzmGqDfbArrGXkMiONY94pMQ5CgzetT_bKYg,761
|
|
63
63
|
langgraph_api/js/tsconfig.json,sha256=imCYqVnqFpaBoZPx8k1nO4slHIWBFsSlmCYhO73cpBs,341
|
|
64
64
|
langgraph_api/js/ui.py,sha256=l9regrvKIxLOjH5SIYE2nhr8QCKLK1Q_1pZgxdL71X4,2488
|
|
65
|
-
langgraph_api/js/yarn.lock,sha256=
|
|
65
|
+
langgraph_api/js/yarn.lock,sha256=FCizZGxfI4SVoeAZWbezvonYBXsuvlWMUHX-1yACFz8,84352
|
|
66
66
|
langgraph_api/js/src/graph.mts,sha256=9zTQNdtanI_CFnOwNRoamoCVHHQHGbNlbm91aRxDeOc,2675
|
|
67
67
|
langgraph_api/js/src/load.hooks.mjs,sha256=xNVHq75W0Lk6MUKl1pQYrx-wtQ8_neiUyI6SO-k0ecM,2235
|
|
68
68
|
langgraph_api/js/src/preload.mjs,sha256=8m3bYkf9iZLCQzKAYAdU8snxUwAG3dVLwGvAjfGfgIc,959
|
|
@@ -75,7 +75,7 @@ langgraph_api/middleware/http_logger.py,sha256=4EMLtp8jaF_mj4qQOHMZZSoT1ldJEN2id
|
|
|
75
75
|
langgraph_api/middleware/private_network.py,sha256=eYgdyU8AzU2XJu362i1L8aSFoQRiV7_aLBPw7_EgeqI,2111
|
|
76
76
|
langgraph_api/middleware/request_id.py,sha256=SDj3Yi3WvTbFQ2ewrPQBjAV8sYReOJGeIiuoHeZpR9g,1242
|
|
77
77
|
langgraph_api/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
78
|
-
langgraph_api/models/run.py,sha256=
|
|
78
|
+
langgraph_api/models/run.py,sha256=WdzOb8WSe6bfDNid06ZDxpeGAaIiaasDHkWbPG2WuuY,13260
|
|
79
79
|
langgraph_api/tunneling/cloudflare.py,sha256=iKb6tj-VWPlDchHFjuQyep2Dpb-w2NGfJKt-WJG9LH0,3650
|
|
80
80
|
langgraph_api/utils/__init__.py,sha256=yCMq7pOMlmeNmi2Fh8U7KLiljBdOMcF0L2SfpobnKKE,5703
|
|
81
81
|
langgraph_api/utils/cache.py,sha256=F23s-4BPJjuYh_PRL5pmIsSjqYWsY_b3PB7xmRwKwKw,3452
|
|
@@ -98,8 +98,8 @@ langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,11
|
|
|
98
98
|
LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
99
99
|
logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
|
|
100
100
|
openapi.json,sha256=21wu-NxdxyTQwZctNcEfRkLMnSBi0QhGAfwq5kg8XNU,172618
|
|
101
|
-
langgraph_api-0.4.
|
|
102
|
-
langgraph_api-0.4.
|
|
103
|
-
langgraph_api-0.4.
|
|
104
|
-
langgraph_api-0.4.
|
|
105
|
-
langgraph_api-0.4.
|
|
101
|
+
langgraph_api-0.4.22.dist-info/METADATA,sha256=sfURjIfcLWtfec-SjnaQIIE_1ZjLzposwZ3DhXZ4XwI,3893
|
|
102
|
+
langgraph_api-0.4.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
103
|
+
langgraph_api-0.4.22.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
|
|
104
|
+
langgraph_api-0.4.22.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
105
|
+
langgraph_api-0.4.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|