From 2b409e90625ecf7c74d4e44b523904a671cb15fa Mon Sep 17 00:00:00 2001 From: CaptainJack2491 Date: Fri, 8 May 2026 11:25:28 +0100 Subject: fixed bug or something --- src/agent.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/agent.py b/src/agent.py index 5df0434..4880305 100644 --- a/src/agent.py +++ b/src/agent.py @@ -267,10 +267,9 @@ class Agent: self.logs.append(log_entry) self._save_partial() # Incremental save after each assistant response - # Check finish_reason to determine if we should continue or stop - # "tool_calls" means model wants to call tools (continue) - # "stop" means model wants to end conversation - if finish_reason == "tool_calls": + # Check for tool calls FIRST (some models like Gemini return + # finish_reason="stop" even when tool_calls are present) + if response_message.tool_calls: logger.info(f"LLM requested {len(response_message.tool_calls)} tool execution(s)") for tool_call in response_message.tool_calls: function_name = tool_call.function.name -- cgit v1.2.3