Skip to content

Automate browser based workflows with AI

WorkflowRunStatusResponse -> WorkflowRunResponse (#1959)

Shuchang Zheng09fb6ae60ab7
diff --git a/evaluation/core/__init__.py b/evaluation/core/__init__.py
index 0a22717dc..90d498ae6 100644
--- a/evaluation/core/__init__.py
+++ b/evaluation/core/__init__.py
@@ -14,7 +14,7 @@ from skyvern.forge.prompts import prompt_engine
from skyvern.forge.sdk.api.files import create_folder_if_not_exist
from skyvern.forge.sdk.schemas.task_v2 import TaskV2, TaskV2Request
from skyvern.forge.sdk.schemas.tasks import ProxyLocation, TaskRequest, TaskResponse, TaskStatus
-from skyvern.forge.sdk.workflow.models.workflow import WorkflowRequestBody, WorkflowRunStatus, WorkflowRunStatusResponse
+from skyvern.forge.sdk.workflow.models.workflow import WorkflowRequestBody, WorkflowRunResponse, WorkflowRunStatus
class TaskOutput(BaseModel):
@@ -70,7 +70,7 @@ class SkyvernClient:
assert response.status_code == 200, f"Expected to get task response status 200, but got {response.status_code}"
return TaskResponse(**response.json())
- async def get_workflow_run(self, workflow_pid: str, workflow_run_id: str) -> WorkflowRunStatusResponse:
+ async def get_workflow_run(self, workflow_pid: str, workflow_run_id: str) -> WorkflowRunResponse:
url = f"{self.base_url}/workflows/{workflow_pid}/runs/{workflow_run_id}"
headers = {"x-api-key": self.credentials}
async with httpx.AsyncClient() as client:
@@ -78,7 +78,7 @@ class SkyvernClient:
assert response.status_code == 200, (
f"Expected to get workflow run response status 200, but got {response.status_code}"
)
- return WorkflowRunStatusResponse(**response.json())
+ return WorkflowRunResponse(**response.json())
class Evaluator:
diff --git a/fern/openapi/skyvern_openapi.yml b/fern/openapi/skyvern_openapi.yml
index 139b7a352..dab96d849 100644
--- a/fern/openapi/skyvern_openapi.yml
+++ b/fern/openapi/skyvern_openapi.yml
@@ -1164,7 +1164,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/WorkflowRunStatusResponse'
+ $ref: '#/components/schemas/WorkflowRunResponse'
'422':
description: Validation Error
content:
@@ -4879,7 +4879,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/WorkflowRunStatusResponse'
+ $ref: '#/components/schemas/WorkflowRunResponse'
'422':
description: Validation Error
content:
@@ -9373,7 +9373,7 @@ components:
- timed_out
- completed
title: WorkflowRunStatus
- WorkflowRunStatusResponse:
+ WorkflowRunResponse:
properties:
workflow_id:
type: string
@@ -9464,7 +9464,7 @@ components:
- created_at
- modified_at
- parameters
- title: WorkflowRunStatusResponse
+ title: WorkflowRunResponse
WorkflowRunTimeline:
properties:
type:
diff --git a/pyproject.toml b/pyproject.toml
index 49593c623..83380731f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "skyvern"
-version = "0.1.63"
+version = "0.1.64.dev0"
description = ""
authors = ["Skyvern AI <[email protected]>"]
readme = "README.md"
diff --git a/skyvern/__init__.py b/skyvern/__init__.py
index 2a7dbb854..8d1f410e2 100644
--- a/skyvern/__init__.py
+++ b/skyvern/__init__.py
@@ -3,6 +3,7 @@ from ddtrace.filters import FilterRequestsOnUrl
from skyvern.agent import SkyvernAgent, SkyvernClient
from skyvern.forge.sdk.forge_log import setup_logger
+from skyvern.forge.sdk.workflow.models.workflow import WorkflowRunResponse
tracer.configure(
settings={
@@ -13,4 +14,4 @@ tracer.configure(
)
setup_logger()
-__all__ = ["SkyvernAgent", "SkyvernClient"]
+__all__ = ["SkyvernAgent", "SkyvernClient", "WorkflowRunResponse"]
diff --git a/skyvern/agent/client.py b/skyvern/agent/client.py
index 8e7d8bc1c..f6f2c7959 100644
--- a/skyvern/agent/client.py
+++ b/skyvern/agent/client.py
@@ -7,7 +7,7 @@ from skyvern.config import settings
from skyvern.exceptions import SkyvernClientException
from skyvern.forge.sdk.schemas.task_runs import TaskRunResponse
from skyvern.forge.sdk.schemas.tasks import ProxyLocation
-from skyvern.forge.sdk.workflow.models.workflow import RunWorkflowResponse, WorkflowRunStatusResponse
+from skyvern.forge.sdk.workflow.models.workflow import RunWorkflowResponse, WorkflowRunResponse
class RunEngine(StrEnum):
@@ -82,7 +82,7 @@ class SkyvernClient:
async def get_workflow_run(
self,
workflow_run_id: str,
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
async with httpx.AsyncClient() as client:
response = await client.get(
f"{self.base_url}/api/v1/workflows/runs/{workflow_run_id}",
@@ -94,4 +94,4 @@ class SkyvernClient:
f"Failed to get workflow run: {response.text}",
status_code=response.status_code,
)
- return WorkflowRunStatusResponse.model_validate(response.json())
+ return WorkflowRunResponse.model_validate(response.json())
diff --git a/skyvern/client/__init__.py b/skyvern/client/__init__.py
index 0d9fb4d78..dfd585e5f 100644
--- a/skyvern/client/__init__.py
+++ b/skyvern/client/__init__.py
@@ -246,7 +246,7 @@ from .types import (
WorkflowRunBlockNavigationPayload,
WorkflowRunBlockOutput,
WorkflowRunStatus,
- WorkflowRunStatusResponse,
+ WorkflowRunResponse,
WorkflowRunTimeline,
WorkflowRunTimelineType,
WorkflowStatus,
@@ -510,7 +510,7 @@ __all__ = [
"WorkflowRunBlockNavigationPayload",
"WorkflowRunBlockOutput",
"WorkflowRunStatus",
- "WorkflowRunStatusResponse",
+ "WorkflowRunResponse",
"WorkflowRunTimeline",
"WorkflowRunTimelineType",
"WorkflowStatus",
diff --git a/skyvern/client/agent/client.py b/skyvern/client/agent/client.py
index bac663543..0232426d7 100644
--- a/skyvern/client/agent/client.py
+++ b/skyvern/client/agent/client.py
@@ -30,7 +30,7 @@ from ..types.run_workflow_response import RunWorkflowResponse
from ..types.workflow_run_status import WorkflowRunStatus
from ..types.workflow_run import WorkflowRun
from ..types.workflow_run_timeline import WorkflowRunTimeline
-from ..types.workflow_run_status_response import WorkflowRunStatusResponse
+from ..types.workflow_run_status_response import WorkflowRunResponse
from ..types.workflow import Workflow
from ..types.ai_suggestion_base import AiSuggestionBase
from ..types.task_generation import TaskGeneration
@@ -1658,7 +1658,7 @@ class AgentClient:
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
"""
Parameters
----------
@@ -1673,7 +1673,7 @@ class AgentClient:
Returns
-------
- WorkflowRunStatusResponse
+ WorkflowRunResponse
Successful Response
Examples
@@ -1697,9 +1697,9 @@ class AgentClient:
try:
if 200 <= _response.status_code < 300:
return typing.cast(
- WorkflowRunStatusResponse,
+ WorkflowRunResponse,
parse_obj_as(
- type_=WorkflowRunStatusResponse, # type: ignore
+ type_=WorkflowRunResponse, # type: ignore
object_=_response.json(),
),
)
@@ -3457,7 +3457,7 @@ class AgentClient:
def get_eval_workflow_run_by_run_id(
self, workflow_run_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
"""
Parameters
----------
@@ -3468,7 +3468,7 @@ class AgentClient:
Returns
-------
- WorkflowRunStatusResponse
+ WorkflowRunResponse
Successful Response
Examples
@@ -3488,9 +3488,9 @@ class AgentClient:
try:
if 200 <= _response.status_code < 300:
return typing.cast(
- WorkflowRunStatusResponse,
+ WorkflowRunResponse,
parse_obj_as(
- type_=WorkflowRunStatusResponse, # type: ignore
+ type_=WorkflowRunResponse, # type: ignore
object_=_response.json(),
),
)
@@ -5741,7 +5741,7 @@ class AsyncAgentClient:
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
"""
Parameters
----------
@@ -5756,7 +5756,7 @@ class AsyncAgentClient:
Returns
-------
- WorkflowRunStatusResponse
+ WorkflowRunResponse
Successful Response
Examples
@@ -5788,9 +5788,9 @@ class AsyncAgentClient:
try:
if 200 <= _response.status_code < 300:
return typing.cast(
- WorkflowRunStatusResponse,
+ WorkflowRunResponse,
parse_obj_as(
- type_=WorkflowRunStatusResponse, # type: ignore
+ type_=WorkflowRunResponse, # type: ignore
object_=_response.json(),
),
)
@@ -7739,7 +7739,7 @@ class AsyncAgentClient:
async def get_eval_workflow_run_by_run_id(
self, workflow_run_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
"""
Parameters
----------
@@ -7750,7 +7750,7 @@ class AsyncAgentClient:
Returns
-------
- WorkflowRunStatusResponse
+ WorkflowRunResponse
Successful Response
Examples
@@ -7778,9 +7778,9 @@ class AsyncAgentClient:
try:
if 200 <= _response.status_code < 300:
return typing.cast(
- WorkflowRunStatusResponse,
+ WorkflowRunResponse,
parse_obj_as(
- type_=WorkflowRunStatusResponse, # type: ignore
+ type_=WorkflowRunResponse, # type: ignore
object_=_response.json(),
),
)
diff --git a/skyvern/client/types/__init__.py b/skyvern/client/types/__init__.py
index f00349ba5..d7bce910f 100644
--- a/skyvern/client/types/__init__.py
+++ b/skyvern/client/types/__init__.py
@@ -277,7 +277,7 @@ from .workflow_run_block_data_schema import WorkflowRunBlockDataSchema
from .workflow_run_block_navigation_payload import WorkflowRunBlockNavigationPayload
from .workflow_run_block_output import WorkflowRunBlockOutput
from .workflow_run_status import WorkflowRunStatus
-from .workflow_run_status_response import WorkflowRunStatusResponse
+from .workflow_run_status_response import WorkflowRunResponse
from .workflow_run_timeline import WorkflowRunTimeline
from .workflow_run_timeline_type import WorkflowRunTimelineType
from .workflow_status import WorkflowStatus
@@ -528,7 +528,7 @@ __all__ = [
"WorkflowRunBlockNavigationPayload",
"WorkflowRunBlockOutput",
"WorkflowRunStatus",
- "WorkflowRunStatusResponse",
+ "WorkflowRunResponse",
"WorkflowRunTimeline",
"WorkflowRunTimelineType",
"WorkflowStatus",
diff --git a/skyvern/client/types/workflow_run_status_response.py b/skyvern/client/types/workflow_run_status_response.py
index 5c86cba51..ea76b68b8 100644
--- a/skyvern/client/types/workflow_run_status_response.py
+++ b/skyvern/client/types/workflow_run_status_response.py
@@ -10,7 +10,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
-class WorkflowRunStatusResponse(UniversalBaseModel):
+class WorkflowRunResponse(UniversalBaseModel):
workflow_id: str
workflow_run_id: str
status: WorkflowRunStatus
diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.py
index c173aad26..38ade3a10 100644
--- a/skyvern/forge/sdk/routes/agent_protocol.py
+++ b/skyvern/forge/sdk/routes/agent_protocol.py
@@ -70,8 +70,8 @@ from skyvern.forge.sdk.workflow.models.workflow import (
Workflow,
WorkflowRequestBody,
WorkflowRun,
+ WorkflowRunResponse,
WorkflowRunStatus,
- WorkflowRunStatusResponse,
WorkflowStatus,
)
from skyvern.forge.sdk.workflow.models.yaml import WorkflowCreateYAMLRequest
@@ -714,17 +714,17 @@ async def get_workflow_run_timeline(
@base_router.get(
"/workflows/runs/{workflow_run_id}",
- response_model=WorkflowRunStatusResponse,
+ response_model=WorkflowRunResponse,
)
@base_router.get(
"/workflows/runs/{workflow_run_id}/",
- response_model=WorkflowRunStatusResponse,
+ response_model=WorkflowRunResponse,
include_in_schema=False,
)
async def get_workflow_run(
workflow_run_id: str,
current_org: Organization = Depends(org_auth_service.get_current_org),
-) -> WorkflowRunStatusResponse:
+) -> WorkflowRunResponse:
analytics.capture("skyvern-oss-agent-workflow-run-get")
return await app.WORKFLOW_SERVICE.build_workflow_run_status_response_by_workflow_id(
workflow_run_id=workflow_run_id,
diff --git a/skyvern/forge/sdk/workflow/models/workflow.py b/skyvern/forge/sdk/workflow/models/workflow.py
index 6d61b4d9e..4efeb48bb 100644
--- a/skyvern/forge/sdk/workflow/models/workflow.py
+++ b/skyvern/forge/sdk/workflow/models/workflow.py
@@ -130,7 +130,7 @@ class WorkflowRunOutputParameter(BaseModel):
created_at: datetime
-class WorkflowRunStatusResponse(BaseModel):
+class WorkflowRunResponse(BaseModel):
workflow_id: str
workflow_run_id: str
status: WorkflowRunStatus
diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py
index ca164436c..b1a5ed0a5 100644
--- a/skyvern/forge/sdk/workflow/service.py
+++ b/skyvern/forge/sdk/workflow/service.py
@@ -79,8 +79,8 @@ from skyvern.forge.sdk.workflow.models.workflow import (
WorkflowRun,
WorkflowRunOutputParameter,
WorkflowRunParameter,
+ WorkflowRunResponse,
WorkflowRunStatus,
- WorkflowRunStatusResponse,
WorkflowStatus,
)
from skyvern.forge.sdk.workflow.models.yaml import (
@@ -949,7 +949,7 @@ class WorkflowService:
workflow_run_id: str,
organization_id: str,
include_cost: bool = False,
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
workflow_run = await self.get_workflow_run(workflow_run_id=workflow_run_id, organization_id=organization_id)
if workflow_run is None:
LOG.error(f"Workflow run {workflow_run_id} not found")
@@ -968,7 +968,7 @@ class WorkflowService:
workflow_run_id: str,
organization_id: str,
include_cost: bool = False,
- ) -> WorkflowRunStatusResponse:
+ ) -> WorkflowRunResponse:
workflow = await self.get_workflow_by_permanent_id(workflow_permanent_id)
if workflow is None:
LOG.error(f"Workflow {workflow_permanent_id} not found")
@@ -1064,7 +1064,7 @@ class WorkflowService:
# successful steps are the ones that have a status of completed and the total count of unique step.order
successful_steps = [step for step in workflow_run_steps if step.status == StepStatus.completed]
total_cost = 0.1 * (len(successful_steps) + len(text_prompt_blocks))
- return WorkflowRunStatusResponse(
+ return WorkflowRunResponse(
workflow_id=workflow.workflow_permanent_id,
workflow_run_id=workflow_run_id,
status=workflow_run.status,