Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
CUA feature - extraction data combined assisstant's message (#2157)
Shuchang Zhengcac9e6a61a5f
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.pyindex 59f46cf3d..3a85cf222 100644--- a/skyvern/forge/agent.py+++ b/skyvern/forge/agent.py@@ -1165,7 +1165,9 @@ class ForgeAgent:):working_page = await browser_state.must_get_working_page()# refresh task in case the extracted information is updated previously- task = await app.DATABASE.get_task(task.task_id, task.organization_id)+ refreshed_task = await app.DATABASE.get_task(task.task_id, task.organization_id)+ assert refreshed_task is not None+ task = refreshed_taskextract_action = await self.create_extract_action(task, step, scraped_page)extract_results = await ActionHandler.handle_action(scraped_page, task, step, working_page, extract_actiondiff --git a/skyvern/forge/prompts/skyvern/extract-information.j2 b/skyvern/forge/prompts/skyvern/extract-information.j2index 5c849affe..7e40f61da 100644--- a/skyvern/forge/prompts/skyvern/extract-information.j2+++ b/skyvern/forge/prompts/skyvern/extract-information.j2@@ -14,7 +14,7 @@ If you are trying to extract the href links which are using the jinja style likeUser Data Extraction Goal: {{ data_extraction_goal }}{% if previous_extracted_information %}-Previous contexts or thoughts: {{ previous_extracted_information }}+Previous contexts or thoughts: ```{{ previous_extracted_information }}```{% endif %}{% if error_code_mapping_str %}diff --git a/skyvern/forge/sdk/schemas/tasks.py b/skyvern/forge/sdk/schemas/tasks.pyindex cca48dd96..f5d322c99 100644--- a/skyvern/forge/sdk/schemas/tasks.py+++ b/skyvern/forge/sdk/schemas/tasks.py@@ -232,9 +232,6 @@ class Task(TaskBase):if status.cant_have_extracted_info() and extracted_information is not None:raise ValueError(f"status_cant_have_extracted_information({self.task_id})")- if self.extracted_information is not None and extracted_information is not None:- raise ValueError(f"cant_override_extracted_information({self.task_id})")-if self.failure_reason is not None and failure_reason is not None:raise ValueError(f"cant_override_failure_reason({self.task_id})")diff --git a/skyvern/webeye/actions/parse_actions.py b/skyvern/webeye/actions/parse_actions.pyindex ef022ff10..bd865fd84 100644--- a/skyvern/webeye/actions/parse_actions.py+++ b/skyvern/webeye/actions/parse_actions.py@@ -338,20 +338,19 @@ async def parse_cua_actions(intention=reasoning,)if skyvern_action_type == "complete":- if not task.data_extraction_goal and useful_information:- LOG.info(- "Updating task with useful information",- task_id=task.task_id,- organization_id=task.organization_id,- useful_information=useful_information,- assistant_message=assistant_message,- reasoning=reasoning,- )- await app.DATABASE.update_task(- task.task_id,- organization_id=task.organization_id,- extracted_information=assistant_message,- )+ LOG.info(+ "Updating task with useful information",+ task_id=task.task_id,+ organization_id=task.organization_id,+ useful_information=useful_information,+ assistant_message=assistant_message,+ reasoning=reasoning,+ )+ await app.DATABASE.update_task(+ task.task_id,+ organization_id=task.organization_id,+ extracted_information=assistant_message,+ )action = CompleteAction(reasoning=reasoning,intention=reasoning,