mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-10 06:15:18 +00:00
Workflow: Output Parameters & Code Blocks (#117)
This commit is contained in:
parent
d2ca6ca792
commit
066c2302b5
11 changed files with 556 additions and 44 deletions
|
@ -5,6 +5,7 @@ from typing import Any, List
|
|||
from pydantic import BaseModel
|
||||
|
||||
from skyvern.forge.sdk.schemas.tasks import ProxyLocation
|
||||
from skyvern.forge.sdk.workflow.exceptions import WorkflowDefinitionHasDuplicateBlockLabels
|
||||
from skyvern.forge.sdk.workflow.models.block import BlockTypeVar
|
||||
|
||||
|
||||
|
@ -22,6 +23,18 @@ class RunWorkflowResponse(BaseModel):
|
|||
class WorkflowDefinition(BaseModel):
|
||||
blocks: List[BlockTypeVar]
|
||||
|
||||
def validate(self) -> None:
|
||||
labels: set[str] = set()
|
||||
duplicate_labels: set[str] = set()
|
||||
for block in self.blocks:
|
||||
if block.label in labels:
|
||||
duplicate_labels.add(block.label)
|
||||
else:
|
||||
labels.add(block.label)
|
||||
|
||||
if duplicate_labels:
|
||||
raise WorkflowDefinitionHasDuplicateBlockLabels(duplicate_labels)
|
||||
|
||||
|
||||
class Workflow(BaseModel):
|
||||
workflow_id: str
|
||||
|
@ -61,6 +74,13 @@ class WorkflowRunParameter(BaseModel):
|
|||
created_at: datetime
|
||||
|
||||
|
||||
class WorkflowRunOutputParameter(BaseModel):
|
||||
workflow_run_id: str
|
||||
output_parameter_id: str
|
||||
value: dict[str, Any] | list | str | None
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class WorkflowRunStatusResponse(BaseModel):
|
||||
workflow_id: str
|
||||
workflow_run_id: str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue