langgraph-runtime-inmem 0.17.0__py3-none-any.whl → 0.18.0__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.
@@ -9,7 +9,7 @@ from langgraph_runtime_inmem import (
9
9
  store,
10
10
  )
11
11
 
12
- __version__ = "0.17.0"
12
+ __version__ = "0.18.0"
13
13
  __all__ = [
14
14
  "ops",
15
15
  "database",
@@ -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"]
@@ -1695,7 +1700,9 @@ class Threads(Authenticated):
1695
1700
 
1696
1701
  return []
1697
1702
 
1698
- class Stream:
1703
+ class Stream(Authenticated):
1704
+ resource = "threads"
1705
+
1699
1706
  @staticmethod
1700
1707
  async def subscribe(
1701
1708
  conn: InMemConnectionProto | AsyncConnectionProto,
@@ -1731,8 +1738,11 @@ class Threads(Authenticated):
1731
1738
  *,
1732
1739
  last_event_id: str | None = None,
1733
1740
  stream_modes: list[ThreadStreamMode],
1741
+ ctx: Auth.types.BaseAuthContext | None = None,
1734
1742
  ) -> AsyncIterator[tuple[bytes, bytes, bytes | None]]:
1735
1743
  """Stream the thread output."""
1744
+ await Threads.Stream.check_thread_stream_auth(thread_id, ctx)
1745
+
1736
1746
  from langgraph_api.utils.stream_codec import (
1737
1747
  decode_stream_message,
1738
1748
  )
@@ -1884,6 +1894,24 @@ class Threads(Authenticated):
1884
1894
  str(thread_id), Message(topic=topic, data=payload)
1885
1895
  )
1886
1896
 
1897
+ @staticmethod
1898
+ async def check_thread_stream_auth(
1899
+ thread_id: UUID,
1900
+ ctx: Auth.types.BaseAuthContext | None = None,
1901
+ ) -> None:
1902
+ async with connect() as conn:
1903
+ filters = await Threads.Stream.handle_event(
1904
+ ctx,
1905
+ "read",
1906
+ Auth.types.ThreadsRead(thread_id=thread_id),
1907
+ )
1908
+ if filters:
1909
+ thread = await Threads._get_with_filters(
1910
+ cast(InMemConnectionProto, conn), thread_id, filters
1911
+ )
1912
+ if not thread:
1913
+ raise HTTPException(status_code=404, detail="Thread not found")
1914
+
1887
1915
  @staticmethod
1888
1916
  async def count(
1889
1917
  conn: InMemConnectionProto,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-runtime-inmem
3
- Version: 0.17.0
3
+ Version: 0.18.0
4
4
  Summary: Inmem implementation for the LangGraph API server.
5
5
  Author-email: Will Fu-Hinthorn <will@langchain.dev>
6
6
  License: Elastic-2.0
@@ -1,13 +1,13 @@
1
- langgraph_runtime_inmem/__init__.py,sha256=JHK5o7GR1hY1R4dqdV2cSGwXFa-JFQeQ6RB3e8-9M6U,311
1
+ langgraph_runtime_inmem/__init__.py,sha256=0OJlzkajmSaVNDTxR81HA_IpgMleuq6KhszFWEohtGM,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=niaZnC5Q7Mk6A1Edr9bC-TusBlvqMx_jvf2-md8aEAw,108036
7
+ langgraph_runtime_inmem/ops.py,sha256=umfHzcvGX8hdzAxYryeX5doCyA9HnfwEeEPupj7Ckyg,109111
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.17.0.dist-info/METADATA,sha256=u8rDo2LJnO4kUWjhiaU2ZGAYljKVO1JjqhdYHBJZE2c,570
12
- langgraph_runtime_inmem-0.17.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- langgraph_runtime_inmem-0.17.0.dist-info/RECORD,,
11
+ langgraph_runtime_inmem-0.18.0.dist-info/METADATA,sha256=oigJEnL7JdWwUoUK6pos7aCx9PZaDbIXyzd2RaTqyR4,570
12
+ langgraph_runtime_inmem-0.18.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ langgraph_runtime_inmem-0.18.0.dist-info/RECORD,,