From a008725c06fd7d92e33b7c2f0910eca18494e999 Mon Sep 17 00:00:00 2001 From: Simon Moxon Date: Tue, 18 Feb 2025 17:49:31 +0000 Subject: [PATCH] Ensure remote respects recursion_limit param if it's passed (#3470) Currently when using RemoteGraph the recursion_limit cannot be set, due to the sanitize_config. --------- Co-authored-by: Simon Moxon Co-authored-by: Vadym Barda --- libs/langgraph/langgraph/pregel/remote.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/pregel/remote.py b/libs/langgraph/langgraph/pregel/remote.py index 45b837dd7..6ba547b14 100644 --- a/libs/langgraph/langgraph/pregel/remote.py +++ b/libs/langgraph/langgraph/pregel/remote.py @@ -323,11 +323,15 @@ class RemoteGraph(PregelProtocol): if k not in reserved_configurable_keys and not k.startswith("__pregel_") } - return { + sanitized: RunnableConfig = { "tags": config.get("tags") or [], "metadata": config.get("metadata") or {}, "configurable": new_configurable, } + if "recursion_limit" in config: + sanitized["recursion_limit"] = config["recursion_limit"] + + return sanitized def get_state( self, config: RunnableConfig, *, subgraphs: bool = False