From 47899085cf52be0f46d42e10fdc070670a1b87bb Mon Sep 17 00:00:00 2001 From: Stanislav Novosad Date: Tue, 28 Oct 2025 17:21:01 -0600 Subject: [PATCH] Cleanup ENABLE_TASKV2_METADATA_CURRENT_URL_VALIDATION experiment (#3836) --- .../skyvern/task_v2_generate_metadata.j2 | 15 +++++-- ...k_v2_generate_metadata_with_current_url.j2 | 27 ------------- skyvern/services/task_v2_service.py | 40 +++++-------------- 3 files changed, 21 insertions(+), 61 deletions(-) delete mode 100644 skyvern/forge/prompts/skyvern/task_v2_generate_metadata_with_current_url.j2 diff --git a/skyvern/forge/prompts/skyvern/task_v2_generate_metadata.j2 b/skyvern/forge/prompts/skyvern/task_v2_generate_metadata.j2 index 33977f2d..7b1d3f6d 100644 --- a/skyvern/forge/prompts/skyvern/task_v2_generate_metadata.j2 +++ b/skyvern/forge/prompts/skyvern/task_v2_generate_metadata.j2 @@ -1,12 +1,12 @@ -You're to assist the user to achieve the user goal in the browser. Given the user input, what is the url to type into the browser? Also come up with a proper title for this goal to achieve. +You're to assist the user to achieve the user goal in the browser. Given the user input and the current url of the browser, what is the url to type into the browser? Also come up with a proper title for this goal to achieve. MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. Reply in JSON format with the following keys: { - "thoughts": str, // Think step by step. Has the user specify a url to go? If yes, what is the complete url user specified? If not, to achieve what the user wants to do, what is most likely website url for achieving the goal? - "url": str, // The initial url to type into the browser. If the user specified one, use exactly that url. - "title": str, // A descriptive and informative title for the goal. Use no more than 5 words + "thoughts": str, // Think step by step. What is the current browser url? Does it already achieve the user goal? Has the user specify a url to go? If yes, what is the complete url user specified? If not, to achieve what the user wants to do, what is most likely website url for achieving the goal? + "url": str, // The initial url to type into the browser. If the user specified one, use exactly that url. If the "current browser url" achieves the user goal, use exactly the "current browser url". + "title": str // A descriptive and informative title for the goal. Use no more than 5 words } User goal: @@ -18,3 +18,10 @@ Starting url provided by user: ``` {{ user_url }} ```{% endif %} + +{% if current_browser_url %} +Current browser url: +``` +{{ current_browser_url }} +``` +{% endif %} diff --git a/skyvern/forge/prompts/skyvern/task_v2_generate_metadata_with_current_url.j2 b/skyvern/forge/prompts/skyvern/task_v2_generate_metadata_with_current_url.j2 deleted file mode 100644 index 7b1d3f6d..00000000 --- a/skyvern/forge/prompts/skyvern/task_v2_generate_metadata_with_current_url.j2 +++ /dev/null @@ -1,27 +0,0 @@ -You're to assist the user to achieve the user goal in the browser. Given the user input and the current url of the browser, what is the url to type into the browser? Also come up with a proper title for this goal to achieve. - -MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. - -Reply in JSON format with the following keys: -{ - "thoughts": str, // Think step by step. What is the current browser url? Does it already achieve the user goal? Has the user specify a url to go? If yes, what is the complete url user specified? If not, to achieve what the user wants to do, what is most likely website url for achieving the goal? - "url": str, // The initial url to type into the browser. If the user specified one, use exactly that url. If the "current browser url" achieves the user goal, use exactly the "current browser url". - "title": str // A descriptive and informative title for the goal. Use no more than 5 words -} - -User goal: -``` -{{ user_goal }} -```{% if user_url %} - -Starting url provided by user: -``` -{{ user_url }} -```{% endif %} - -{% if current_browser_url %} -Current browser url: -``` -{{ current_browser_url }} -``` -{% endif %} diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.py index aeea2e46..70e18300 100644 --- a/skyvern/services/task_v2_service.py +++ b/skyvern/services/task_v2_service.py @@ -263,7 +263,6 @@ async def initialize_task_v2_metadata( user_prompt: str | None, current_browser_url: str | None, user_url: str | None, - current_run_id: str, ) -> TaskV2: thought = await app.DATABASE.create_thought( task_v2_id=task_v2.observer_cruise_id, @@ -272,35 +271,17 @@ async def initialize_task_v2_metadata( thought_scenario=ThoughtScenario.generate_metadata, ) - enable_current_url_validation = await app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached( - "ENABLE_TASKV2_METADATA_CURRENT_URL_VALIDATION", - current_run_id, - properties={"organization_id": task_v2.organization_id}, + metadata_prompt = prompt_engine.load_prompt( + "task_v2_generate_metadata", + user_goal=user_prompt, + current_browser_url=current_browser_url or "about:blank", + user_url=user_url, + ) + metadata_response = await app.LLM_API_HANDLER( + prompt=metadata_prompt, + thought=thought, + prompt_name="task_v2_generate_metadata", ) - - if enable_current_url_validation: - metadata_prompt = prompt_engine.load_prompt( - "task_v2_generate_metadata_with_current_url", - user_goal=user_prompt, - current_browser_url=current_browser_url or "about:blank", - user_url=user_url, - ) - metadata_response = await app.LLM_API_HANDLER( - prompt=metadata_prompt, - thought=thought, - prompt_name="task_v2_generate_metadata_with_current_url", - ) - else: - metadata_prompt = prompt_engine.load_prompt( - "task_v2_generate_metadata", - user_goal=user_prompt, - user_url=user_url, - ) - metadata_response = await app.LLM_API_HANDLER( - prompt=metadata_prompt, - thought=thought, - prompt_name="task_v2_generate_metadata", - ) # validate LOG.info(f"Initialized task v2 initial response: {metadata_response}") @@ -587,7 +568,6 @@ async def run_task_v2_helper( user_prompt=task_v2.prompt, current_browser_url=current_url, user_url=task_v2.url, - current_run_id=current_run_id, ) url = str(task_v2.url)