From 01cdb7b92d7df02ea39b7dcf45009526c174243a Mon Sep 17 00:00:00 2001 From: frdel <38891707+frdel@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:26:32 +0100 Subject: [PATCH] Reset error_retries on successful loop iteration Reset the error_retries counter immediately after a successful message-loop iteration inside the Agent class, and remove the redundant reset outside the loop. This consolidates the retry counter logic so it is cleared only when an iteration completes successfully. --- agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent.py b/agent.py index b070cfc08..38357bf5f 100644 --- a/agent.py +++ b/agent.py @@ -491,6 +491,8 @@ class Agent: if tools_result: # final response of message loop available return tools_result # break the execution if the task is done + error_retries = 0 # reset retry counter on successful iteration + # exceptions inside message loop: except InterventionException as e: error_retries = 0 # reset retry counter on user intervention @@ -515,8 +517,6 @@ class Agent: "message_loop_end", loop_data=self.loop_data ) - error_retries = 0 # reset retry counter on successful iteration - # exceptions outside message loop: except InterventionException as e: error_retries = 0 # reset retry counter on user intervention