Skip to content

Commit

Permalink
Add workflow templates endpoint (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng authored Jan 31, 2025
1 parent f38ba59 commit 6a2edc1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions skyvern/forge/sdk/routes/agent_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,22 @@ async def get_workflows(
)


@base_router.get("/workflows/templates", response_model=list[Workflow])
@base_router.get("/workflows/templates/", response_model=list[Workflow], include_in_schema=False)
async def get_workflow_templates() -> list[Workflow]:
global_workflows_permanent_ids = await app.STORAGE.retrieve_global_workflows()

if not global_workflows_permanent_ids:
return []

workflows = await app.WORKFLOW_SERVICE.get_workflows_by_permanent_ids(
workflow_permanent_ids=global_workflows_permanent_ids,
statuses=[WorkflowStatus.published, WorkflowStatus.draft],
)

return workflows


@base_router.get("/workflows/{workflow_permanent_id}", response_model=Workflow)
@base_router.get("/workflows/{workflow_permanent_id}/", response_model=Workflow)
async def get_workflow(
Expand Down

0 comments on commit 6a2edc1

Please sign in to comment.