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.
This commit is contained in:
frdel 2026-02-18 17:26:32 +01:00
parent 7ab276098c
commit 01cdb7b92d

View file

@ -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