langgraph-runtime-inmem 0.16.0__py3-none-any.whl → 0.17.1__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_runtime_inmem/__init__.py +1 -1
- langgraph_runtime_inmem/ops.py +29 -25
- {langgraph_runtime_inmem-0.16.0.dist-info → langgraph_runtime_inmem-0.17.1.dist-info}/METADATA +1 -1
- {langgraph_runtime_inmem-0.16.0.dist-info → langgraph_runtime_inmem-0.17.1.dist-info}/RECORD +5 -5
- {langgraph_runtime_inmem-0.16.0.dist-info → langgraph_runtime_inmem-0.17.1.dist-info}/WHEEL +0 -0
langgraph_runtime_inmem/ops.py
CHANGED
|
@@ -248,6 +248,8 @@ class Assistants(Authenticated):
|
|
|
248
248
|
description: str | None = None,
|
|
249
249
|
) -> AsyncIterator[Assistant]:
|
|
250
250
|
"""Insert an assistant."""
|
|
251
|
+
from langgraph_api.graph import GRAPHS
|
|
252
|
+
|
|
251
253
|
assistant_id = _ensure_uuid(assistant_id)
|
|
252
254
|
metadata = metadata if metadata is not None else {}
|
|
253
255
|
filters = await Assistants.handle_event(
|
|
@@ -269,6 +271,9 @@ class Assistants(Authenticated):
|
|
|
269
271
|
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.",
|
|
270
272
|
)
|
|
271
273
|
|
|
274
|
+
if graph_id not in GRAPHS:
|
|
275
|
+
raise HTTPException(status_code=404, detail=f"Graph {graph_id} not found")
|
|
276
|
+
|
|
272
277
|
# Keep config and context up to date with one another
|
|
273
278
|
if config.get("configurable"):
|
|
274
279
|
context = config["configurable"]
|
|
@@ -1947,38 +1952,37 @@ class Runs(Authenticated):
|
|
|
1947
1952
|
if not pending_runs and not running_runs:
|
|
1948
1953
|
return {
|
|
1949
1954
|
"n_pending": 0,
|
|
1950
|
-
"
|
|
1951
|
-
"
|
|
1955
|
+
"pending_runs_wait_time_max_secs": None,
|
|
1956
|
+
"pending_runs_wait_time_med_secs": None,
|
|
1952
1957
|
"n_running": 0,
|
|
1953
1958
|
}
|
|
1954
1959
|
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
median_time = sorted_times[median_idx]
|
|
1960
|
+
now = datetime.now(UTC)
|
|
1961
|
+
pending_waits: list[float] = []
|
|
1962
|
+
for run in pending_runs:
|
|
1963
|
+
created_at = run.get("created_at")
|
|
1964
|
+
if not isinstance(created_at, datetime):
|
|
1965
|
+
continue
|
|
1966
|
+
if created_at.tzinfo is None:
|
|
1967
|
+
created_at = created_at.replace(tzinfo=UTC)
|
|
1968
|
+
pending_waits.append((now - created_at).total_seconds())
|
|
1969
|
+
|
|
1970
|
+
max_pending_wait = max(pending_waits) if pending_waits else None
|
|
1971
|
+
if pending_waits:
|
|
1972
|
+
sorted_waits = sorted(pending_waits)
|
|
1973
|
+
half = len(sorted_waits) // 2
|
|
1974
|
+
if len(sorted_waits) % 2 == 1:
|
|
1975
|
+
med_pending_wait = sorted_waits[half]
|
|
1976
|
+
else:
|
|
1977
|
+
med_pending_wait = (sorted_waits[half - 1] + sorted_waits[half]) / 2
|
|
1978
|
+
else:
|
|
1979
|
+
med_pending_wait = None
|
|
1976
1980
|
|
|
1977
1981
|
return {
|
|
1978
1982
|
"n_pending": len(pending_runs),
|
|
1979
1983
|
"n_running": len(running_runs),
|
|
1980
|
-
"
|
|
1981
|
-
"
|
|
1984
|
+
"pending_runs_wait_time_max_secs": max_pending_wait,
|
|
1985
|
+
"pending_runs_wait_time_med_secs": med_pending_wait,
|
|
1982
1986
|
}
|
|
1983
1987
|
|
|
1984
1988
|
@staticmethod
|
{langgraph_runtime_inmem-0.16.0.dist-info → langgraph_runtime_inmem-0.17.1.dist-info}/RECORD
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
langgraph_runtime_inmem/__init__.py,sha256=
|
|
1
|
+
langgraph_runtime_inmem/__init__.py,sha256=xWciGBAIjNSLumyTQszfz9Bq-MYAzM9BGJ1nYR8feao,311
|
|
2
2
|
langgraph_runtime_inmem/checkpoint.py,sha256=nc1G8DqVdIu-ibjKTqXfbPfMbAsKjPObKqegrSzo6Po,4432
|
|
3
3
|
langgraph_runtime_inmem/database.py,sha256=g2XYa5KN-T8MbDeFH9sfUApDG62Wp4BACumVnDtxYhI,6403
|
|
4
4
|
langgraph_runtime_inmem/inmem_stream.py,sha256=PFLWbsxU8RqbT5mYJgNk6v5q6TWJRIY1hkZWhJF8nkI,9094
|
|
5
5
|
langgraph_runtime_inmem/lifespan.py,sha256=fCoYcN_h0cxmj6-muC-f0csPdSpyepZuGRD1yBrq4XM,4755
|
|
6
6
|
langgraph_runtime_inmem/metrics.py,sha256=_YiSkLnhQvHpMktk38SZo0abyL-5GihfVAtBo0-lFIc,403
|
|
7
|
-
langgraph_runtime_inmem/ops.py,sha256=
|
|
7
|
+
langgraph_runtime_inmem/ops.py,sha256=T-q2OxrK_Uw7NL9ac-B8VeZg_G-fcpBGNDtvcCBzLrs,108207
|
|
8
8
|
langgraph_runtime_inmem/queue.py,sha256=yV781CDjlsKNvkJ3puHyiHNnJpIIdB1G_gTY9dg6mys,9994
|
|
9
9
|
langgraph_runtime_inmem/retry.py,sha256=XmldOP4e_H5s264CagJRVnQMDFcEJR_dldVR1Hm5XvM,763
|
|
10
10
|
langgraph_runtime_inmem/store.py,sha256=rTfL1JJvd-j4xjTrL8qDcynaWF6gUJ9-GDVwH0NBD_I,3506
|
|
11
|
-
langgraph_runtime_inmem-0.
|
|
12
|
-
langgraph_runtime_inmem-0.
|
|
13
|
-
langgraph_runtime_inmem-0.
|
|
11
|
+
langgraph_runtime_inmem-0.17.1.dist-info/METADATA,sha256=pn-tX9xWNJbxajNmU5bD-RTwer6Mg4wCLEIlNKXWe8E,570
|
|
12
|
+
langgraph_runtime_inmem-0.17.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
+
langgraph_runtime_inmem-0.17.1.dist-info/RECORD,,
|
|
File without changes
|