Skip to content

A programming framework for agentic AI

Raise errors if incompatible args are used with an executor (#1855)

Jack Gerritsb604c4410145
diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py
index 0d968f2ac..19f2a4c2a 100644
--- a/autogen/agentchat/conversable_agent.py
+++ b/autogen/agentchat/conversable_agent.py
@@ -197,6 +197,21 @@ class ConversableAgent(LLMAgent):
self._code_execution_config = code_execution_config
if self._code_execution_config.get("executor") is not None:
+ if "use_docker" in self._code_execution_config:
+ raise ValueError(
+ "'use_docker' in code_execution_config is not valid when 'executor' is set. Use the appropriate arg in the chosen executor instead."
+ )
+
+ if "work_dir" in self._code_execution_config:
+ raise ValueError(
+ "'work_dir' in code_execution_config is not valid when 'executor' is set. Use the appropriate arg in the chosen executor instead."
+ )
+
+ if "timeout" in self._code_execution_config:
+ raise ValueError(
+ "'timeout' in code_execution_config is not valid when 'executor' is set. Use the appropriate arg in the chosen executor instead."
+ )
+
# Use the new code executor.
self._code_executor = CodeExecutorFactory.create(self._code_execution_config)
self.register_reply([Agent, None], ConversableAgent._generate_code_execution_reply_using_executor)