Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix: `ChatAgent` tool calling issue with `single_iteration=True` (#2105)

Ziyi Yangc396ea764f37
diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.py
index 38b98b4e1..020ae8bc3 100644
--- a/camel/agents/chat_agent.py
+++ b/camel/agents/chat_agent.py
@@ -603,9 +603,6 @@ class ChatAgent(BaseAgent):
self._get_full_tool_schemas(),
)
- if self.single_iteration:
- break
-
if tool_call_requests := response.tool_call_requests:
# Process all tool calls
for tool_call_request in tool_call_requests:
@@ -625,6 +622,9 @@ class ChatAgent(BaseAgent):
if external_tool_call_requests:
break
+ if self.single_iteration:
+ break
+
# If we're still here, continue the loop
continue
@@ -695,9 +695,6 @@ class ChatAgent(BaseAgent):
self._get_full_tool_schemas(),
)
- if self.single_iteration:
- break
-
if tool_call_requests := response.tool_call_requests:
# Process all tool calls
for tool_call_request in tool_call_requests:
@@ -718,6 +715,9 @@ class ChatAgent(BaseAgent):
if external_tool_call_requests:
break
+ if self.single_iteration:
+ break
+
# If we're still here, continue the loop
continue