langgraph-api 0.4.9__py3-none-any.whl → 0.4.11__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.9"
1
+ __version__ = "0.4.11"
@@ -290,7 +290,12 @@ async def patch_thread(
290
290
  validate_uuid(thread_id, "Invalid thread ID: must be a UUID")
291
291
  payload = await request.json(ThreadPatch)
292
292
  async with connect() as conn:
293
- thread = await Threads.patch(conn, thread_id, metadata=payload["metadata"])
293
+ thread = await Threads.patch(
294
+ conn,
295
+ thread_id,
296
+ metadata=payload.get("metadata", {}),
297
+ ttl=payload.get("ttl"),
298
+ )
294
299
  return ApiResponse(await fetchone(thread))
295
300
 
296
301
 
langgraph_api/command.py CHANGED
@@ -1,3 +1,5 @@
1
+ from typing import cast
2
+
1
3
  from langgraph.types import Command, Send
2
4
 
3
5
  from langgraph_api.schema import RunCommand
@@ -11,9 +13,9 @@ def map_cmd(cmd: RunCommand) -> Command:
11
13
  update = cmd.get("update")
12
14
  if isinstance(update, tuple | list) and all(
13
15
  isinstance(t, tuple | list) and len(t) == 2 and isinstance(t[0], str)
14
- for t in update
16
+ for t in cast(list, update)
15
17
  ):
16
- update = [tuple(t) for t in update]
18
+ update = [tuple(t) for t in cast(list, update)]
17
19
 
18
20
  return Command(
19
21
  update=update,
langgraph_api/graph.py CHANGED
@@ -392,14 +392,14 @@ async def collect_graphs_from_env(register: bool = False) -> None:
392
392
 
393
393
  if (
394
394
  config.HTTP_CONFIG
395
- and config.HTTP_CONFIG.get("app")
396
- and is_js_path(config.HTTP_CONFIG.get("app").split(":")[0])
395
+ and (js_app := config.HTTP_CONFIG.get("app"))
396
+ and is_js_path(js_app.split(":")[0])
397
397
  ):
398
398
  js_bg_tasks.add(
399
399
  asyncio.create_task(
400
400
  run_js_http_process(
401
401
  paths_str,
402
- config.HTTP_CONFIG.get("app"),
402
+ config.HTTP_CONFIG or {},
403
403
  watch="--reload" in sys.argv[1:],
404
404
  ),
405
405
  )
@@ -153,9 +153,9 @@ class RemotePregel(BaseRemotePregel):
153
153
 
154
154
  async for event in _client_stream("streamEvents", data):
155
155
  if event["event"] == "on_custom_event":
156
- yield CustomStreamEvent(**event)
156
+ yield CustomStreamEvent(**event) # type: ignore[missing-typed-dict-key]
157
157
  else:
158
- yield StandardStreamEvent(**event)
158
+ yield StandardStreamEvent(**event) # type: ignore[missing-typed-dict-key]
159
159
 
160
160
  async def fetch_state_schema(self):
161
161
  return await _client_invoke("getSchema", {"graph_id": self.graph_id})
@@ -187,15 +187,17 @@ class RemotePregel(BaseRemotePregel):
187
187
  )
188
188
  for data in nodes
189
189
  },
190
- {
191
- Edge(
192
- data["source"],
193
- data["target"],
194
- data.get("data"),
195
- data.get("conditional", False),
196
- )
197
- for data in edges
198
- },
190
+ list(
191
+ {
192
+ Edge(
193
+ data["source"],
194
+ data["target"],
195
+ data.get("data"),
196
+ data.get("conditional", False),
197
+ )
198
+ for data in edges
199
+ }
200
+ ),
199
201
  )
200
202
 
