langgraph-api 0.2.48__py3-none-any.whl → 0.2.51__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/asyncio.py +5 -2
- langgraph_api/middleware/http_logger.py +1 -3
- langgraph_api/middleware/request_id.py +3 -0
- langgraph_api/stream.py +2 -0
- langgraph_api/worker.py +11 -6
- {langgraph_api-0.2.48.dist-info → langgraph_api-0.2.51.dist-info}/METADATA +1 -1
- {langgraph_api-0.2.48.dist-info → langgraph_api-0.2.51.dist-info}/RECORD +11 -11
- {langgraph_api-0.2.48.dist-info → langgraph_api-0.2.51.dist-info}/WHEEL +0 -0
- {langgraph_api-0.2.48.dist-info → langgraph_api-0.2.51.dist-info}/entry_points.txt +0 -0
- {langgraph_api-0.2.48.dist-info → langgraph_api-0.2.51.dist-info}/licenses/LICENSE +0 -0
langgraph_api/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.51"
|
langgraph_api/asyncio.py
CHANGED
|
@@ -78,10 +78,13 @@ async def wait_if_not_done(coro: Coroutine[Any, Any, T], done: ValueEvent) -> T:
|
|
|
78
78
|
return await coro_task
|
|
79
79
|
except asyncio.CancelledError as e:
|
|
80
80
|
if e.args and asyncio.isfuture(e.args[-1]):
|
|
81
|
+
fut = e.args[-1]
|
|
81
82
|
await logger.ainfo(
|
|
82
|
-
"Awaiting future upon cancellation",
|
|
83
|
+
"Awaiting future upon cancellation.",
|
|
84
|
+
task=str(fut),
|
|
83
85
|
)
|
|
84
|
-
await
|
|
86
|
+
await fut
|
|
87
|
+
await logger.ainfo("Done awaiting.", task=str(fut))
|
|
85
88
|
if e.args and isinstance(e.args[0], Exception):
|
|
86
89
|
raise e.args[0] from None
|
|
87
90
|
raise
|
|
@@ -5,8 +5,6 @@ import structlog
|
|
|
5
5
|
from starlette.requests import ClientDisconnect
|
|
6
6
|
from starlette.types import Message, Receive, Scope, Send
|
|
7
7
|
|
|
8
|
-
from langgraph_api.logging import LOG_JSON
|
|
9
|
-
|
|
10
8
|
asgi = structlog.stdlib.get_logger("asgi")
|
|
11
9
|
|
|
12
10
|
PATHS_IGNORE = {"/ok", "/metrics"}
|
|
@@ -28,7 +26,7 @@ class AccessLoggerMiddleware:
|
|
|
28
26
|
self.debug_enabled = False
|
|
29
27
|
|
|
30
28
|
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
31
|
-
if scope["type"] != "http" or
|
|
29
|
+
if scope["type"] != "http" or scope.get("path") in PATHS_IGNORE:
|
|
32
30
|
return await self.app(scope, receive, send) # pragma: no cover
|
|
33
31
|
|
|
34
32
|
loop = asyncio.get_event_loop()
|
|
@@ -21,6 +21,8 @@ class RequestIdMiddleware:
|
|
|
21
21
|
|
|
22
22
|
async def __call__(self, scope: Scope, receive: Receive, send: Send):
|
|
23
23
|
if scope["type"] == "http" and self.pattern.match(scope["path"]):
|
|
24
|
+
from langgraph_api.logging import set_logging_context
|
|
25
|
+
|
|
24
26
|
request_id = next(
|
|
25
27
|
(h[1] for h in scope["headers"] if h[0] == b"x-request-id"),
|
|
26
28
|
None,
|
|
@@ -29,4 +31,5 @@ class RequestIdMiddleware:
|
|
|
29
31
|
request_id = str(uuid.uuid4()).encode()
|
|
30
32
|
scope["headers"].append((b"x-request-id", request_id))
|
|
31
33
|
scope["request_start_time_ms"] = int(time.time() * 1000)
|
|
34
|
+
set_logging_context({"request_id": request_id.decode()})
|
|
32
35
|
await self.app(scope, receive, send)
|
langgraph_api/stream.py
CHANGED
|
@@ -24,6 +24,7 @@ from langsmith.utils import get_tracer_project
|
|
|
24
24
|
from pydantic import ValidationError
|
|
25
25
|
from pydantic.v1 import ValidationError as ValidationErrorLegacy
|
|
26
26
|
|
|
27
|
+
from langgraph_api import __version__
|
|
27
28
|
from langgraph_api import store as api_store
|
|
28
29
|
from langgraph_api.asyncio import ValueEvent, wait_if_not_done
|
|
29
30
|
from langgraph_api.command import map_cmd
|
|
@@ -118,6 +119,7 @@ async def astream_state(
|
|
|
118
119
|
config["metadata"]["run_attempt"] = attempt
|
|
119
120
|
# attach langgraph metadata
|
|
120
121
|
config["metadata"]["langgraph_version"] = langgraph.version.__version__
|
|
122
|
+
config["metadata"]["langgraph_api_version"] = __version__
|
|
121
123
|
config["metadata"]["langgraph_plan"] = PLAN
|
|
122
124
|
config["metadata"]["langgraph_host"] = HOST
|
|
123
125
|
config["metadata"]["langgraph_api_url"] = USER_API_URL
|
langgraph_api/worker.py
CHANGED
|
@@ -178,11 +178,16 @@ async def worker(
|
|
|
178
178
|
else None
|
|
179
179
|
),
|
|
180
180
|
)
|
|
181
|
-
except Exception as ee:
|
|
182
|
-
# Note we don't handle asyncio.CancelledError here, as we want to
|
|
183
|
-
# let it bubble up and rollback db transaction, thus marking the run
|
|
184
|
-
# as available to be picked up by another worker
|
|
181
|
+
except (Exception, asyncio.CancelledError) as ee:
|
|
185
182
|
exception = ee
|
|
183
|
+
except BaseException as eee:
|
|
184
|
+
await logger.aerror(
|
|
185
|
+
"Bubbling failed background run",
|
|
186
|
+
run_id=str(run_id),
|
|
187
|
+
exception_type=str(type(eee)),
|
|
188
|
+
exception=str(eee),
|
|
189
|
+
)
|
|
190
|
+
raise
|
|
186
191
|
|
|
187
192
|
# handle exceptions and set status
|
|
188
193
|
async with connect() as conn:
|
|
@@ -286,7 +291,7 @@ async def worker(
|
|
|
286
291
|
run_ended_at_dt = datetime.now(UTC)
|
|
287
292
|
run_ended_at = run_ended_at_dt.isoformat()
|
|
288
293
|
await logger.awarning(
|
|
289
|
-
f"Background run failed, will retry. Exception: {exception}",
|
|
294
|
+
f"Background run failed, will retry. Exception: {type(exception)}({exception})",
|
|
290
295
|
exc_info=True,
|
|
291
296
|
run_id=str(run_id),
|
|
292
297
|
run_attempt=attempt,
|
|
@@ -301,7 +306,7 @@ async def worker(
|
|
|
301
306
|
run_ended_at_dt = datetime.now(UTC)
|
|
302
307
|
run_ended_at = run_ended_at_dt.isoformat()
|
|
303
308
|
await logger.aexception(
|
|
304
|
-
f"Background run failed. Exception: {exception}",
|
|
309
|
+
f"Background run failed. Exception: {type(exception)}({exception})",
|
|
305
310
|
exc_info=not isinstance(exception, RemoteException),
|
|
306
311
|
run_id=str(run_id),
|
|
307
312
|
run_attempt=attempt,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
langgraph_api/__init__.py,sha256=
|
|
1
|
+
langgraph_api/__init__.py,sha256=IVfgL24_F5j7rUHf7ys_SvphooWjDzcdlDH4HeGwa-E,23
|
|
2
2
|
langgraph_api/asgi_transport.py,sha256=eqifhHxNnxvI7jJqrY1_8RjL4Fp9NdN4prEub2FWBt8,5091
|
|
3
|
-
langgraph_api/asyncio.py,sha256=
|
|
3
|
+
langgraph_api/asyncio.py,sha256=Odnc6mAJIGF3eFWT8Xcrg2Zam7FwzXkfCWEHaXfrzQQ,9371
|
|
4
4
|
langgraph_api/cli.py,sha256=9Ou3tGDDY_VVLt5DFle8UviJdpI4ZigC5hElYvq2-To,14519
|
|
5
5
|
langgraph_api/command.py,sha256=3O9v3i0OPa96ARyJ_oJbLXkfO8rPgDhLCswgO9koTFA,768
|
|
6
6
|
langgraph_api/config.py,sha256=pFIZb4t2Vo7HbX0ZMjUNDR7Q7Bpj-stp_TmSmI026yo,11115
|
|
@@ -19,12 +19,12 @@ langgraph_api/server.py,sha256=Z_VL-kIphybTRDWBIqHMfRhgCmAFyTRqAGlgnHQF0Zg,6973
|
|
|
19
19
|
langgraph_api/sse.py,sha256=F7swfjKBDrlUmXZ_dWuDVHtp-3o1Cpjq1lwp0bJD-nw,4223
|
|
20
20
|
langgraph_api/state.py,sha256=8jx4IoTCOjTJuwzuXJKKFwo1VseHjNnw_CCq4x1SW14,2284
|
|
21
21
|
langgraph_api/store.py,sha256=_xGhdwEIMoY1_hIy_oWwxZp4Y7FH833BNJfgFIhT80E,4640
|
|
22
|
-
langgraph_api/stream.py,sha256=
|
|
22
|
+
langgraph_api/stream.py,sha256=UoJzqCzWhTVildxOlU87mX4NtZSUhtl1RGDeMFRYyNI,13660
|
|
23
23
|
langgraph_api/thread_ttl.py,sha256=-Ox8NFHqUH3wGNdEKMIfAXUubY5WGifIgCaJ7npqLgw,1762
|
|
24
24
|
langgraph_api/utils.py,sha256=92mSti9GfGdMRRWyESKQW5yV-75Z9icGHnIrBYvdypU,3619
|
|
25
25
|
langgraph_api/validation.py,sha256=zMuKmwUEBjBgFMwAaeLZmatwGVijKv2sOYtYg7gfRtc,4950
|
|
26
26
|
langgraph_api/webhook.py,sha256=1ncwO0rIZcj-Df9sxSnFEzd1gP1bfS4okeZQS8NSRoE,1382
|
|
27
|
-
langgraph_api/worker.py,sha256=
|
|
27
|
+
langgraph_api/worker.py,sha256=hg15i1UYRwuHWIzbOG_8HJk1FtUO8-Amcp1c2jIqiqg,15278
|
|
28
28
|
langgraph_api/api/__init__.py,sha256=YVzpbn5IQotvuuLG9fhS9QMrxXfP4s4EpEMG0n4q3Nw,5625
|
|
29
29
|
langgraph_api/api/assistants.py,sha256=6IPVKQBlI95-Z4nYdqBY9st9oynGJAocL67cwnDaZCk,15744
|
|
30
30
|
langgraph_api/api/mcp.py,sha256=RvRYgANqRzNQzSmgjNkq4RlKTtoEJYil04ot9lsmEtE,14352
|
|
@@ -66,9 +66,9 @@ langgraph_api/js/src/utils/importMap.mts,sha256=pX4TGOyUpuuWF82kXcxcv3-8mgusRezO
|
|
|
66
66
|
langgraph_api/js/src/utils/pythonSchemas.mts,sha256=98IW7Z_VP7L_CHNRMb3_MsiV3BgLE2JsWQY_PQcRR3o,685
|
|
67
67
|
langgraph_api/js/src/utils/serde.mts,sha256=D9o6MwTgwPezC_DEmsWS5NnLPnjPMVWIb1I1D4QPEPo,743
|
|
68
68
|
langgraph_api/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
|
-
langgraph_api/middleware/http_logger.py,sha256=
|
|
69
|
+
langgraph_api/middleware/http_logger.py,sha256=c1kLzngi_gpSV1V1O5kViIipkH9vDCmrZs8XPXfwPBs,3225
|
|
70
70
|
langgraph_api/middleware/private_network.py,sha256=eYgdyU8AzU2XJu362i1L8aSFoQRiV7_aLBPw7_EgeqI,2111
|
|
71
|
-
langgraph_api/middleware/request_id.py,sha256=
|
|
71
|
+
langgraph_api/middleware/request_id.py,sha256=SDj3Yi3WvTbFQ2ewrPQBjAV8sYReOJGeIiuoHeZpR9g,1242
|
|
72
72
|
langgraph_api/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
73
|
langgraph_api/models/run.py,sha256=j1s9KRfFXgjKUudB9z7IVJ34Klo85PPeaVFtmWHhEdo,14514
|
|
74
74
|
langgraph_api/tunneling/cloudflare.py,sha256=iKb6tj-VWPlDchHFjuQyep2Dpb-w2NGfJKt-WJG9LH0,3650
|
|
@@ -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.
|
|
90
|
-
langgraph_api-0.2.
|
|
91
|
-
langgraph_api-0.2.
|
|
92
|
-
langgraph_api-0.2.
|
|
93
|
-
langgraph_api-0.2.
|
|
89
|
+
langgraph_api-0.2.51.dist-info/METADATA,sha256=GME1y9H2-Xw8LoqNV6R0RW5VwF-ypHOCNKYlAmrNfXE,3891
|
|
90
|
+
langgraph_api-0.2.51.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
91
|
+
langgraph_api-0.2.51.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
|
|
92
|
+
langgraph_api-0.2.51.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
93
|
+
langgraph_api-0.2.51.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|