langgraph-api 0.18.0.dev10__py3-none-any.whl → 0.18.0.dev11__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.
langgraph_api/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.18.0.dev10"
1
+ __version__ = "0.18.0.dev11"
@@ -7,6 +7,7 @@ from starlette.responses import Response
7
7
  from starlette.routing import BaseRoute
8
8
 
9
9
  from langgraph_api import config as lg_api_config
10
+ from langgraph_api.api.runs import parse_stream_mode_param
10
11
  from langgraph_api.config import USE_CUSTOM_CHECKPOINTER
11
12
  from langgraph_api.encryption.shared import (
12
13
  using_encryption,
@@ -589,24 +590,20 @@ async def join_thread_stream(request: ApiRequest):
589
590
  last_event_id, "Invalid last-event-id: must be a valid Redis stream ID"
590
591
  )
591
592
 
592
- # Parse stream_modes parameter - can be single string or comma-separated list
593
- stream_modes_param = request.query_params.get("stream_modes")
594
- if stream_modes_param:
595
- if "," in stream_modes_param:
596
- # Handle comma-separated list
597
- stream_modes = [mode.strip() for mode in stream_modes_param.split(",")]
598
- else:
599
- # Handle single value
600
- stream_modes = [stream_modes_param]
601
- # Validate each mode
602
- for mode in stream_modes:
603
- if mode not in get_args(ThreadStreamMode):
604
- raise HTTPException(
605
- status_code=422, detail=f"Invalid stream mode: {mode}"
606
- )
607
- else:
608
- # Default to run_modes
609
- stream_modes = ["run_modes"]
593
+ # The SDKs send ``stream_mode``: once per mode, or as one JSON array from
594
+ # JS SDKs before 1.12.
595
+ params = request.query_params
596
+ values = params.getlist("stream_modes") or params.getlist("stream_mode")
597
+ stream_modes = [
598
+ mode.strip()
599
+ for value in values
600
+ if value
601
+ for item in parse_stream_mode_param(value)
602
+ for mode in str(item).split(",")
603
+ ] or ["run_modes"]
604
+ for mode in stream_modes:
605
+ if mode not in get_args(ThreadStreamMode):
606
+ raise HTTPException(status_code=422, detail=f"Invalid stream mode: {mode}")
610
607
 
