Skip to content

Automate browser based workflows with AI

add screenshot_urls to the get_run endpoint (#2417)

Shuchang Zhengfe97113e0f70
diff --git a/skyvern/schemas/runs.py b/skyvern/schemas/runs.py
index 785efc6c9..62bbbcc24 100644
--- a/skyvern/schemas/runs.py
+++ b/skyvern/schemas/runs.py
@@ -300,6 +300,10 @@ class BaseRunResponse(BaseModel):
)
downloaded_files: list[FileInfo] | None = Field(default=None, description="List of files downloaded during the run")
recording_url: str | None = Field(default=None, description="URL to the recording of the run")
+ screenshot_urls: list[str] | None = Field(
+ default=None,
+ description="List of last n screenshot URLs in reverse chronological order - the first one the list is the latest screenshot.",
+ )
failure_reason: str | None = Field(default=None, description="Reason for failure if the run failed or terminated")
created_at: datetime = Field(description="Timestamp when this run was created", examples=["2025-01-01T00:00:00Z"])
modified_at: datetime = Field(
diff --git a/skyvern/services/run_service.py b/skyvern/services/run_service.py
index 8a1053fb2..c4e26ddcb 100644
--- a/skyvern/services/run_service.py
+++ b/skyvern/services/run_service.py
@@ -48,6 +48,7 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
modified_at=task_v1_response.modified_at,
app_url=f"{settings.SKYVERN_APP_URL.rstrip('/')}/tasks/{task_v1_response.task_id}",
recording_url=task_v1_response.recording_url,
+ screenshot_urls=task_v1_response.action_screenshot_urls,
downloaded_files=task_v1_response.downloaded_files,
run_request=TaskRunRequest(
engine=run_engine,
@@ -80,6 +81,7 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
created_at=task_v2.created_at,
modified_at=task_v2.modified_at,
recording_url=workflow_run.recording_url if workflow_run else None,
+ screenshot_urls=workflow_run.screenshot_urls if workflow_run else None,
downloaded_files=workflow_run.downloaded_files if workflow_run else None,
app_url=f"{settings.SKYVERN_APP_URL.rstrip('/')}/workflows/{task_v2.workflow_permanent_id}/{task_v2.workflow_run_id}",
run_request=TaskRunRequest(
diff --git a/skyvern/services/workflow_service.py b/skyvern/services/workflow_service.py
index 752187810..12fd79931 100644
--- a/skyvern/services/workflow_service.py
+++ b/skyvern/services/workflow_service.py
@@ -81,6 +81,7 @@ async def get_workflow_run_response(
output=workflow_run_resp.outputs,
downloaded_files=workflow_run_resp.downloaded_files,
recording_url=workflow_run_resp.recording_url,
+ screenshot_urls=workflow_run_resp.screenshot_urls,
failure_reason=workflow_run_resp.failure_reason,
app_url=app_url,
created_at=workflow_run.created_at,