Skip to main content
Create a new workflow from a JSON or YAML definition.
workflow = await client.create_workflow(
    json_definition={
        "title": "Extract Products",
        "workflow_definition": {
            "parameters": [
                {
                    "key": "target_url",
                    "parameter_type": "workflow",
                    "workflow_parameter_type": "string",
                    "description": "URL to scrape",
                }
            ],
            "blocks": [
                {
                    "block_type": "task",
                    "label": "extract_data",
                    "prompt": "Extract the top 3 products",
                    "url": "{{ target_url }}",
                }
            ],
        },
    },
)
print(workflow.workflow_permanent_id)

Parameters

ParameterTypeRequiredDescription
json_definitionWorkflowCreateYamlRequestNoWorkflow definition as a JSON object.
yaml_definitionstrNoWorkflow definition as a YAML string.
folder_idstrNoFolder to organize the workflow in.
request_optionsRequestOptionsNoPer-request configuration (see below).
You must provide either json_definition or yaml_definition.

Returns Workflow

FieldTypeDescription
workflow_idstrUnique ID for this version.
workflow_permanent_idstrStable ID across all versions. Use this to run workflows.
versionintVersion number.
titlestrWorkflow title.
workflow_definitionWorkflowDefinitionThe full definition including blocks and parameters.
statusstr | NoneWorkflow status.
created_atdatetimeWhen the workflow was created.

Request options

Override timeout, retries, or headers for this call by passing request_options (Python) or a second options argument (TypeScript).
from skyvern.client.core import RequestOptions

request_options=RequestOptions(
    timeout_in_seconds=120,
    max_retries=3,
    additional_headers={"x-custom-header": "value"},
)
Option (Python)Option (TypeScript)TypeDescription
timeout_in_secondstimeoutInSecondsint / numberHTTP timeout in seconds.
max_retriesmaxRetriesint / numberRetry count.
additional_headersheadersdict / Record<string, string>Extra headers.
additional_query_parameters-dictExtra query parameters.
additional_body_parameters-dictExtra body parameters.
-abortSignalAbortSignalSignal to cancel the request.
-apiKeystringOverride API key.