Skip to main content
A workflow chains multiple steps (blocks) into a single automation. Workflows support loops, conditionals, data passing between steps, and code-based re-execution. For conceptual background, see Build a Workflow.

run_workflow

Execute a workflow by its permanent ID. Skyvern opens a cloud browser and runs each block in sequence.
result = await client.run_workflow(
    workflow_id="wpid_abc123",
    wait_for_completion=True,
)
print(result.output)

Parameters

ParameterTypeRequiredDefaultDescription
workflow_idstrYesThe workflow’s permanent ID (wpid_...).
parametersdictNoNoneInput parameters defined in the workflow. Keys must match parameter names.
wait_for_completionboolNoFalseBlock until the workflow finishes.
timeoutfloatNo1800Max wait time in seconds when wait_for_completion=True.
run_withstrNoNoneForce execution mode: "code" (use cached Playwright code) or "agent" (use AI).
ai_fallbackboolNoNoneFall back to AI if the cached code fails.
browser_session_idstrNoNoneRun inside an existing browser session.
browser_profile_idstrNoNoneLoad a browser profile (cookies, storage) into the session.
proxy_locationProxyLocationNoNoneRoute the browser through a geographic proxy.
max_steps_overrideintNoNoneCap total AI steps across all blocks.
webhook_urlstrNoNoneURL to receive a POST when the run finishes.
titlestrNoNoneDisplay name for this run in the dashboard.
totp_identifierstrNoNoneIdentifier for TOTP verification.
totp_urlstrNoNoneURL to receive TOTP codes.
templateboolNoNoneRun a template workflow.
user_agentstrNoNoneCustom User-Agent header for the browser.
extra_http_headersdict[str, str]NoNoneAdditional HTTP headers injected into every browser request.
max_screenshot_scrollsintNoNoneNumber of scrolls for post-action screenshots.
browser_addressstrNoNoneConnect to a browser at this CDP address.

Returns WorkflowRunResponse

FieldTypeDescription
run_idstrUnique identifier. Starts with wr_ for workflow runs.
statusstrcreated, queued, running, completed, failed, terminated, timed_out, or canceled.
outputdict | NoneExtracted data from the workflow’s output block.
downloaded_fileslist[FileInfo] | NoneFiles downloaded during the run.
recording_urlstr | NoneURL to the session recording.
failure_reasonstr | NoneError description if the run failed.
app_urlstr | NoneLink to view this run in the Cloud UI.
step_countint | NoneTotal AI steps taken across all blocks.
run_withstr | NoneWhether the run used "code" or "agent".
ai_fallbackbool | NoneWhether AI fallback was configured.
script_runScriptRunResponse | NoneCode execution result. Contains ai_fallback_triggered if code was used.

Examples

Pass parameters to a workflow:
result = await client.run_workflow(
    workflow_id="wpid_invoice_extraction",
    parameters={
        "company_name": "Acme Corp",
        "date_range": "2025-01-01 to 2025-12-31",
    },
    wait_for_completion=True,
)
Run with cached code (skip AI, use generated Playwright scripts):
result = await client.run_workflow(
    workflow_id="wpid_daily_report",
    run_with="code",
    ai_fallback=True,  # Fall back to AI if code fails
    wait_for_completion=True,
)
Run with a browser profile (skip login):
result = await client.run_workflow(
    workflow_id="wpid_daily_report",
    browser_profile_id="bpf_abc123",
    wait_for_completion=True,
)

create_workflow

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.
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.

get_workflows

List all workflows. Supports filtering and pagination.
workflows = await client.get_workflows()
for wf in workflows:
    print(f"{wf.title} ({wf.workflow_permanent_id})")

Parameters

ParameterTypeRequiredDefaultDescription
pageintNoNonePage number for pagination.
page_sizeintNoNoneNumber of results per page.
only_saved_tasksboolNoNoneOnly return saved tasks.
only_workflowsboolNoNoneOnly return workflows (not saved tasks).
only_templatesboolNoNoneOnly return templates.
titlestrNoNoneFilter by exact title.
search_keystrNoNoneSearch by title.
folder_idstrNoNoneFilter by folder.
statusWorkflowStatus | list[WorkflowStatus]NoNoneFilter by status.

Returns list[Workflow]


get_workflow

Requires skyvern version 1.1.0 or later. Run pip install --upgrade skyvern to update.
Get a specific workflow by its permanent ID.
workflow = await client.get_workflow("wpid_abc123")
print(workflow.title, f"v{workflow.version}")

Parameters

ParameterTypeRequiredDescription
workflow_permanent_idstrYesThe workflow’s permanent ID.
versionintNoSpecific version to retrieve. Defaults to latest.
templateboolNoWhether to fetch a template workflow.

Returns Workflow


get_workflow_versions

Requires skyvern version 1.1.0 or later. Run pip install --upgrade skyvern to update.
List all versions of a workflow.
versions = await client.get_workflow_versions("wpid_abc123")
for v in versions:
    print(f"v{v.version}{v.modified_at}")

Parameters

ParameterTypeRequiredDescription
workflow_permanent_idstrYesThe workflow’s permanent ID.
templateboolNoWhether to fetch template versions.

Returns list[Workflow]


update_workflow

Update an existing workflow’s definition.
updated = await client.update_workflow(
    "wpid_abc123",
    json_definition={
        "title": "Extract Products",
        "workflow_definition": {
            "blocks": [
                {
                    "block_type": "task",
                    "label": "extract_data",
                    "prompt": "Extract the top 5 products",
                    "url": "https://example.com/products",
                }
            ],
            "parameters": [],
        },
    },
)
print(f"Updated to v{updated.version}")

Parameters

ParameterTypeRequiredDescription
workflow_idstrYesThe workflow’s permanent ID (wpid_...).
json_definitionWorkflowCreateYamlRequestNoUpdated workflow definition as JSON.
yaml_definitionstrNoUpdated workflow definition as YAML.

Returns Workflow

Creates a new version of the workflow.

delete_workflow

Delete a workflow.
await client.delete_workflow("wf_abc123")

Parameters

ParameterTypeRequiredDescription
workflow_idstrYesThe workflow version ID to delete.