From dbca5f7094f0ee2bc982f0554c54f0ab98beb3d6 Mon Sep 17 00:00:00 2001 From: Suchintan Date: Wed, 11 Feb 2026 22:14:38 -0500 Subject: [PATCH] Expose get_workflow_runs on new API router (#4709) Co-authored-by: Suchintan Singh --- skyvern/forge/sdk/routes/agent_protocol.py | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.py index 0589730b..4af4a729 100644 --- a/skyvern/forge/sdk/routes/agent_protocol.py +++ b/skyvern/forge/sdk/routes/agent_protocol.py @@ -2210,6 +2210,25 @@ async def run_workflow_legacy( ) +@base_router.get( + "/workflows/runs", + response_model=list[WorkflowRun], + tags=["Workflows"], + description=( + "List workflow runs across all workflows for the current organization. " + "Results are paginated and can be filtered by status, search key, and error code. " + "All filters are combined with AND logic." + ), + summary="List workflow runs", + openapi_extra={ + "x-fern-sdk-method-name": "get_workflow_runs", + }, +) +@base_router.get( + "/workflows/runs/", + response_model=list[WorkflowRun], + include_in_schema=False, +) @legacy_base_router.get( "/workflows/runs", response_model=list[WorkflowRun], @@ -2224,9 +2243,9 @@ async def run_workflow_legacy( include_in_schema=False, ) async def get_workflow_runs( - page: int = Query(1, ge=1), - page_size: int = Query(10, ge=1), - status: Annotated[list[WorkflowRunStatus] | None, Query()] = None, + page: int = Query(1, ge=1, description="Page number for pagination."), + page_size: int = Query(10, ge=1, description="Number of runs to return per page."), + status: Annotated[list[WorkflowRunStatus] | None, Query(description="Filter by one or more run statuses.")] = None, search_key: str | None = Query( None, max_length=500, @@ -2243,10 +2262,10 @@ async def get_workflow_runs( current_org: Organization = Depends(org_auth_service.get_current_org), ) -> list[WorkflowRun]: """ - Get all workflow runs for the current organization. + List workflow runs across all workflows for the current organization. - Supports filtering by status, parameter search, and error code. All filters - are combined with AND logic. + Results are paginated and can be filtered by status, search key, and error code. + All filters are combined with AND logic. **Examples:** - All failed runs: `?status=failed`