langgraph-runtime-inmem 0.36.0.dev1__tar.gz → 0.36.0.dev3__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.
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/PKG-INFO +1 -1
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/__init__.py +1 -1
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/inmem_stream.py +2 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/ops.py +29 -15
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/.gitignore +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/Makefile +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/README.md +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/_persistence.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/checkpoint.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/database.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/lifespan.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/metrics.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/queue.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/retry.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/routes.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/langgraph_runtime_inmem/store.py +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/pyproject.toml +0 -0
- {langgraph_runtime_inmem-0.36.0.dev1 → langgraph_runtime_inmem-0.36.0.dev3}/uv.lock +0 -0
|
@@ -620,6 +620,7 @@ class Assistants(Authenticated):
|
|
|
620
620
|
assistant_id=assistant_id,
|
|
621
621
|
action="interrupt",
|
|
622
622
|
ctx=ctx,
|
|
623
|
+
reason=f"assistant {assistant_id} was deleted",
|
|
623
624
|
)
|
|
624
625
|
|
|
625
626
|
# 4. Delete assistant
|
|
@@ -2858,6 +2859,7 @@ class Runs(Authenticated):
|
|
|
2858
2859
|
status: Literal["pending", "running", "all"] | None = None,
|
|
2859
2860
|
assistant_id: UUID | None = None,
|
|
2860
2861
|
ctx: Auth.types.BaseAuthContext | None = None,
|
|
2862
|
+
reason: str | None = None,
|
|
2861
2863
|
) -> None:
|
|
2862
2864
|
"""
|
|
2863
2865
|
Cancel runs in memory. Must provide either:
|
|
@@ -2971,6 +2973,7 @@ class Runs(Authenticated):
|
|
|
2971
2973
|
control_message = Message(
|
|
2972
2974
|
topic=f"run:{run_id}:control".encode(),
|
|
2973
2975
|
data=action.encode(),
|
|
2976
|
+
reason=reason,
|
|
2974
2977
|
)
|
|
2975
2978
|
coros.append(stream_manager.put(run_id, thread_id, control_message))
|
|
2976
2979
|
|
|
@@ -3224,7 +3227,13 @@ class Runs(Authenticated):
|
|
|
3224
3227
|
raise e.http_exception from None
|
|
3225
3228
|
except:
|
|
3226
3229
|
if cancel_on_disconnect:
|
|
3227
|
-
create_task(
|
|
3230
|
+
create_task(
|
|
3231
|
+
cancel_run(
|
|
3232
|
+
thread_id,
|
|
3233
|
+
run_id,
|
|
3234
|
+
reason="client disconnected from the run stream (on_disconnect=cancel)",
|
|
3235
|
+
)
|
|
3236
|
+
)
|
|
3228
3237
|
raise
|
|
3229
3238
|
finally:
|
|
3230
3239
|
stream_manager = get_stream_manager()
|
|
@@ -3279,25 +3288,27 @@ async def listen_for_cancellation(
|
|
|
3279
3288
|
|
|
3280
3289
|
stream_manager = get_stream_manager()
|
|
3281
3290
|
|
|
3291
|
+
def _handle_control_message(message: Message) -> bool:
|
|
3292
|
+
"""Set `done` from a control message. Returns True once the run is done."""
|
|
3293
|
+
reason = message.reason
|
|
3294
|
+
if message.data == b"rollback":
|
|
3295
|
+
done.set(UserRollback(reason) if reason else UserRollback())
|
|
3296
|
+
elif message.data == b"interrupt":
|
|
3297
|
+
done.set(UserInterrupt(reason) if reason else UserInterrupt())
|
|
3298
|
+
elif message.data == b"done":
|
|
3299
|
+
done.set()
|
|
3300
|
+
return True
|
|
3301
|
+
return False
|
|
3302
|
+
|
|
3282
3303
|
if control_key := stream_manager.get_control_key(run_id, thread_id):
|
|
3283
|
-
|
|
3284
|
-
if payload == b"rollback":
|
|
3285
|
-
done.set(UserRollback())
|
|
3286
|
-
elif payload == b"interrupt":
|
|
3287
|
-
done.set(UserInterrupt())
|
|
3304
|
+
_handle_control_message(control_key)
|
|
3288
3305
|
|
|
3289
3306
|
while not done.is_set():
|
|
3290
3307
|
try:
|
|
3291
3308
|
# This task gets cancelled when Runs.enter exits anyway,
|
|
3292
3309
|
# so we can have a pretty lengthy timeout here
|
|
3293
3310
|
message = await asyncio.wait_for(queue.get(), timeout=240)
|
|
3294
|
-
|
|
3295
|
-
if payload == b"rollback":
|
|
3296
|
-
done.set(UserRollback())
|
|
3297
|
-
elif payload == b"interrupt":
|
|
3298
|
-
done.set(UserInterrupt())
|
|
3299
|
-
elif payload == b"done":
|
|
3300
|
-
done.set()
|
|
3311
|
+
if _handle_control_message(message):
|
|
3301
3312
|
break
|
|
3302
3313
|
except TimeoutError:
|
|
3303
3314
|
break
|
|
@@ -3896,10 +3907,13 @@ class Crons(Authenticated):
|
|
|
3896
3907
|
|
|
3897
3908
|
|
|
3898
3909
|
async def cancel_run(
|
|
3899
|
-
thread_id: UUID,
|
|
3910
|
+
thread_id: UUID,
|
|
3911
|
+
run_id: UUID,
|
|
3912
|
+
ctx: Auth.types.BaseAuthContext | None = None,
|
|
3913
|
+
reason: str | None = None,
|
|
3900
3914
|
) -> None:
|
|
3901
3915
|
async with connect() as conn:
|
|
3902
|
-
await Runs.cancel(conn, [run_id], thread_id=thread_id, ctx=ctx)
|
|
3916
|
+
await Runs.cancel(conn, [run_id], thread_id=thread_id, ctx=ctx, reason=reason)
|
|
3903
3917
|
|
|
3904
3918
|
|
|
3905
3919
|
async def _get_checkpointer(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|