201
203
  async def fetch_subgraphs(
@@ -861,6 +863,8 @@ class CustomJsAuthBackend(AuthenticationBackend):
861
863
  self.ls_auth = LangsmithAuthBackend()
862
864
  self.ttl_cache: LRUCache | None = None
863
865
  self.cache_keys: list[str] | None = None
866
+ if LANGGRAPH_AUTH is None:
867
+ raise ValueError("LANGGRAPH_AUTH is not set")
864
868
  if cache := LANGGRAPH_AUTH.get("cache"):
865
869
  keys = cache.get("cache_keys", [])
866
870
  if not isinstance(keys, list):
langgraph_api/state.py CHANGED
@@ -27,7 +27,7 @@ def runnable_config_to_checkpoint(
27
27
  return None
28
28
 
29
29
  configurable = config["configurable"]
30
- checkpoint: Checkpoint = {
30
+ checkpoint: Checkpoint = { # type: ignore[typed-dict-item]
31
31
  "checkpoint_id": configurable["checkpoint_id"],
32
32
  "thread_id": configurable["thread_id"],
33
33
  }
@@ -1,6 +1,7 @@
1
1
  """Sweeping logic for cleaning up expired threads and checkpoints."""
2
2
 
3
3
  import asyncio
4
+ from typing import cast
4
5
 
5
6
  import structlog
6
7
 
@@ -23,7 +24,9 @@ async def thread_ttl_sweep_loop():
23
24
  raise NotImplementedError(
24
25
  f"Unrecognized thread deletion strategy: {strategy}. Expected 'delete'."
25
26
  )
26
- sweep_interval_minutes = thread_ttl_config.get("sweep_interval_minutes", 5)
27
+ sweep_interval_minutes = cast(
28
+ int, thread_ttl_config.get("sweep_interval_minutes", 5)
29
+ )
27
30
  await logger.ainfo(
28
31
  f"Starting thread TTL sweeper with interval {sweep_interval_minutes} minutes",
29
32
  strategy=strategy,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.4.9
3
+ Version: 0.4.11
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.11.0,>=0.10.0
14
+ Requires-Dist: langgraph-runtime-inmem<0.12.0,>=0.11.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,14 +1,14 @@
1
- langgraph_api/__init__.py,sha256=LdxLMJM_JXsCQBeSvnxCNyGWmINE0yWfna3DQaT41Vs,22
1
+ langgraph_api/__init__.py,sha256=xIphSmmFF5C8ZjsK5bpruTtbjrTL9bI6TjdjgsELGCw,23
2
2
  langgraph_api/asgi_transport.py,sha256=XtiLOu4WWsd-xizagBLzT5xUkxc9ZG9YqwvETBPjBFE,5161
3
3
  langgraph_api/asyncio.py,sha256=NjHFvZStKryAAfGOrl3-efHtCzibvpDx-dl8PnrE1Tk,9588
4
4
  langgraph_api/cli.py,sha256=-ruIeKi1imvS6GriOfRDZY-waV4SbWiJ0BEFAciPVYI,16330
5
- langgraph_api/command.py,sha256=3O9v3i0OPa96ARyJ_oJbLXkfO8rPgDhLCswgO9koTFA,768
5
+ langgraph_api/command.py,sha256=Q9XDRhnkCX7jyqW52_Rf2PPYKxjr-Z9BUHazI1HcmB8,817
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
10
  langgraph_api/feature_flags.py,sha256=x28NwFJXdfuGW2uUmon6lBSh0pGBo27bw_Se72TO4sM,409
11
- langgraph_api/graph.py,sha256=HTjJNQadrdi1tzJYNJ_iPIR6-zqC4-hj6YTD6zGQHYA,25072
11
+ 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
@@ -20,10 +20,10 @@ 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
- langgraph_api/state.py,sha256=5RTOShiFVnkx-o6t99_x63CGwXw_8Eb-dSTpYirP8ro,4683
23
+ langgraph_api/state.py,sha256=AjkLbUQakIwK7oGzJ8oqubazRsXxG3vDMnRa0s0mzDM,4716
24
24
  langgraph_api/store.py,sha256=NIoNZojs6NbtG3VLBPQEFNttvp7XPkHAfjbQ3gY7aLY,4701
25
25
  langgraph_api/stream.py,sha256=V8jWwA3wBRenMk3WIFkt0OLXm_LhPwg_Yj_tP4Dc6iI,18970
26
- langgraph_api/thread_ttl.py,sha256=7H3gFlWcUiODPoaEzcwB0LR61uvcuyjD0ew_4BztB7k,1902
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
@@ -36,7 +36,7 @@ langgraph_api/api/meta.py,sha256=dFD9ZgykbKARLdVSaJD9vO3CShvEyBmGpkjE8tqii0c,444
36
36
  langgraph_api/api/openapi.py,sha256=If-z1ckXt-Yu5bwQytK1LWyX_T7G46UtLfixgEP8hwc,11959
37
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=5L-NLqCazjxNZYBUWKo8HFYw7BdMVJd87prMVOH4gjE,12824
39
+ langgraph_api/api/threads.py,sha256=5-ZEcs48bL3vot_yCt3ImuA9hzg93LxuAd_DXd2xj4Y,12915
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
@@ -56,7 +56,7 @@ langgraph_api/js/client.mts,sha256=gDvYiW7Qfl4re2YhZ5oNqtuvffnW_Sf7DK5aUbKB3vw,3
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
58
  langgraph_api/js/package.json,sha256=syy2fEcmTxGQVfz4P9MUTgoTxHr1MUcA1rDXemAig2U,1335
59
- langgraph_api/js/remote.py,sha256=aeszJ0HGbcL9oExyeWYHb0xLV75U3KgVSxjm3ZK_a48,38403
59
+ langgraph_api/js/remote.py,sha256=iWs3SdmV7vFa28p04rYFSdFEGSYSlS3918AzWljKT9Q,38644
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
@@ -96,9 +96,9 @@ langgraph_runtime/retry.py,sha256=V0duD01fO7GUQ_btQkp1aoXcEOFhXooGVP6q4yMfuyY,11
96
96
  langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,114
97
97
  LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
98
98
  logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
99
- openapi.json,sha256=N5FnZvLNotTOGU_CU7tTpcX1hOwIVeYdSnFsdFrPKOg,171975
100
- langgraph_api-0.4.9.dist-info/METADATA,sha256=0RuwP4ixFFYBGR7vkq64zXa_F7CLPoThZVmNtnLW3q0,3892
101
- langgraph_api-0.4.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
102
- langgraph_api-0.4.9.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
103
- langgraph_api-0.4.9.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
104
- langgraph_api-0.4.9.dist-info/RECORD,,
99
+ openapi.json,sha256=21wu-NxdxyTQwZctNcEfRkLMnSBi0QhGAfwq5kg8XNU,172618
100
+ langgraph_api-0.4.11.dist-info/METADATA,sha256=hK2zyCzG6xb1reykMm0EeX_kXl_y2he20Bf2xHDWndM,3893
101
+ langgraph_api-0.4.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
102
+ langgraph_api-0.4.11.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
103
+ langgraph_api-0.4.11.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
104
+ langgraph_api-0.4.11.dist-info/RECORD,,
openapi.json CHANGED
@@ -5261,11 +5261,30 @@
5261
5261
  "type": "object",
5262
5262
  "title": "Metadata",
5263
5263
  "description": "Metadata to merge with existing thread metadata."
5264
+ },
5265
+ "ttl": {
5266
+ "type": "object",
5267
+ "title": "TTL",
5268
+ "description": "The time-to-live for the thread.",
5269
+ "properties": {
5270
+ "strategy": {
5271
+ "type": "string",
5272
+ "enum": [
5273
+ "delete"
5274
+ ],
5275
+ "description": "The TTL strategy. 'delete' removes the entire thread.",
5276
+ "default": "delete"
5277
+ },
5278
+ "ttl": {
5279
+ "type": "number",
5280
+ "description": "The time-to-live in minutes from now until thread should be swept."
5281
+ }
5282
+ }
5264
5283
  }
5265
5284
  },
5266
5285
  "type": "object",
5267
5286
  "title": "ThreadPatch",
5268
- "description": "Payload for creating a thread."
5287
+ "description": "Payload for updating a thread."
5269
5288
  },
5270
5289
  "ThreadStateCheckpointRequest": {
5271
5290
  "properties": {