A programming framework for agentic AI
deprecate using None for code_execution_config (#1506)
Jack Gerrits9cd458ecbce7
diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.pyindex 44115d258..348f14f54 100644--- a/autogen/agentchat/conversable_agent.py+++ b/autogen/agentchat/conversable_agent.py@@ -7,6 +7,7 @@ import loggingimport refrom collections import defaultdictfrom typing import Any, Awaitable, Callable, Dict, List, Literal, Optional, Tuple, Type, TypeVar, Union+import warningsfrom .. import OpenAIWrapperfrom ..cache.cache import Cache@@ -69,7 +70,7 @@ class ConversableAgent(Agent):max_consecutive_auto_reply: Optional[int] = None,human_input_mode: Optional[str] = "TERMINATE",function_map: Optional[Dict[str, Callable]] = None,- code_execution_config: Optional[Union[Dict, Literal[False]]] = None,+ code_execution_config: Union[Dict, Literal[False]] = {},llm_config: Optional[Union[Dict, Literal[False]]] = None,default_auto_reply: Optional[Union[str, Dict, None]] = "",description: Optional[str] = None,@@ -139,6 +140,13 @@ class ConversableAgent(Agent):# Initialize standalone client cache object.self.client_cache = None+ if code_execution_config is None:+ warnings.warn(+ "Using None to signal a default code_execution_config is deprecated. "+ "Use {} to use default or False to disable code execution.",+ stacklevel=2,+ )+self._code_execution_config: Union[Dict, Literal[False]] = ({} if code_execution_config is None else code_execution_config)