Skip to content

A programming framework for agentic AI

Copy llm config to avoid external changes (#2290)

Jack Gerrits16b1db3c90c7
diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py
index a2f021f57..a49f8a5b4 100644
--- a/autogen/agentchat/conversable_agent.py
+++ b/autogen/agentchat/conversable_agent.py
@@ -138,6 +138,9 @@ class ConversableAgent(LLMAgent):
if is_termination_msg is not None
else (lambda x: content_str(x.get("content")) == "TERMINATE")
)
+ # Take a copy to avoid modifying the given dict
+ if isinstance(llm_config, dict):
+ llm_config = copy.deepcopy(llm_config)
self._validate_llm_config(llm_config)