From cff349e22ed2a70bcb8bf513577e290cd6a19c94 Mon Sep 17 00:00:00 2001 From: vbarda Date: Tue, 8 Apr 2025 13:34:47 -0400 Subject: [PATCH] add warning --- libs/langgraph/langgraph/pregel/remote.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/langgraph/langgraph/pregel/remote.py b/libs/langgraph/langgraph/pregel/remote.py index 07d44cb66..b5c38a046 100644 --- a/libs/langgraph/langgraph/pregel/remote.py +++ b/libs/langgraph/langgraph/pregel/remote.py @@ -1,3 +1,4 @@ +import warnings from dataclasses import asdict from typing import ( Any, @@ -620,6 +621,13 @@ class RemoteGraph(PregelProtocol): stream_mode, config ) if isinstance(input, Command): + if input.resume and "thread_id" not in sanitized_config["configurable"]: + warnings.warn( + "Trying to resume interrupted graph without `thread_id` in the config. " + "This will likely lead to downstream errors. Please provide a valid config in the following form: " + "{'configurable': {'thread_id': '...'}}." + ) + command: Optional[CommandSDK] = cast(CommandSDK, asdict(input)) input = None else: @@ -715,6 +723,13 @@ class RemoteGraph(PregelProtocol): stream_mode, config ) if isinstance(input, Command): + if input.resume and "thread_id" not in sanitized_config["configurable"]: + warnings.warn( + "Trying to resume interrupted graph without `thread_id` in the config. " + "This will likely lead to downstream errors. Please provide a valid config in the following form: " + "{'configurable': {'thread_id': '...'}}." + ) + command: Optional[CommandSDK] = cast(CommandSDK, asdict(input)) input = None else: