From 1ed5f22200da431fd541b2475bbcddd64808e716 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Sun, 13 Apr 2025 02:50:07 -0700 Subject: [PATCH] Add any information that helps from the last message of CUA when there's no data extraction goal (#2149) --- skyvern/forge/prompts/skyvern/cua-fallback-action.j2 | 1 + skyvern/webeye/actions/parse_actions.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/skyvern/forge/prompts/skyvern/cua-fallback-action.j2 b/skyvern/forge/prompts/skyvern/cua-fallback-action.j2 index 78b9589e..dda38c46 100644 --- a/skyvern/forge/prompts/skyvern/cua-fallback-action.j2 +++ b/skyvern/forge/prompts/skyvern/cua-fallback-action.j2 @@ -12,6 +12,7 @@ Help the user decide what to do next based on the assistant's message. Here's th Return the action to take next in the following JSON format: { "action": str // complete, terminate, solve_captcha, get_verification_code + "useful_information": str // If there is any useful information the assistant has provided that contributes to the user goal, put it here. } User goal: {{ navigation_goal }} diff --git a/skyvern/webeye/actions/parse_actions.py b/skyvern/webeye/actions/parse_actions.py index 3ef46893..3c423550 100644 --- a/skyvern/webeye/actions/parse_actions.py +++ b/skyvern/webeye/actions/parse_actions.py @@ -331,12 +331,19 @@ async def parse_cua_actions( prompt_name="cua-fallback-action", ) skyvern_action_type = action_response.get("action") + useful_information = action_response.get("useful_information") action = WaitAction( seconds=5, reasoning=reasoning, intention=reasoning, ) if skyvern_action_type == "complete": + if not task.data_extraction_goal and useful_information: + await app.DATABASE.update_task( + task.task_id, + organization_id=task.organization_id, + extracted_information=useful_information, + ) action = CompleteAction( reasoning=reasoning, intention=reasoning,