Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
extend user goal check with complete criterion (#1382)
LawyZheng01c28e9a4dca
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.pyindex 42993f104..dd0aee5f6 100644--- a/skyvern/forge/agent.py+++ b/skyvern/forge/agent.py@@ -1000,13 +1000,12 @@ class ForgeAgent:)scraped_page_refreshed = await scraped_page.refresh()- # TODO: currently, just using the check user goal for complete verification- # maybe need a desinged complete criterion in the futureverification_prompt = prompt_engine.load_prompt("check-user-goal",navigation_goal=task.navigation_goal,navigation_payload=task.navigation_payload,elements=scraped_page_refreshed.build_element_tree(ElementTreeFormat.HTML),+ complete_criterion=task.complete_criterion,)# this prompt is critical to our agent so let's use the primary LLM API handlerdiff --git a/skyvern/forge/prompts/skyvern/check-user-goal.j2 b/skyvern/forge/prompts/skyvern/check-user-goal.j2index e850f2a6d..beb825775 100644--- a/skyvern/forge/prompts/skyvern/check-user-goal.j2+++ b/skyvern/forge/prompts/skyvern/check-user-goal.j2@@ -1,11 +1,11 @@-Your are here to help the user determine if the user has completed their goal on the web. Use the content of the elements parsed from the page, the screenshots of the page, the user goal and user details to determine whether the user goal has been completed or not.+Your are here to help the user determine if the user has completed their goal on the web{{ " according to the complete criterion" if complete_criterion else "" }}. Use the content of the elements parsed from the page, the screenshots of the page, the user goal and user details to determine whether the {{ "complete criterion has been met" if complete_criterion else "user goal has been completed" }} or not.Make sure to ONLY return the JSON object in this format with no additional text before or after it:```json{"page_info": str, // Think step by step. Describe all the useful information in the page related to the user goal."thoughts": str, // Think step by step. What information makes you believe whether user goal has completed or not. Use information you see on the site to explain.- "user_goal_achieved": bool // True if the user goal has been completed, false otherwise.+ "user_goal_achieved": bool // True if the user goal has been completed{{ " according to the complete criterion" if complete_criterion else "" }}, false otherwise.}```@@ -22,4 +22,9 @@ User Goal:User Details:```{{ navigation_payload }}-```\ No newline at end of file+```+{% if complete_criterion %}+Complete Criterion:+```+{{ complete_criterion }}+```{% endif %}