feat: default /v1/run/tasks engine to v1 (SKY-8566) (#5403)

Co-authored-by: Suchintan Singh <suchintan@skyvern.com>
This commit is contained in:
Suchintan 2026-04-07 11:45:39 -04:00 committed by GitHub
parent a63473161b
commit b727a22c45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 6 deletions

View file

@ -275,7 +275,7 @@ class Skyvern(AsyncSkyvern):
async def run_task(
self,
prompt: str,
engine: RunEngine = RunEngine.skyvern_v2,
engine: RunEngine = RunEngine.skyvern_v1,
model: dict[str, Any] | None = None,
url: str | None = None,
webhook_url: str | None = None,

View file

@ -36,7 +36,7 @@ class SkyvernBrowserPageAgent:
async def run_task(
self,
prompt: str,
engine: RunEngine = RunEngine.skyvern_v2,
engine: RunEngine = RunEngine.skyvern_v1,
model: dict[str, Any] | None = None,
url: str | None = None,
webhook_url: str | None = None,
@ -53,7 +53,7 @@ class SkyvernBrowserPageAgent:
Args:
prompt: Natural language description of the task to perform.
engine: The execution engine to use. Defaults to skyvern_v2.
engine: The execution engine to use. Defaults to skyvern_v1.
model: LLM model configuration options.
url: URL to navigate to. If not provided, uses the current page URL.
webhook_url: URL to receive webhook notifications about task progress.

View file

@ -7,7 +7,7 @@ The starting URL for the task. If not provided, Skyvern will attempt to determin
"""
TASK_ENGINE_DOC_STRING = """
The engine that powers the agent task. The default value is `skyvern-2.0`, the latest Skyvern agent that performs pretty well with complex and multi-step tasks. `skyvern-1.0` is good for simple tasks like filling a form, or searching for information on Google. The `openai-cua` engine uses OpenAI's CUA model. The `anthropic-cua` uses Anthropic's Claude Sonnet 3.7 model with the computer use tool.
The engine that powers the agent task. The default value is `skyvern-1.0`, which is good for simple tasks like filling a form, or searching for information on Google. `skyvern-2.0` is the latest Skyvern agent that performs well with complex and multi-step tasks. The `openai-cua` engine uses OpenAI's CUA model. The `anthropic-cua` uses Anthropic's Claude Sonnet 3.7 model with the computer use tool.
"""
PROXY_LOCATION_DOC_STRING = """

View file

@ -5,7 +5,7 @@ from enum import StrEnum
from typing import Annotated, Any, Literal, Union
from zoneinfo import ZoneInfo
from pydantic import BaseModel, ConfigDict, Field, field_validator
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
from skyvern.forge.sdk.schemas.files import FileInfo
from skyvern.forge.sdk.workflow.models.validators import normalize_run_with
@ -382,7 +382,7 @@ class TaskRunRequest(BaseModel):
examples=TASK_URL_EXAMPLES,
)
engine: RunEngine = Field(
default=RunEngine.skyvern_v2,
default=RunEngine.skyvern_v1,
description=TASK_ENGINE_DOC_STRING,
)
title: str | None = Field(
@ -482,6 +482,12 @@ class TaskRunRequest(BaseModel):
return validate_url(url)
@model_validator(mode="after")
def _force_v2_for_publish_workflow(self) -> TaskRunRequest:
if self.publish_workflow and self.engine != RunEngine.skyvern_v2:
self.engine = RunEngine.skyvern_v2
return self
class WorkflowRunRequest(BaseModel):
workflow_id: str = Field(

View file

@ -73,3 +73,34 @@ class TestServiceDefault:
sig = inspect.signature(WorkflowService.create_workflow_from_prompt)
assert sig.parameters["task_version"].default == "v1"
class TestTaskRunRequestEngine:
def test_default_engine_is_v1(self) -> None:
"""TaskRunRequest.engine must default to skyvern_v1 (skyvern-1.0)."""
from skyvern.schemas.runs import RunEngine, TaskRunRequest
req = TaskRunRequest(prompt="hello")
assert req.engine == RunEngine.skyvern_v1
def test_explicit_v2_engine_preserved(self) -> None:
"""Explicitly passing skyvern_v2 should be preserved."""
from skyvern.schemas.runs import RunEngine, TaskRunRequest
req = TaskRunRequest(prompt="hello", engine=RunEngine.skyvern_v2)
assert req.engine == RunEngine.skyvern_v2
def test_publish_workflow_forces_v2(self) -> None:
"""publish_workflow=True must force engine to v2, since v1 doesn't support it."""
from skyvern.schemas.runs import RunEngine, TaskRunRequest
req = TaskRunRequest(prompt="hello", publish_workflow=True)
assert req.engine == RunEngine.skyvern_v2
def test_publish_workflow_false_keeps_v1(self) -> None:
"""publish_workflow=False (default) should keep the v1 default."""
from skyvern.schemas.runs import RunEngine, TaskRunRequest
req = TaskRunRequest(prompt="hello")
assert req.engine == RunEngine.skyvern_v1
assert req.publish_workflow is False