Feature/workflow history (#3432)

Co-authored-by: Shuchang Zheng <wintonzheng0325@gmail.com>
This commit is contained in:
Alex Angin
2025-09-21 02:48:27 -04:00
committed by GitHub
parent 9a9ee01253
commit 0b47482fcb
19 changed files with 1387 additions and 67 deletions

View File

@@ -1840,6 +1840,36 @@ async def get_workflow(
)
@legacy_base_router.get(
"/workflows/{workflow_permanent_id}/versions",
response_model=list[Workflow],
tags=["agent"],
openapi_extra={
"x-fern-sdk-method-name": "get_workflow_versions",
},
)
@legacy_base_router.get(
"/workflows/{workflow_permanent_id}/versions/", response_model=list[Workflow], include_in_schema=False
)
async def get_workflow_versions(
workflow_permanent_id: str,
current_org: Organization = Depends(org_auth_service.get_current_org),
template: bool = Query(False),
) -> list[Workflow]:
"""
Get all versions of a workflow by its permanent ID.
"""
analytics.capture("skyvern-oss-agent-workflow-versions-get")
if template:
if workflow_permanent_id not in await app.STORAGE.retrieve_global_workflows():
raise InvalidTemplateWorkflowPermanentId(workflow_permanent_id=workflow_permanent_id)
return await app.WORKFLOW_SERVICE.get_workflow_versions_by_permanent_id(
workflow_permanent_id=workflow_permanent_id,
organization_id=None if template else current_org.organization_id,
)
@legacy_base_router.post(
"/suggest/{ai_suggestion_type}",
include_in_schema=False,