disable complete verification when CUA engine (#2728)
Co-authored-by: lawyzheng <lawyzheng1106@gmail.com>
This commit is contained in:
@@ -73,8 +73,9 @@ from skyvern.forge.sdk.schemas.tasks import Task, TaskRequest, TaskResponse, Tas
|
||||
from skyvern.forge.sdk.workflow.context_manager import WorkflowRunContext
|
||||
from skyvern.forge.sdk.workflow.models.block import ActionBlock, BaseTaskBlock, ValidationBlock
|
||||
from skyvern.forge.sdk.workflow.models.workflow import Workflow, WorkflowRun, WorkflowRunStatus
|
||||
from skyvern.schemas.runs import CUA_ENGINES, CUA_RUN_TYPES, RunEngine
|
||||
from skyvern.schemas.runs import CUA_ENGINES, RunEngine
|
||||
from skyvern.services import run_service
|
||||
from skyvern.services.task_v1_service import is_cua_task
|
||||
from skyvern.utils.image_resizer import Resolution
|
||||
from skyvern.utils.prompt_engine import load_prompt_with_elements
|
||||
from skyvern.webeye.actions.action_types import ActionType
|
||||
@@ -268,6 +269,12 @@ class ForgeAgent:
|
||||
cua_response: OpenAIResponse | None = None,
|
||||
llm_caller: LLMCaller | None = None,
|
||||
) -> Tuple[Step, DetailedAgentStepOutput | None, Step | None]:
|
||||
# do not need to do complete verification when it's a CUA task
|
||||
# 1. CUA executes only one action step by step -- it's pretty less likely to have a hallucination for completion or forget to return a complete
|
||||
# 2. It will significantly slow down CUA tasks
|
||||
if engine in CUA_ENGINES:
|
||||
complete_verification = False
|
||||
|
||||
workflow_run: WorkflowRun | None = None
|
||||
if task.workflow_run_id:
|
||||
workflow_run = await app.DATABASE.get_workflow_run(
|
||||
@@ -1575,10 +1582,9 @@ class ForgeAgent:
|
||||
step_id=step.step_id,
|
||||
workflow_run_id=task.workflow_run_id,
|
||||
)
|
||||
run_obj = await app.DATABASE.get_run(run_id=task.task_id, organization_id=task.organization_id)
|
||||
scroll = True
|
||||
llm_key_override = task.llm_key
|
||||
if run_obj and run_obj.task_run_type in CUA_RUN_TYPES:
|
||||
if await is_cua_task(task=task):
|
||||
scroll = False
|
||||
llm_key_override = None
|
||||
|
||||
@@ -2628,9 +2634,8 @@ class ForgeAgent:
|
||||
step_result["actions_result"] = action_result_summary
|
||||
steps_results.append(step_result)
|
||||
|
||||
run_obj = await app.DATABASE.get_run(run_id=task.task_id, organization_id=task.organization_id)
|
||||
scroll = True
|
||||
if run_obj and run_obj.task_run_type in CUA_RUN_TYPES:
|
||||
if await is_cua_task(task=task):
|
||||
scroll = False
|
||||
|
||||
screenshots: list[bytes] = []
|
||||
@@ -2880,8 +2885,7 @@ class ForgeAgent:
|
||||
expire_verification_code=True,
|
||||
)
|
||||
llm_key_override = task.llm_key
|
||||
run_obj = await app.DATABASE.get_run(run_id=task.task_id, organization_id=task.organization_id)
|
||||
if run_obj and run_obj.task_run_type in CUA_RUN_TYPES:
|
||||
if await is_cua_task(task=task):
|
||||
llm_key_override = None
|
||||
llm_api_handler = LLMAPIHandlerFactory.get_override_llm_api_handler(
|
||||
llm_key_override, default=app.LLM_API_HANDLER
|
||||
|
||||
Reference in New Issue
Block a user