Skip to content

Automate browser based workflows with AI

Handle LLM returning element_id instead of id, and handle cases where it may not be returned at all (#301)

Kerem Yilmaz6a83f367ba60
diff --git a/skyvern/webeye/actions/actions.py b/skyvern/webeye/actions/actions.py
index 49aa3889e..1bd64f3b6 100644
--- a/skyvern/webeye/actions/actions.py
+++ b/skyvern/webeye/actions/actions.py
@@ -138,7 +138,13 @@ class CompleteAction(DecisiveAction):
def parse_actions(task: Task, json_response: List[Dict[str, Any]]) -> List[Action]:
actions = []
for action in json_response:
- element_id = action["id"]
+ if "id" in action:
+ element_id = action["id"]
+ elif "element_id" in action:
+ element_id = action["element_id"]
+ else:
+ element_id = None
+
reasoning = action["reasoning"] if "reasoning" in action else None
if "action_type" not in action or action["action_type"] is None:
actions.append(NullAction(reasoning=reasoning))