Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Add GET workflows/runs/run_id endpoint (#973)
Shuchang Zhengcd43bd6f03e1
diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.pyindex 1a936ac88..1719f7f46 100644--- a/skyvern/forge/sdk/routes/agent_protocol.py+++ b/skyvern/forge/sdk/routes/agent_protocol.py@@ -641,6 +641,26 @@ async def get_workflow_run()+@base_router.get(+ "/workflows/runs/{workflow_run_id}",+ response_model=WorkflowRunStatusResponse,+)+@base_router.get(+ "/workflows/runs/{workflow_run_id}/",+ response_model=WorkflowRunStatusResponse,+ include_in_schema=False,+)+async def get_workflow_run_by_run_id(+ workflow_run_id: str,+ current_org: Organization = Depends(org_auth_service.get_current_org),+) -> WorkflowRunStatusResponse:+ 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,+ organization_id=current_org.organization_id,+ )++@base_router.post("/workflows",openapi_extra={diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.pyindex d58d4dfd0..ef5801f17 100644--- a/skyvern/forge/sdk/workflow/service.py+++ b/skyvern/forge/sdk/workflow/service.py@@ -612,6 +612,22 @@ class WorkflowService:async def get_tasks_by_workflow_run_id(self, workflow_run_id: str) -> list[Task]:return await app.DATABASE.get_tasks_by_workflow_run_id(workflow_run_id=workflow_run_id)+ async def build_workflow_run_status_response_by_workflow_id(+ self,+ workflow_run_id: str,+ organization_id: str,+ ) -> WorkflowRunStatusResponse:+ workflow_run = await self.get_workflow_run(workflow_run_id=workflow_run_id)+ if workflow_run is None:+ LOG.error(f"Workflow run {workflow_run_id} not found")+ raise WorkflowRunNotFound(workflow_run_id=workflow_run_id)+ workflow_permanent_id = workflow_run.workflow_permanent_id+ return await self.build_workflow_run_status_response(+ workflow_permanent_id=workflow_permanent_id,+ workflow_run_id=workflow_run_id,+ organization_id=organization_id,+ )+async def build_workflow_run_status_response(self,workflow_permanent_id: str,