langgraph-runtime-inmem 0.39.0.dev5__tar.gz → 0.39.0.dev6__tar.gz

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.
Files changed (19) hide show
  1. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/PKG-INFO +1 -1
  2. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/__init__.py +1 -1
  3. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/ops.py +31 -6
  4. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/.gitignore +0 -0
  5. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/Makefile +0 -0
  6. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/README.md +0 -0
  7. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/_persistence.py +0 -0
  8. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/checkpoint.py +0 -0
  9. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/database.py +0 -0
  10. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/encryption.py +0 -0
  11. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/inmem_stream.py +0 -0
  12. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/lifespan.py +0 -0
  13. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/metrics.py +0 -0
  14. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/queue.py +0 -0
  15. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/retry.py +0 -0
  16. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/routes.py +0 -0
  17. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/langgraph_runtime_inmem/store.py +0 -0
  18. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/pyproject.toml +0 -0
  19. {langgraph_runtime_inmem-0.39.0.dev5 → langgraph_runtime_inmem-0.39.0.dev6}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-runtime-inmem
3
- Version: 0.39.0.dev5
3
+ Version: 0.39.0.dev6
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
@@ -11,7 +11,7 @@ from langgraph_runtime_inmem import (
11
11
  store,
12
12
  )
13
13
 
14
- __version__ = "0.39.0.dev5"
14
+ __version__ = "0.39.0.dev6"
15
15
  __all__ = [
16
16
  "ops",
17
17
  "database",
@@ -194,6 +194,8 @@ async def _save_thread_status(
194
194
  checkpoint: CheckpointPayload | None,
195
195
  exception: BaseException | None,
196
196
  now: datetime,
197
+ *,
198
+ refused: bool = False,
197
199
  ) -> None:
198
200
  """Write a thread's status and error from the facts this update knows.
199
201
 
@@ -201,21 +203,26 @@ async def _save_thread_status(
201
203
  Without a checkpoint there is nothing to replace values, interrupts and
202
204
  has_next with, so the thread keeps the ones it already has. has_next is
203
205
  recorded only once the thread is saved, so a failed save can't leave the two
204
- apart.
206
+ apart. A resume that strict mode refused ran nothing, so the thread keeps the
207
+ error, or lack of one, it had.
205
208
  """
206
209
  from langgraph_api.serde import json_dumpb, json_loads # noqa: PLC0415
207
210
 
208
- failure = _thread_failure(exception)
211
+ failure = None if refused else _thread_failure(exception)
209
212
  has_next = None if checkpoint is None else bool(checkpoint["next"])
210
213
 
211
214
  update: dict = {
212
215
  "updated_at": now,
213
216
  "state_updated_at": now,
214
217
  "status": _thread_status(
215
- conn, thread_id, failed=failure is not None, has_next=has_next
218
+ conn,
219
+ thread_id,
220
+ failed=None if refused else failure is not None,
221
+ has_next=has_next,
216
222
  ),
217
- "error": json_loads(json_dumpb(failure)) if failure else None,
218
223
  }
224
+ if not refused:
225
+ update["error"] = json_loads(json_dumpb(failure)) if failure else None
219
226
  if checkpoint is not None:
220
227
  update["values"] = json_loads(json_dumpb(checkpoint["values"]))
221
228
  update["interrupts"] = json_loads(
@@ -236,7 +243,8 @@ async def _save_thread_status(
236
243
  # facts apart from the thread.
237
244
  if has_next is not None:
238
245
  _thread_has_next(conn)[thread_id] = has_next
239
- _thread_failed(conn)[thread_id] = failure is not None
246
+ if not refused:
247
+ _thread_failed(conn)[thread_id] = failure is not None
240
248
 
241
249
 
242
250
  def _run_stream_mode_matches(event_mode: str, stream_mode: list[str] | None) -> bool:
@@ -1526,6 +1534,8 @@ class Threads(Authenticated):
1526
1534
  graph_id: str,
1527
1535
  checkpoint: CheckpointPayload | None = None,
1528
1536
  exception: BaseException | None = None,
1537
+ *,
1538
+ refused_resume: bool = False,
1529
1539
  ) -> None:
1530
1540
  """Set the status of both thread and run atomically in a single query.
1531
1541
 
@@ -1539,6 +1549,8 @@ class Threads(Authenticated):
1539
1549
  run_status: New status for the run (or "rollback" to delete the run)
1540
1550
  checkpoint: Checkpoint payload for thread status calculation
1541
1551
  exception: Exception that occurred (affects thread status)
1552
+ refused_resume: Strict resume refused the run's answer before anything
1553
+ ran, so the thread keeps its error, or lack of one, as it was.
1542
1554
  """
1543
1555
  # No auth since it's internal
1544
1556
  thread_id = _ensure_uuid(thread_id)
@@ -1569,13 +1581,21 @@ class Threads(Authenticated):
1569
1581
  if run.get("cancel_action") == "rollback":
1570
1582
  # A rollback recorded while the run ran wins over the signal its worker saw first, as in Go.
1571
1583
  run_status, checkpoint, exception = "rollback", None, None
1584
+ refused_resume = False
1572
1585
  if run_status == "rollback":
1573
1586
  await Runs.delete(conn, run_id, thread_id=run["thread_id"])
1574
1587
  else:
1575
1588
  run.update({"status": run_status, "updated_at": now})
1576
1589
  thread["metadata"]["graph_id"] = graph_id
1577
1590
  await _save_thread_status(
1578
- conn, thread_id, thread, stored_thread, checkpoint, exception, now
1591
+ conn,
1592
+ thread_id,
1593
+ thread,
1594
+ stored_thread,
1595
+ checkpoint,
1596
+ exception,
1597
+ now,
1598
+ refused=refused_resume,
1579
1599
  )
1580
1600
 
1581
1601
  @staticmethod
@@ -3133,6 +3153,11 @@ class Runs(Authenticated):
3133
3153
  else None
3134
3154
  )
3135
3155
 
3156
+ # A run that cancels the runs in flight replaces them, so refusing its
3157
+ # answer would stop the agent mid-turn: it never resumes strictly.
3158
+ if multitask_strategy in ("interrupt", "rollback") and inflight_runs:
3159
+ kwargs = {k: v for k, v in kwargs.items() if k != "strict_resume"}
3160
+
3136
3161
  # Create new run
3137
3162
  configurable = Runs._merge_jsonb(
3138
3163
  Runs._get_configurable(assistant["config"]),