611
608
  return EventSourceResponse(
612
609
  Threads.Stream.join(
langgraph_api/graph.py CHANGED
@@ -375,7 +375,10 @@ async def get_graph(
375
375
  CONFIG_KEY_RUNTIME,
376
376
  )
377
377
 
378
- if use_langgraph_runtime:
378
+ if use_langgraph_runtime or access_context in (
379
+ "threads.read",
380
+ "threads.update",
381
+ ):
379
382
  # xray draw calls runtime.override(), which the SDK ServerRuntime lacks (LSD-1713).
380
383
  from langgraph.runtime import Runtime # noqa: PLC0415
381
384
 
@@ -233,15 +233,12 @@ async def create_valid_run(
233
233
  detail="Cannot specify both configurable and context. Prefer setting context alone. Context was introduced in LangGraph 0.6.0 and is the long term planned replacement for configurable.",
234
234
  )
235
235
 
236
- # ``tools`` and ``lifecycle`` are emitted only by the protocol v2
237
- # streaming pipeline (``stream_v2.py`` / ``StreamMessagesHandlerV2``
238
- # plus the registered stream transformers). Accepting them on legacy
239
- # streaming routes would either no-op (``lifecycle``, never emitted
240
- # without a transformer) or leak v2-shaped events into v1 consumers
241
- # (``tools``). Reject up front so callers get a clear 422 instead of
242
- # a silently empty stream.
236
+ # ``lifecycle`` is emitted only by the protocol v2 streaming pipeline
237
+ # (``stream_v2.py`` plus the registered stream transformers), so legacy
238
+ # routes reject it up front instead of returning a silently empty stream.
239
+ # ``tools`` is accepted on legacy routes and dropped in ``stream.py``.
243
240
  if not configurable.get(EVENT_STREAMING_V2_CONFIG_KEY):
244
- v2_only = {"tools", "lifecycle"}.intersection(stream_mode)
241
+ v2_only = {"lifecycle"}.intersection(stream_mode)
245
242
  if v2_only:
246
243
  raise HTTPException(
247
244
  status_code=422,
langgraph_api/stream.py CHANGED
@@ -265,6 +265,11 @@ async def astream_state(
265
265
  # ``capabilities.py`` documents this behavior — keep them in sync.
266
266
  stream_modes_set.discard("tools")
267
267
  stream_modes_set.discard("lifecycle")
268
+ elif not event_streaming_v2_run:
269
+ # The v1 React ``useStream`` hook asks for ``tools`` whenever an app
270
+ # listens for tool events, but it cannot parse the events graphs emit
271
+ # for this mode and throws on the first one.
272
+ stream_modes_set.discard("tools")
268
273
  if "debug" not in stream_modes_set:
269
274
  stream_modes_set.add("debug")
270
275
  if "messages-tuple" in stream_modes_set and not is_remote_pregel:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.18.0.dev10
3
+ Version: 0.18.0.dev11
4
4
  Author-email: Will Fu-Hinthorn <will@langchain.dev>, Josh Rogers <josh@langchain.dev>, Parker Rule <parker@langchain.dev>
5
5
  License: Elastic-2.0
6
6
  License-File: LICENSE
@@ -24,7 +24,7 @@ Requires-Dist: langsmith[otel]>=0.6.3
24
24
  Requires-Dist: mcp<3,>=2.3.0
25
25
  Requires-Dist: opentelemetry-api>=0.0.1
26
26
  Requires-Dist: opentelemetry-exporter-otlp-proto-http>=0.0.1
27
- Requires-Dist: opentelemetry-exporter-prometheus<0.64,>=0.63b1
27
+ Requires-Dist: opentelemetry-exporter-prometheus<0.67,>=0.63b1
28
28
  Requires-Dist: opentelemetry-sdk>=0.0.1
29
29
  Requires-Dist: orjson>=3.9.7
30
30
  Requires-Dist: packaging>=23.2
@@ -1,4 +1,4 @@
1
- langgraph_api/__init__.py,sha256=-bIIVjTdPEAZN8A072q6cjv1tdFUQmeHn9FYvYC-Q14,29
1
+ langgraph_api/__init__.py,sha256=zeFov3xLvG2epwG3vyAlMksHDixxntffxrOokaDZ19c,29
2
2
  langgraph_api/_factory_utils.py,sha256=_FqW0olMu2PGLsnRq0ylt3a4jDCe12YIFHExMXI6Nyo,5976
3
3
  langgraph_api/asgi_transport.py,sha256=XApY3lIWBZTMbbsl8dDJzl0cLGirmAGE0SifqZUnXvs,11896
4
4
  langgraph_api/asyncio.py,sha256=-p-Vx89TnErypdPcWb-2EdbsSvhdIdHfriCFG7UP7ls,12444
@@ -10,7 +10,7 @@ langgraph_api/cron_scheduler.py,sha256=H1jPymC68A1MYyjfdApX4-hELiGBlJpGgSOsN8qhc
10
10
  langgraph_api/drain.py,sha256=MLUm3fDq3R8yxrZ-1W3TeCfhNzgNSzUA7TvB-D6K2_s,6108
11
11
  langgraph_api/errors.py,sha256=x6yhf0JrgSNweFRJw7l3ZK8De4T76d2v6MRvoDU_C-U,3312
12
12
  langgraph_api/feature_flags.py,sha256=NB1X5jO19c40hI3WDxGk9qwD6EZUROO0ooFSd1QTniM,3985
13
- langgraph_api/graph.py,sha256=uQaC_yOWRFZIZwQt5WGdjnVW5iB0WaaBniUcUV82Y5Q,40594
13
+ langgraph_api/graph.py,sha256=aWj1o4bYU2prIWpAVAWOH7CHbjvZKYfWV2CtF-hzPko,40697
14
14
  langgraph_api/http.py,sha256=7hPxKbj-xoAKcm7iucBpT5nM_hXOgGVCPbBsCD693Cw,6977
15
15
  langgraph_api/http_metrics.py,sha256=etxbZNmYxdb58DVLNkHP7S-N6njXPTiQh2OWKMaIZi8,5336
16
16
  langgraph_api/http_metrics_utils.py,sha256=sjxF7SYGTzY0Wz_G0dzatsYNnWr31S6ujej4JmBG2yo,866
@@ -32,7 +32,7 @@ langgraph_api/server.py,sha256=_DG7dCL2wtlaXdppTce2e0k8PunCcSRj79ncQfqmK_Q,10305
32
32
  langgraph_api/sse.py,sha256=cChZ7raQUHp8p5BreE_5wMBR8lFO0n7746sV8_HQOrc,4822
33
33
  langgraph_api/state.py,sha256=Py8HG8k7u0FRAj4Ok89_uR9GerkyeFm90gSMTbWWQX0,8356
34
34
  langgraph_api/store.py,sha256=OXcdQSVCDKOzfS8S2aJHXbfuI5iYRoQBiW9WYKnCyx8,7122
35
- langgraph_api/stream.py,sha256=SMrditrbTJ7QtKW-ThpYAPiVsQD-ot_tQeGJIp9PKGI,36519
35
+ langgraph_api/stream.py,sha256=FcmDN5lZmSwnbsRuuzz1En07iZG6Rr2otYWnHVw18sU,36806
36
36
  langgraph_api/stream_v2.py,sha256=AieeCAXQsthy9n6crCibMB7unbN1W_o1xkpJ2v11RSY,10822
37
37
  langgraph_api/traceblock.py,sha256=GhgAtLhAQ8Z8LHtRQq3par-rfPpRBQp2Q7WBACJq1NI,677
38
38
  langgraph_api/tracing_session.py,sha256=gmfv-BW1XRar6suVur1P4rTVKWkjElDEb2hhkBduWOs,728
@@ -53,7 +53,7 @@ langgraph_api/api/openapi.py,sha256=hS4yhfJfWAYilm0Pv8iC08bK7CMDG4PIVc-77y9Y7Ts,
53
53
  langgraph_api/api/profile.py,sha256=CA1ZkHALOuP8orYTICnEhcG_JnnA2wnyjbWyeb117jA,3455
54
54
  langgraph_api/api/runs.py,sha256=0ogQnEQyKeVTuEUY6UD4KMShUA6Qq7_Zyp0Z70zGSzs,32577
55
55
  langgraph_api/api/store.py,sha256=5d1GOxsVDK-8PPngYG2rjYF_B2qNevDvPos-nB8YPCI,7710
56
- langgraph_api/api/threads.py,sha256=OQSoveEmKE-mErF4AbvivHpTexLE_BJ_raGDgH8YZ44,23031
56
+ langgraph_api/api/threads.py,sha256=JT7TpAs7zJBokxzGl_DmUNEnfAVfTRdJRiLwuP4D1EM,22916
57
57
  langgraph_api/api/ui.py,sha256=A1cRxaMK_4pb192mrZ_LMxLSFb8NriYwwvjeDdNDD7k,2803
58
58
  langgraph_api/api/a2ui_schemas/README.md,sha256=fZCc9rSK-qeUHsbJ17EYxMZjS3yUrYQdoQLX7ltgP8M,298
59
59
  langgraph_api/api/a2ui_schemas/client_capabilities.json,sha256=3YAHlRfeOn9dUH6uAek1loCL4caeSUuQzhrtWKWW9nU,1906
@@ -149,7 +149,7 @@ langgraph_api/middleware/http_logger.py,sha256=79iMlqKdSP5sS6G-iuEAHl2h0Z2ygYDxs
149
149
  langgraph_api/middleware/private_network.py,sha256=eQEzWI8epBNUCiNsMu9O27ofHBQ45M0p2OZy5YdUYos,2097
150
150
  langgraph_api/middleware/request_id.py,sha256=-p230Q5jDJAJLmSZRqQvB4dFFkJS9B4Vwg6pUgQtI24,1259
151
151
  langgraph_api/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
152
- langgraph_api/models/run.py,sha256=MW7Q17G3veh3WCPwwyDVA9qkk-ih8MPo3QKqY-_Wyho,15795
152
+ langgraph_api/models/run.py,sha256=XHlx9m3Odr61CGuHjNdAqJEU_B325rxRn-98AeAgV4M,15625
153
153
  langgraph_api/timing/__init__.py,sha256=UDMuNBmc5NqX0m5T-9PUFioCa1lNvd4Wv4juPIBRb-w,877
154
154
  langgraph_api/timing/profiler.py,sha256=_n0qJYJMjCGo95RDuH5z8FIzePGNSNbnm3cvGmcgn6A,6186
155
155
  langgraph_api/timing/startup.py,sha256=1Jp4-tquBhiE5glWQhXGX5XS2_006myJXHHZMOi15ng,6161
@@ -182,7 +182,7 @@ langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,11
182
182
  LICENSE,sha256=SCVQGLQfwOllsRFa9-Z3m8IYu4pnR9Vh2oANUCJiKqI,3860
183
183
  hatch_build.py,sha256=Nn9N-EFfVqmH5q3iCUrhqX6zc7qT1jLI3gWSBN2xgYQ,1738
184
184
  logging.json,sha256=sBy8HDDPuucpLbLUD6e8t5fsiQjJoklZsbVHi2qQ7aQ,367
185
- openapi.json,sha256=-3ATf5OgeAsoctzGUcZRXFyPBAHz49VCNqKaWt8yvQc,228738
185
+ openapi.json,sha256=AX8OyPP9M3JCJ4J09DU0KdmPxTTlHl12YLm8e-u7Fg4,229573
186
186
  langgraph_grpc_common/__init__.py,sha256=sO7jFHekQxt6zZPhTPZAWLYLB_S8w7-VuJ7NyWFlFNo,97
187
187
  langgraph_grpc_common/checkpointer.py,sha256=FwY4a4zIdRFy_Fw2jd_dxIhBpWBIMi5kJqye2VkzzUg,16505
188
188
  langgraph_grpc_common/serde.py,sha256=8q290nZ6TdxbEhCTzwEs44XGi2b-3pfrUeMYY5WGlTY,6179
@@ -260,8 +260,8 @@ langgraph_grpc_common/proto/store_pb2.py,sha256=VWJ7wtzL9pVmZZKbxMzOzCoiFn58bB2g
260
260
  langgraph_grpc_common/proto/store_pb2.pyi,sha256=atXejijuYEb9tE0stGQdZcfA9ucMFj-ytTMwvkxwviM,29322
261
261
  langgraph_grpc_common/proto/store_pb2_grpc.py,sha256=Kyt8eV2NXkjh3be_BYytGdD19kNf74961cruonMvCrw,3300
262
262
  langgraph_grpc_common/proto/store_pb2_grpc.pyi,sha256=oS1h2cDoq2OjyM8xazcmc8LwRDC5oCAD0zto2QUmPQw,2027
263
- langgraph_api-0.18.0.dev10.dist-info/METADATA,sha256=p4UUfXDSWLBDQK7btVt4IGOL7teL42UEJs6_uJ2Hxpo,5940
264
- langgraph_api-0.18.0.dev10.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
265
- langgraph_api-0.18.0.dev10.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
266
- langgraph_api-0.18.0.dev10.dist-info/licenses/LICENSE,sha256=SCVQGLQfwOllsRFa9-Z3m8IYu4pnR9Vh2oANUCJiKqI,3860
267
- langgraph_api-0.18.0.dev10.dist-info/RECORD,,
263
+ langgraph_api-0.18.0.dev11.dist-info/METADATA,sha256=JsSSrPQRSnu9t4RnAMogw7UfrH64t16WkNW5eRo3iZo,5940
264
+ langgraph_api-0.18.0.dev11.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
265
+ langgraph_api-0.18.0.dev11.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
266
+ langgraph_api-0.18.0.dev11.dist-info/licenses/LICENSE,sha256=SCVQGLQfwOllsRFa9-Z3m8IYu4pnR9Vh2oANUCJiKqI,3860
267
+ langgraph_api-0.18.0.dev11.dist-info/RECORD,,
openapi.json CHANGED
@@ -1666,6 +1666,28 @@
1666
1666
  },
1667
1667
  "name": "stream_modes",
1668
1668
  "in": "query"
1669
+ },
1670
+ {
1671
+ "required": false,
1672
+ "schema": {
1673
+ "anyOf": [
1674
+ {
1675
+ "type": "string",
1676
+ "enum": ["lifecycle", "run_modes", "state_update"]
1677
+ },
1678
+ {
1679
+ "type": "array",
1680
+ "items": {
1681
+ "type": "string",
1682
+ "enum": ["lifecycle", "run_modes", "state_update"]
1683
+ }
1684
+ }
1685
+ ],
1686
+ "title": "Stream Mode",
1687
+ "description": "Alias of `stream_modes`, the name the SDKs send. Ignored when `stream_modes` is set."
1688
+ },
1689
+ "name": "stream_mode",
1690
+ "in": "query"
1669
1691
  }
1670
1692
  ],
1671
1693
  "responses": {
@@ -5308,7 +5330,8 @@
5308
5330
  "updates",
5309
5331
  "events",
5310
5332
  "debug",
5311
- "custom"
5333
+ "custom",
5334
+ "tools"
5312
5335
  ]
5313
5336
  },
5314
5337
  "type": "array"
@@ -5324,7 +5347,8 @@
5324
5347
  "updates",
5325
5348
  "events",
5326
5349
  "debug",
5327
- "custom"
5350
+ "custom",
5351
+ "tools"
5328
5352
  ]
5329
5353
  }
5330
5354
  ],
@@ -5506,7 +5530,8 @@
5506
5530
  "updates",
5507
5531
  "events",
5508
5532
  "debug",
5509
- "custom"
5533
+ "custom",
5534
+ "tools"
5510
5535
  ]
5511
5536
  },
5512
5537
  "type": "array"
@@ -5522,7 +5547,8 @@
5522
5547
  "updates",
5523
5548
  "events",
5524
5549
  "debug",
5525
- "custom"
5550
+ "custom",
5551
+ "tools"
5526
5552
  ]
5527
5553
  }
5528
5554
  ],