Skip to content

Agent Zero AI framework

fix: reset retry counter on handled exceptions and add text to vision tool results

frdelf9743cb736a7
diff --git a/plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py b/plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py
index 599fcf986..6e01d551e 100644
--- a/plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py
+++ b/plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py
@@ -16,9 +16,11 @@ class RetryCriticalException(Extension):
exception = data.get("exception")
if not exception:
+ self.agent.set_data(DATA_NAME_COUNTER, 0) # reset counter if exception has been handled
return
if isinstance(exception, (HandledException, RepairableException)):
+ self.agent.set_data(DATA_NAME_COUNTER, 0) # reset counter if exception has been handled
return
max_retries = 1
diff --git a/tools/vision_load.py b/tools/vision_load.py
index 6bbd8bb9c..840f70162 100644
--- a/tools/vision_load.py
+++ b/tools/vision_load.py
@@ -56,6 +56,7 @@ class VisionLoad(Tool):
# build image data messages for LLMs, or error message
content = []
if self.images_dict:
+ self.agent.hist_add_tool_result(self.name, f"Processed {len(self.images_dict)} images") # some model providers break when they get have images in message history without text
for path, image in self.images_dict.items():
if image:
content.append(