diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py index b26f7847..bdc56375 100644 --- a/skyvern/forge/agent.py +++ b/skyvern/forge/agent.py @@ -2520,8 +2520,12 @@ class ForgeAgent: browser_state: BrowserState, json_response: dict[str, Any], ) -> dict[str, Any]: - need_verification_code = json_response.get("need_verification_code") - if need_verification_code and (task.totp_verification_url or task.totp_identifier) and task.organization_id: + place_to_enter_verification_code = json_response.get("place_to_enter_verification_code") + if ( + place_to_enter_verification_code + and (task.totp_verification_url or task.totp_identifier) + and task.organization_id + ): LOG.info("Need verification code", step_id=step.step_id) verification_code = await poll_verification_code( task.task_id, diff --git a/skyvern/forge/prompts/skyvern/extract-action.j2 b/skyvern/forge/prompts/skyvern/extract-action.j2 index 60dd2874..ccd5ef8d 100644 --- a/skyvern/forge/prompts/skyvern/extract-action.j2 +++ b/skyvern/forge/prompts/skyvern/extract-action.j2 @@ -37,8 +37,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 a verification code is needed for login or any verification step. Explain why you believe a verification code is needed or not. Has the code been sent and is code available somewhere (email, phone or 2FA device)? - "need_verification_code": bool, // Whether a verification code must be entered on this page now. True only if the code is available to user. If the code is not sent, return false {% endif %} + "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 enter 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 %} } 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 dd057609..66724f50 100644 --- a/skyvern/forge/prompts/skyvern/single-input-action.j2 +++ b/skyvern/forge/prompts/skyvern/single-input-action.j2 @@ -16,8 +16,8 @@ Reply in JSON format with the following keys: "id": str, // The id of the element to take action on. The id has to be one from the elements list. "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 a verification code is needed for login or any verification step. Explain why you believe a verification code is needed or not. Has the code been sent and is code available somewhere (email, phone or 2FA device)? - "need_verification_code": bool, // Whether a verification code is needed to proceed. True only if the code is available to user. If the code is not sent, return false {% endif %} + "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 enter 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 verificaton code now. {% endif %} } User instruction: