From ce9e0bf1cc6d88b24cbd3c7f4dfe1bf0dc3315da Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Thu, 26 Jun 2025 18:52:24 +0900 Subject: [PATCH] update verification code prompt (#2797) Co-authored-by: lawyzheng --- skyvern/forge/agent.py | 2 ++ skyvern/forge/prompts/skyvern/extract-action.j2 | 3 ++- skyvern/forge/prompts/skyvern/single-input-action.j2 | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py index 5d230234..07e1a8a5 100644 --- a/skyvern/forge/agent.py +++ b/skyvern/forge/agent.py @@ -2854,8 +2854,10 @@ class ForgeAgent: json_response: dict[str, Any], ) -> dict[str, Any]: place_to_enter_verification_code = json_response.get("place_to_enter_verification_code") + should_enter_verification_code = json_response.get("should_enter_verification_code") if ( place_to_enter_verification_code + and should_enter_verification_code and (task.totp_verification_url or task.totp_identifier) and task.organization_id ): diff --git a/skyvern/forge/prompts/skyvern/extract-action.j2 b/skyvern/forge/prompts/skyvern/extract-action.j2 index d6e9fa09..0cb988fc 100644 --- a/skyvern/forge/prompts/skyvern/extract-action.j2 +++ b/skyvern/forge/prompts/skyvern/extract-action.j2 @@ -38,7 +38,8 @@ Reply in JSON format with the following keys: {% endif %} }],{% if verification_code_check %} "verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be entered somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet. - "place_to_enter_verification_code": bool // Whether there is a place on the current page to enter the verification code now. {% endif %} + "place_to_enter_verification_code": bool, // Whether there is a place on the current page to enter the verification code now. {% endif %} + "should_enter_verification_code": bool // Whether the user should proceed to enter the verification code } Consider the action history from the last step and the screenshot together, if actions from the last step don't yield positive impact, try other actions or other action combinations. diff --git a/skyvern/forge/prompts/skyvern/single-input-action.j2 b/skyvern/forge/prompts/skyvern/single-input-action.j2 index e07eb9b1..67a64cde 100644 --- a/skyvern/forge/prompts/skyvern/single-input-action.j2 +++ b/skyvern/forge/prompts/skyvern/single-input-action.j2 @@ -17,7 +17,8 @@ Reply in JSON format with the following keys: "text": str, // The text to input. }]{% if verification_code_check %} "verification_code_reasoning": str, // Let's think step by step. Describe what you see and think if there is somewhere on the current page where you must enter the verification code now for login or any verification step. Explain why you believe a verification code needs to be entered somewhere or not. Do not imagine any place to enter the code if the code has not been sent yet. - "place_to_enter_verification_code": bool // Whether there is a place on the current page to enter the verification code now. {% endif %} + "place_to_enter_verification_code": bool, // Whether there is a place on the current page to enter the verification code now. {% endif %} + "should_enter_verification_code": bool // Whether the user should proceed to enter the verification code } User instruction: