From 2c945ceb683ec6fa9feacec3ee6fb073113d6110 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Mon, 18 Nov 2024 17:17:20 -0800 Subject: [PATCH] Copy configurable in ensure_config --- libs/langgraph/langgraph/utils/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/utils/config.py b/libs/langgraph/langgraph/utils/config.py index 47de1f021..adb26dd89 100644 --- a/libs/langgraph/langgraph/utils/config.py +++ b/libs/langgraph/langgraph/utils/config.py @@ -280,7 +280,10 @@ def ensure_config(*configs: Optional[RunnableConfig]) -> RunnableConfig: continue for k, v in config.items(): if v is not None and k in CONFIG_KEYS: - empty[k] = v # type: ignore[literal-required] + if k == CONF: + empty[k] = v.copy() # type: ignore[literal-required] + else: + empty[k] = v # type: ignore[literal-required] for k, v in config.items(): if v is not None and k not in CONFIG_KEYS: empty[CONF][k] = v