langgraph-runtime-inmem 0.6.4__py3-none-any.whl → 0.6.5__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.6.4"
12
+ __version__ = "0.6.5"
13
13
  __all__ = [
14
14
  "ops",
15
15
  "database",
@@ -1958,10 +1958,16 @@ class Runs(Authenticated):
1958
1958
  # wait for the run to complete
1959
1959
  # Rely on this join's auth
1960
1960
  async for mode, chunk, _ in Runs.Stream.join(
1961
- run_id, thread_id=thread_id, ctx=ctx, ignore_404=True
1961
+ run_id,
1962
+ thread_id=thread_id,
1963
+ ctx=ctx,
1964
+ ignore_404=True,
1965
+ stream_mode=["values", "updates", "error"],
1962
1966
  ):
1963
1967
  if mode == b"values":
1964
1968
  last_chunk = chunk
1969
+ elif mode == b"updates" and b"__interrupt__" in chunk:
1970
+ last_chunk = chunk
1965
1971
  elif mode == b"error":
1966
1972
  last_chunk = orjson.dumps({"__error__": orjson.Fragment(chunk)})
1967
1973
  # if we received a final chunk, return it
@@ -2217,16 +2223,20 @@ class Runs(Authenticated):
2217
2223
  thread_id: UUID,
2218
2224
  ignore_404: bool = False,
2219
2225
  cancel_on_disconnect: bool = False,
2220
- stream_mode: StreamMode | asyncio.Queue | None = None,
2226
+ stream_channel: asyncio.Queue | None = None,
2227
+ stream_mode: list[StreamMode] | StreamMode,
2221
2228
  last_event_id: str | None = None,
2222
2229
  ctx: Auth.types.BaseAuthContext | None = None,
2223
2230
  ) -> AsyncIterator[tuple[bytes, bytes, bytes | None]]:
2224
2231
  """Stream the run output."""
2225
2232
  from langgraph_api.asyncio import create_task
2226
2233
 
2234
+ if stream_mode and not isinstance(stream_mode, list):
2235
+ stream_mode = [stream_mode]
2236
+
2227
2237
  queue = (
2228
- stream_mode
2229
- if isinstance(stream_mode, asyncio.Queue)
2238
+ stream_channel
2239
+ if stream_channel
2230
2240
  else await Runs.Stream.subscribe(run_id, stream_mode=stream_mode)
2231
2241
  )
2232
2242
 
@@ -2247,6 +2257,7 @@ class Runs(Authenticated):
2247
2257
  status_code=404, detail="Thread not found"
2248
2258
  )
2249
2259
  )
2260
+ run = await Runs.get(conn, run_id, thread_id=thread_id, ctx=ctx)
2250
2261
  channel_prefix = f"run:{run_id}:stream:"
2251
2262
  len_prefix = len(channel_prefix.encode())
2252
2263
 
@@ -2258,14 +2269,18 @@ class Runs(Authenticated):
2258
2269
  if data == b"done":
2259
2270
  return
2260
2271
  else:
2261
- yield topic[len_prefix:], data, id
2262
- logger.debug(
2263
- "Replayed run event",
2264
- run_id=str(run_id),
2265
- message_id=id,
2266
- stream_mode=topic[len_prefix:],
2267
- data=data,
2268
- )
2272
+ mode = topic[len_prefix:]
2273
+ if mode == b"updates" and "updates" not in stream_mode:
2274
+ continue
2275
+ else:
2276
+ yield mode, data, id
2277
+ logger.debug(
2278
+ "Replayed run event",
2279
+ run_id=str(run_id),
2280
+ message_id=id,
2281
+ stream_mode=mode,
2282
+ data=data,
2283
+ )
2269
2284
 
2270
2285
  while True:
2271
2286
  try:
@@ -2278,14 +2293,18 @@ class Runs(Authenticated):
2278
2293
  break
2279
2294
  else:
2280
2295
  # Extract mode from topic
2281
- yield topic[len_prefix:], data, id
2282
- logger.debug(
2283
- "Streamed run event",
2284
- run_id=str(run_id),
2285
- stream_mode=topic[len_prefix:],
2286
- message_id=id,
2287
- data=data,
2288
- )
2296
+ mode = topic[len_prefix:]
2297
+ if mode == b"updates" and "updates" not in stream_mode:
2298
+ continue
2299
+ else:
2300
+ yield mode, data, id
2301
+ logger.debug(
2302
+ "Streamed run event",
2303
+ run_id=str(run_id),
2304
+ stream_mode=mode,
2305
+ message_id=id,
2306
+ data=data,
2307
+ )
2289
2308
  except TimeoutError:
2290
2309
  # Check if the run is still pending
2291
2310
  run_iter = await Runs.get(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-runtime-inmem
3
- Version: 0.6.4
3
+ Version: 0.6.5
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=8jTuoC-OAbGipvvHN2ZvFRwD7HOFnZxWa616pD7txnY,310
1
+ langgraph_runtime_inmem/__init__.py,sha256=7ZlQb18PXzQs7_4a2uRikDkayCr8hn_23HL6X31aQTs,310
2
2
  langgraph_runtime_inmem/checkpoint.py,sha256=nc1G8DqVdIu-ibjKTqXfbPfMbAsKjPObKqegrSzo6Po,4432
3
3
  langgraph_runtime_inmem/database.py,sha256=bOPc9cgHysMnJ_RbRpU0yOLxK4ERL9et7artgTBEecY,6280
4
4
  langgraph_runtime_inmem/inmem_stream.py,sha256=65z_2mBNJ0-yJsXWnlYwRc71039_y6Sa0MN8fL_U3Ko,4581
5
5
  langgraph_runtime_inmem/lifespan.py,sha256=t0w2MX2dGxe8yNtSX97Z-d2pFpllSLS4s1rh2GJDw5M,3557
6
6
  langgraph_runtime_inmem/metrics.py,sha256=HhO0RC2bMDTDyGBNvnd2ooLebLA8P1u5oq978Kp_nAA,392
7
- langgraph_runtime_inmem/ops.py,sha256=6ZI-PUr1wfJoSoJ4LOn-dsAuIOTPkEODwvK1g4O1OZc,88538
7
+ langgraph_runtime_inmem/ops.py,sha256=F4jGZoSjeWTEHkVzWYG5Lto00NpYyzReslLfNH1YjLM,89404
8
8
  langgraph_runtime_inmem/queue.py,sha256=nqfgz7j_Jkh5Ek5-RsHB2Uvwbxguu9IUPkGXIxvFPns,10037
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.6.4.dist-info/METADATA,sha256=JyDtIIEb7c6nSx6xBUNUTBx5ZuYhGWT0hlzfog4Q5PU,565
12
- langgraph_runtime_inmem-0.6.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- langgraph_runtime_inmem-0.6.4.dist-info/RECORD,,
11
+ langgraph_runtime_inmem-0.6.5.dist-info/METADATA,sha256=6lfwWslBEdf5eTHRVTNmdYnYpct9Lw2P6EzBxNbAj1I,565
12
+ langgraph_runtime_inmem-0.6.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ langgraph_runtime_inmem-0.6.5.dist-info/RECORD,,