summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaptainJack2491 <jayrupnakawala@gmail.com>2026-05-08 11:25:28 +0100
committerCaptainJack2491 <jayrupnakawala@gmail.com>2026-05-08 11:25:28 +0100
commit2b409e90625ecf7c74d4e44b523904a671cb15fa (patch)
tree8ed85a7d93ef0b3b0385518514bae69b97307edd
parent0f3128fb9cadb1b30c7247a3ccb614dc3661e825 (diff)
fixed bug or something
-rw-r--r--src/agent.py7
1 files 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