Skip to content

Commit

Permalink
create_empty_workflow interface in workflow service (Skyvern-AI#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng authored Nov 28, 2024
1 parent 28250e1 commit f491b01
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion skyvern/forge/sdk/workflow/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@
WorkflowRunStatus,
WorkflowRunStatusResponse,
)
from skyvern.forge.sdk.workflow.models.yaml import BLOCK_YAML_TYPES, ForLoopBlockYAML, WorkflowCreateYAMLRequest
from skyvern.forge.sdk.workflow.models.yaml import (
BLOCK_YAML_TYPES,
ForLoopBlockYAML,
WorkflowCreateYAMLRequest,
WorkflowDefinitionYAML,
)
from skyvern.webeye.browser_factory import BrowserState

LOG = structlog.get_logger()
Expand Down Expand Up @@ -1501,3 +1506,20 @@ async def block_yaml_to_block(
)

raise ValueError(f"Invalid block type {block_yaml.block_type}")

async def create_empty_workflow(self, organization: Organization, title: str) -> Workflow:
"""
Create a blank workflow with no blocks
"""
# create a new workflow
workflow_create_request = WorkflowCreateYAMLRequest(
title=title,
workflow_definition=WorkflowDefinitionYAML(
parameters=[],
blocks=[],
),
)
return await app.WORKFLOW_SERVICE.create_workflow_from_request(
organization=organization,
request=workflow_create_request,
)

0 comments on commit f491b01

Please sign in to comment.