langgraph-api 0.4.0__py3-none-any.whl → 0.4.7__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/logging.py CHANGED
@@ -69,9 +69,12 @@ class AddApiVersion:
69
69
  def __call__(
70
70
  self, logger: logging.Logger, method_name: str, event_dict: EventDict
71
71
  ) -> EventDict:
72
- from langgraph_api import __version__
72
+ try:
73
+ from langgraph_api import __version__
73
74
 
74
- event_dict["langgraph_api_version"] = __version__
75
+ event_dict["langgraph_api_version"] = __version__
76
+ except ImportError:
77
+ pass
75
78
  return event_dict
76
79
 
77
80
 
@@ -106,6 +106,8 @@ class RunCreateDict(TypedDict):
106
106
  """Create the thread if it doesn't exist. If False, reply with 404."""
107
107
  langsmith_tracer: LangSmithTracer | None
108
108
  """Configuration for additional tracing with LangSmith."""
109
+ durability: str | None
110
+ """Durability level for the run. Must be one of 'sync', 'async', or 'exit'."""
109
111
 
110
112
 
111
113
  def ensure_ids(
@@ -322,6 +324,11 @@ async def create_valid_run(
322
324
  put_time_start = time.time()
323
325
  if_not_exists = payload.get("if_not_exists", "reject")
324
326
 
327
+ durability = payload.get("durability")
328
+ if durability is None:
329
+ checkpoint_during = payload.get("checkpoint_during")
330
+ durability = "async" if checkpoint_during in (None, True) else "exit"
331
+
325
332
  run_coro = Runs.put(
326
333
  conn,
327
334
  assistant_id,
@@ -339,6 +346,7 @@ async def create_valid_run(
339
346
  "subgraphs": payload.get("stream_subgraphs", False),
340
347
  "resumable": stream_resumable,
341
348
  "checkpoint_during": payload.get("checkpoint_during", True),
349
+ "durability": durability,
342
350
  },
343
351
  metadata=payload.get("metadata"),
344
352
  status="pending",
langgraph_api/schema.py CHANGED
@@ -19,6 +19,8 @@ StreamMode = Literal[
19
19
  "values", "messages", "updates", "events", "debug", "tasks", "checkpoints", "custom"
20
20
  ]
21
21
 
22
+ ThreadStreamMode = Literal["lifecycle", "run_modes", "state_update"]
23
+
22
24
  MultitaskStrategy = Literal["reject", "rollback", "interrupt", "enqueue"]
23
25
 
24
26
  OnConflictBehavior = Literal["raise", "do_nothing"]
langgraph_api/stream.py CHANGED
@@ -30,7 +30,7 @@ from langgraph_api import __version__
30
30
  from langgraph_api import store as api_store
31
31
  from langgraph_api.asyncio import ValueEvent, wait_if_not_done
32
32
  from langgraph_api.command import map_cmd
33
- from langgraph_api.feature_flags import USE_RUNTIME_CONTEXT_API
33
+ from langgraph_api.feature_flags import USE_DURABILITY, USE_RUNTIME_CONTEXT_API
34
34
  from langgraph_api.graph import get_graph
35
35
  from langgraph_api.js.base import BaseRemotePregel
36
36
  from langgraph_api.metadata import HOST, PLAN, USER_API_URL, incr_nodes
@@ -134,6 +134,14 @@ async def astream_state(
134
134
  kwargs = run["kwargs"].copy()
135
135
  kwargs.pop("webhook", None)
136
136
  kwargs.pop("resumable", False)
137
+ if USE_DURABILITY:
138
+ checkpoint_during = kwargs.pop("checkpoint_during")
139
+ if not kwargs.get("durability") and checkpoint_during:
140
+ kwargs["durability"] = "async" if checkpoint_during else "exit"
141
+ else:
142
+ durability = kwargs.pop("durability")
143
+ if not kwargs.get("checkpoint_during") and durability in ("async", "exit"):
144
+ kwargs["checkpoint_during"] = durability == "async"
137
145
  subgraphs = kwargs.get("subgraphs", False)
138
146
  temporary = kwargs.pop("temporary", False)
139
147
  context = kwargs.pop("context", None)
@@ -59,6 +59,14 @@ def should_include_header(key: str) -> bool:
59
59
  Returns:
60
60
  True if the header should be included, False otherwise
61
61
  """
62
+ if (
63
+ key == "x-api-key"
64
+ or key == "x-service-key"
65
+ or key == "x-tenant-id"
66
+ or key == "authorization"
67
+ ):
68
+ return False
69
+
62
70
  include_patterns, exclude_patterns = get_header_patterns("configurable_headers")
63
71
 
64
72
  return pattern_matches(key, include_patterns, exclude_patterns)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.4.0
3
+ Version: 0.4.7
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.9.0,>=0.8.0
14
+ Requires-Dist: langgraph-runtime-inmem<0.10.0,>=0.9.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,28 +1,28 @@
1
- langgraph_api/__init__.py,sha256=42STGor_9nKYXumfeV5tiyD_M8VdcddX7CEexmibPBk,22
1
+ langgraph_api/__init__.py,sha256=MHGyAIWXVeovtteWUUSzLq9UGWJLLooUZCXB9KGpNK8,22
2
2
  langgraph_api/asgi_transport.py,sha256=XtiLOu4WWsd-xizagBLzT5xUkxc9ZG9YqwvETBPjBFE,5161
3
- langgraph_api/asyncio.py,sha256=mZ7G32JjrGxrlH4OMy7AKlBQo5bZt4Sm2rlrBcU-Vj8,9483
3
+ langgraph_api/asyncio.py,sha256=NjHFvZStKryAAfGOrl3-efHtCzibvpDx-dl8PnrE1Tk,9588
4
4
  langgraph_api/cli.py,sha256=-ruIeKi1imvS6GriOfRDZY-waV4SbWiJ0BEFAciPVYI,16330
5
5
  langgraph_api/command.py,sha256=3O9v3i0OPa96ARyJ_oJbLXkfO8rPgDhLCswgO9koTFA,768
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
9
9
  langgraph_api/executor_entrypoint.py,sha256=CaX813ygtf9CpOaBkfkQXJAHjFtmlScCkrOvTDmu4Aw,750
10
- langgraph_api/feature_flags.py,sha256=GjwmNjfg0Jhs3OzR2VbK2WgrRy3o5l8ibIYiUtQkDPA,363
10
+ langgraph_api/feature_flags.py,sha256=x28NwFJXdfuGW2uUmon6lBSh0pGBo27bw_Se72TO4sM,409
11
11
  langgraph_api/graph.py,sha256=HTjJNQadrdi1tzJYNJ_iPIR6-zqC4-hj6YTD6zGQHYA,25072
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
- langgraph_api/logging.py,sha256=ZZ95dDdWDayIbH1bgwNfn0U3CQ8kDoAvDFBDACna4-A,5150
14
+ langgraph_api/logging.py,sha256=qB6q_cUba31edE4_D6dBGhdiUTpW7sXAOepUjYb_R50,5216
15
15
  langgraph_api/metadata.py,sha256=fVsbwxVitAj4LGVYpCcadYeIFANEaNtcx6LBxQLcTqg,6949
16
16
  langgraph_api/patch.py,sha256=iLwSd9ZWoVj6MxozMyGyMvWWbE9RIP5eZX1dpCBSlSU,1480
17
17
  langgraph_api/queue_entrypoint.py,sha256=yFzVX3_YKTq4w1A5h5nRpVfiWuSOeJ9acHMPAcTIrKY,5282
18
18
  langgraph_api/route.py,sha256=EBhELuJ1He-ZYcAnR5YTImcIeDtWthDae5CHELBxPkM,5056
19
- langgraph_api/schema.py,sha256=6gabS4_1IeRWV5lyuDV-2i__8brXl89elAlmD5BmEII,8370
19
+ langgraph_api/schema.py,sha256=AsgF0dIjBvDd_PDy20mGqB_IkBLgVvSj8qRKG_lPlec,8440
20
20
  langgraph_api/serde.py,sha256=3GvelKhySjlXaNqpg2GyUxU6-NEkvif7WlMF9if_EgU,6029
21
21
  langgraph_api/server.py,sha256=uCAqPgCLJ6ckslLs0i_dacSR8mzuR0Y6PkkJYk0O3bE,7196
22
22
  langgraph_api/sse.py,sha256=SLdtZmTdh5D8fbWrQjuY9HYLd2dg8Rmi6ZMmFMVc2iE,4204
23
23
  langgraph_api/state.py,sha256=5RTOShiFVnkx-o6t99_x63CGwXw_8Eb-dSTpYirP8ro,4683
24
24
  langgraph_api/store.py,sha256=NIoNZojs6NbtG3VLBPQEFNttvp7XPkHAfjbQ3gY7aLY,4701
25
- langgraph_api/stream.py,sha256=IpGW9vpknI_wWteEmZfQKqCYqbaJAzOpq0FgdFJP60s,18528
25
+ langgraph_api/stream.py,sha256=V8jWwA3wBRenMk3WIFkt0OLXm_LhPwg_Yj_tP4Dc6iI,18970
26
26
  langgraph_api/thread_ttl.py,sha256=7H3gFlWcUiODPoaEzcwB0LR61uvcuyjD0ew_4BztB7k,1902
27
27
  langgraph_api/traceblock.py,sha256=Qq5CUdefnMDaRDnyvBSWGBClEj-f3oO7NbH6fedxOSE,630
28
28
  langgraph_api/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -34,9 +34,9 @@ langgraph_api/api/assistants.py,sha256=5gVvU58Y1-EftBhCHGbEaOi_7cqGMKWhOt_GVfBC0
34
34
  langgraph_api/api/mcp.py,sha256=qe10ZRMN3f-Hli-9TI8nbQyWvMeBb72YB1PZVbyqBQw,14418
35
35
  langgraph_api/api/meta.py,sha256=dFD9ZgykbKARLdVSaJD9vO3CShvEyBmGpkjE8tqii0c,4448
36
36
  langgraph_api/api/openapi.py,sha256=If-z1ckXt-Yu5bwQytK1LWyX_T7G46UtLfixgEP8hwc,11959
37
- langgraph_api/api/runs.py,sha256=1RlD4WA8auCNugFjJSgaM9WPnwEHeWsJLEuKpwSRqcU,22089
37
+ langgraph_api/api/runs.py,sha256=Dzqg3Klnp_7QVHl26J51DpSlMvBhgUdwcKeeMQdqa4Y,22127
38
38
  langgraph_api/api/store.py,sha256=xGcPFx4v-VxlK6HRU9uCjzCQ0v66cvc3o_PB5_g7n0Q,5550
39
- langgraph_api/api/threads.py,sha256=xjeA6eUp4r19YYvqkfe8c3b_u4yIg6jvjq-EmlGu1kI,11150
39
+ langgraph_api/api/threads.py,sha256=dw176K8gFh0BIxADmkyZw68brzlOqUZbtpFBNQPxvow,11998
40
40
  langgraph_api/api/ui.py,sha256=_genglTUy5BMHlL0lkQypX524yFv6Z5fraIvnrxp7yE,2639
41
41
  langgraph_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  langgraph_api/auth/custom.py,sha256=psETw_GpLWClBbd_ESVPRLUz9GLQ0_XNsuUDSVbtZy0,22522
@@ -55,6 +55,9 @@ 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/isolate-0x130008000-46649-46649-v8.log,sha256=s6h4v7ZtOBK9tKJ0zzPojnob7MBV2j-nyLVPGbgotdg,2641826
59
+ langgraph_api/js/isolate-0x138008000-44681-44681-v8.log,sha256=knAbmQTmz2umDoqMXKuThsmgc4Q6b1HBwZ2ZFUcFu40,2644591
60
+ langgraph_api/js/package-lock.json,sha256=bGM4LYdWJxAb5JE6Tap1-WA_IqRE_CzBjxZTCcMt1_U,117589
58
61
  langgraph_api/js/package.json,sha256=syy2fEcmTxGQVfz4P9MUTgoTxHr1MUcA1rDXemAig2U,1335
59
62
  langgraph_api/js/remote.py,sha256=aeszJ0HGbcL9oExyeWYHb0xLV75U3KgVSxjm3ZK_a48,38403
60
63
  langgraph_api/js/schema.py,sha256=M4fLtr50O1jck8H1hm_0W4cZOGYGdkrB7riLyCes4oY,438
@@ -75,13 +78,13 @@ langgraph_api/middleware/http_logger.py,sha256=2LABfhzTAUtqT8nf1ACy8cYXteatkwraB
75
78
  langgraph_api/middleware/private_network.py,sha256=eYgdyU8AzU2XJu362i1L8aSFoQRiV7_aLBPw7_EgeqI,2111
76
79
  langgraph_api/middleware/request_id.py,sha256=SDj3Yi3WvTbFQ2ewrPQBjAV8sYReOJGeIiuoHeZpR9g,1242
77
80
  langgraph_api/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
- langgraph_api/models/run.py,sha256=jPGWcW9fd1KFoXZTSXMMvc0IiXDXk3yoZ5kjdqxZ1mg,15536
81
+ langgraph_api/models/run.py,sha256=21VmE9R1GeHEgshDYGm462ADFo7tkBx-JJGDOAdrDcA,15894
79
82
  langgraph_api/tunneling/cloudflare.py,sha256=iKb6tj-VWPlDchHFjuQyep2Dpb-w2NGfJKt-WJG9LH0,3650
80
83
  langgraph_api/utils/__init__.py,sha256=yCMq7pOMlmeNmi2Fh8U7KLiljBdOMcF0L2SfpobnKKE,5703
81
84
  langgraph_api/utils/cache.py,sha256=SrtIWYibbrNeZzLXLUGBFhJPkMVNQnVxR5giiYGHEfI,1810
82
85
  langgraph_api/utils/config.py,sha256=Tbp4tKDSLKXQJ44EKr885wAQupY-9VWNJ6rgUU2oLOY,4162
83
86
  langgraph_api/utils/future.py,sha256=lXsRQPhJwY7JUbFFZrK-94JjgsToLu-EWU896hvbUxE,7289
84
- langgraph_api/utils/headers.py,sha256=Mfh8NEbb0leaTDQPZNUwQBlBmG8snKFftvPzJ5qSgC4,2777
87
+ langgraph_api/utils/headers.py,sha256=eN7CXh7X7iFtLicKFdKX0jhhmWWyxAAfrths7mKNtO4,2942
85
88
  langgraph_api/utils/uuids.py,sha256=AW_9-1iFqK2K5hljmi-jtaNzUIoBshk5QPt8LbpbD2g,2975
86
89
  langgraph_license/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
90
  langgraph_license/validation.py,sha256=CU38RUZ5xhP1S8F_y8TNeV6OmtO-tIGjCXbXTwJjJO4,612
@@ -96,9 +99,9 @@ langgraph_runtime/retry.py,sha256=V0duD01fO7GUQ_btQkp1aoXcEOFhXooGVP6q4yMfuyY,11
96
99
  langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,114
97
100
  LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
98
101
  logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
99
- openapi.json,sha256=kT_Xi6PAI64jLUalbdh0TtIRy1PfqQBxSu-rbyo_ZyA,162474
100
- langgraph_api-0.4.0.dist-info/METADATA,sha256=dzjz3DMGzJSLbRmjGY7YJeL336DdeNe1_Cgcy9IYcmg,3890
101
- langgraph_api-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
102
- langgraph_api-0.4.0.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
103
- langgraph_api-0.4.0.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
104
- langgraph_api-0.4.0.dist-info/RECORD,,
102
+ openapi.json,sha256=FC4L4qGt6Twl933Z78v2y99WA_sNk74-TTQdG9MzFgE,164038
103
+ langgraph_api-0.4.7.dist-info/METADATA,sha256=kmNYIc3yTunNik1q9Fcd_ArzoV-aB65cF1ksp0YWvF4,3891
104
+ langgraph_api-0.4.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
105
+ langgraph_api-0.4.7.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
106
+ langgraph_api-0.4.7.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
107
+ langgraph_api-0.4.7.dist-info/RECORD,,
openapi.json CHANGED
@@ -1550,6 +1550,29 @@
1550
1550
  },
1551
1551
  "name": "Last-Event-ID",
1552
1552
  "in": "header"
1553
+ },
1554
+ {
1555
+ "required": false,
1556
+ "schema": {
1557
+ "anyOf": [
1558
+ {
1559
+ "type": "string",
1560
+ "enum": ["lifecycle", "run_modes", "state_update"]
1561
+ },
1562
+ {
1563
+ "type": "array",
1564
+ "items": {
1565
+ "type": "string",
1566
+ "enum": ["lifecycle", "run_modes", "state_update"]
1567
+ }
1568
+ }
1569
+ ],
1570
+ "default": ["run_modes"],
1571
+ "title": "Stream Modes",
1572
+ "description": "Stream modes to control which events are returned. 'lifecycle' returns only run start/end events, 'run_modes' returns all run events (default behavior), 'state_update' returns only state update events."
1573
+ },
1574
+ "name": "stream_modes",
1575
+ "in": "query"
1553
1576
  }
1554
1577
  ],
1555
1578
  "responses": {
@@ -4413,6 +4436,17 @@
4413
4436
  "title": "Checkpoint During",
4414
4437
  "description": "Whether to checkpoint during the run.",
4415
4438
  "default": false
4439
+ },
4440
+ "durability": {
4441
+ "type": "string",
4442
+ "enum": [
4443
+ "sync",
4444
+ "async",
4445
+ "exit"
4446
+ ],
4447
+ "title": "Durability",
4448
+ "description": "Durability level for the run. Must be one of 'sync', 'async', or 'exit'.",
4449
+ "default": "async"
4416
4450
  }
4417
4451
  },
4418
4452
  "type": "object",
@@ -4649,6 +4683,17 @@
4649
4683
  "title": "Checkpoint During",
4650
4684
  "description": "Whether to checkpoint during the run.",
4651
4685
  "default": false
4686
+ },
4687
+ "durability": {
4688
+ "type": "string",
4689
+ "enum": [
4690
+ "sync",
4691
+ "async",
4692
+ "exit"
4693
+ ],
4694
+ "title": "Durability",
4695
+ "description": "Durability level for the run. Must be one of 'sync', 'async', or 'exit'.",
4696
+ "default": "async"
4652
4697
  }
4653
4698
  },
4654
4699
  "type": "object",