langgraph-api 0.2.54__py3-none-any.whl → 0.2.56__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.2.54"
1
+ __version__ = "0.2.56"
@@ -10,11 +10,13 @@ if not (
10
10
  truststore.inject_into_ssl() # noqa: F401
11
11
 
12
12
  import asyncio
13
+ import contextlib
13
14
  import http.server
14
15
  import json
15
16
  import logging.config
16
17
  import os
17
18
  import pathlib
19
+ import signal
18
20
 
19
21
  import structlog
20
22
  import uvloop
@@ -60,25 +62,39 @@ async def entrypoint():
60
62
 
61
63
  lg_logging.set_logging_context({"entrypoint": "python-queue"})
62
64
  tasks: set[asyncio.Task] = set()
63
- # start simple http server for health checks
64
65
  tasks.add(asyncio.create_task(healthcheck_server()))
65
- # start queue and associated tasks
66
66
  async with lifespan(None, with_cron_scheduler=False, taskset=tasks):
67
- # run forever, error if any tasks fail
68
- try:
69
- await asyncio.gather(*tasks)
70
- except asyncio.CancelledError:
71
- await logger.awarning("Queue entrypoint cancelled", exc_info=True)
67
+ await asyncio.gather(*tasks)
68
+
69
+
70
+ async def main():
71
+ """Run the queue entrypoint and shut down gracefully on SIGTERM/SIGINT."""
72
+ loop = asyncio.get_running_loop()
73
+ stop_event = asyncio.Event()
74
+
75
+ def _handle_signal() -> None:
76
+ logger.warning("Received termination signal, initiating graceful shutdown")
77
+ stop_event.set()
78
+
79
+ try:
80
+ loop.add_signal_handler(signal.SIGTERM, _handle_signal)
81
+ except (NotImplementedError, RuntimeError):
82
+ signal.signal(signal.SIGTERM, lambda *_: _handle_signal())
83
+
84
+ entry_task = asyncio.create_task(entrypoint())
85
+ await stop_event.wait()
86
+
87
+ logger.warning("Cancelling queue entrypoint task")
88
+ entry_task.cancel()
89
+ with contextlib.suppress(asyncio.CancelledError):
90
+ await entry_task
72
91
 
73
92
 
74
93
  if __name__ == "__main__":
75
- # set up logging
76
94
  with open(pathlib.Path(__file__).parent.parent / "logging.json") as file:
77
95
  loaded_config = json.load(file)
78
96
  logging.config.dictConfig(loaded_config)
79
97
 
80
- # set up uvloop
81
98
  uvloop.install()
82
99
 
83
- # run the entrypoint
84
- asyncio.run(entrypoint())
100
+ asyncio.run(main())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.2.54
3
+ Version: 0.2.56
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
@@ -1,4 +1,4 @@
1
- langgraph_api/__init__.py,sha256=oNewG1bC0xUC2UKGSu-zMR1_CZwFYXnhulfuiJ3G4hw,23
1
+ langgraph_api/__init__.py,sha256=yuhEwVPZG_uwEXVduMxOuyth-d2aFtmKNM7h6XPNHtM,23
2
2
  langgraph_api/asgi_transport.py,sha256=eqifhHxNnxvI7jJqrY1_8RjL4Fp9NdN4prEub2FWBt8,5091
3
3
  langgraph_api/asyncio.py,sha256=Odnc6mAJIGF3eFWT8Xcrg2Zam7FwzXkfCWEHaXfrzQQ,9371
4
4
  langgraph_api/cli.py,sha256=9Ou3tGDDY_VVLt5DFle8UviJdpI4ZigC5hElYvq2-To,14519
@@ -11,7 +11,7 @@ langgraph_api/http.py,sha256=gYbxxjY8aLnsXeJymcJ7G7Nj_yToOGpPYQqmZ1_ggfA,5240
11
11
  langgraph_api/logging.py,sha256=1BXELwUBY8gZeOWCYElbBu_GyHLM2jjlDVJznlekqvQ,4268
12
12
  langgraph_api/metadata.py,sha256=Gx0b6YszLRjdWLDVN8OcVgC_YYQG_nQitPfUfgQx1w8,4648
13
13
  langgraph_api/patch.py,sha256=Dgs0PXHytekX4SUL6KsjjN0hHcOtGLvv1GRGbh6PswU,1408
14
- langgraph_api/queue_entrypoint.py,sha256=dzEOqW4AHGjDKMlsNYBMVjHfQM7pm_49LImfa5G5ySM,2491
14
+ langgraph_api/queue_entrypoint.py,sha256=rW4-OEsWwBsLLp6U0P-de-I0tR3gPZaeBKWB3LRrTr0,2923
15
15
  langgraph_api/route.py,sha256=4VBkJMeusfiZtLzyUaKm1HwLHTq0g15y2CRiRhM6xyA,4773
16
16
  langgraph_api/schema.py,sha256=2711t4PIBk5dky4gmMndrTRC9CVvAgH47C9FKDxhkBo,5444
17
17
  langgraph_api/serde.py,sha256=8fQXg7T7RVUqj_jgOoSOJrWVpQDW0qJKjAjSsEhPHo4,4803
@@ -86,8 +86,8 @@ langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,11
86
86
  LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
87
87
  logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
88
88
  openapi.json,sha256=wrJup7sCRlZXTRagjzGZ7474U1wma4ZzYTkkninrT6M,141875
89
- langgraph_api-0.2.54.dist-info/METADATA,sha256=fL0RwEb1lBCBPnjK0nwECORd51dAbiuDMRuz6YLW_Xk,3891
90
- langgraph_api-0.2.54.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
91
- langgraph_api-0.2.54.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
92
- langgraph_api-0.2.54.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
93
- langgraph_api-0.2.54.dist-info/RECORD,,
89
+ langgraph_api-0.2.56.dist-info/METADATA,sha256=wfCknYuOUBNVrO4AM6m33ekJis6bPutLf-EWFDWpPTw,3891
90
+ langgraph_api-0.2.56.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
91
+ langgraph_api-0.2.56.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
92
+ langgraph_api-0.2.56.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
93
+ langgraph_api-0.2.56.dist-info/RECORD,,