Skip to content

Commit 2ff844d

Browse files
committed
Add error handling for action annotation in get_screenshot function
1 parent d22a6ab commit 2ff844d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/agentlab/analyze/agent_xray.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,13 @@ def get_screenshot(
601601
if annotate:
602602
action_str = step_info.action
603603
properties = step_info.obs.get("extra_element_properties", None)
604-
action_colored = annotate_action(img, action_string=action_str, properties=properties)
604+
try:
605+
action_colored = annotate_action(
606+
img, action_string=action_str, properties=properties
607+
)
608+
except Exception as e:
609+
warning(f"Failed to annotate action: {e}")
610+
action_colored = action_str
605611
else:
606612
action_colored = None
607613
return img, action_colored

0 commit comments

Comments
 (0)