Prefect CreateFlowRun

Prefect CreateFlowRun

Certified

Trigger a Prefect deployment run

Creates a flow run from a Prefect deployment and can wait until it reaches a terminal state. Works with Prefect Cloud (account and workspace required) and self-hosted APIs; waits poll every 5 seconds by default and fails on FAILED/CRASHED/CANCELLED when waiting. Killing the Kestra task, or a worker shutdown, cancels the corresponding Prefect flow run when wait is true.

yaml
type: io.kestra.plugin.prefect.CreateFlowRun

Trigger a Prefect Cloud deployment and wait for completion

yaml
id: prefect_trigger
namespace: company.team

tasks:
  - id: trigger_prefect_run
    type: io.kestra.plugin.prefect.CreateFlowRun
    apiUrl: "https://api.prefect.cloud/api"
    accountId: "{{ secret('PREFECT_ACCOUNT_ID') }}"
    workspaceId: "{{ secret('PREFECT_WORKSPACE_ID') }}"
    deploymentId: "{{ secret('PREFECT_DEPLOYMENT_ID') }}"
    apiKey: "{{ secret('PREFECT_API_KEY') }}"
    wait: true
    pollFrequency: PT10S

Trigger a Prefect Cloud deployment without waiting

yaml
id: prefect_trigger
namespace: company.team

tasks:
  - id: trigger_prefect_run
    type: io.kestra.plugin.prefect.CreateFlowRun
    apiUrl: "https://api.prefect.cloud/api"
    accountId: "{{ secret('PREFECT_ACCOUNT_ID') }}"
    workspaceId: "{{ secret('PREFECT_WORKSPACE_ID') }}"
    deploymentId: "{{ secret('PREFECT_DEPLOYMENT_ID') }}"
    apiKey: "{{ secret('PREFECT_API_KEY') }}"
    wait: false

Trigger a self-hosted Prefect deployment (without authentication)

yaml
id: prefect_self_hosted
namespace: company.team

tasks:
  - id: trigger_prefect_run
    type: io.kestra.plugin.prefect.CreateFlowRun
    apiUrl: "http://host.docker.internal:4200/api"
    deploymentId: "{{ secret('PREFECT_DEPLOYMENT_ID') }}"
    wait: true
    pollFrequency: PT10S

Trigger a self-hosted Prefect deployment with Basic authentication

yaml
id: prefect_self_hosted_auth
namespace: company.team

tasks:
  - id: trigger_prefect_run
    type: io.kestra.plugin.prefect.CreateFlowRun
    apiUrl: "http://host.docker.internal:4200/api"
    deploymentId: "{{ secret('PREFECT_DEPLOYMENT_ID') }}"
    apiKey: "{{ secret('PREFECT_BASIC_AUTH') }}"  # base64-encoded "admin:pass"
    wait: true
    pollFrequency: PT10S

Pass parameters to the flow run

yaml
id: prefect_with_params
namespace: company.team

tasks:
  - id: trigger_prefect_run
    type: io.kestra.plugin.prefect.CreateFlowRun
    apiUrl: "https://api.prefect.cloud/api"
    accountId: "{{ secret('PREFECT_ACCOUNT_ID') }}"
    workspaceId: "{{ secret('PREFECT_WORKSPACE_ID') }}"
    deploymentId: "{{ secret('PREFECT_DEPLOYMENT_ID') }}"
    apiKey: "{{ secret('PREFECT_API_KEY') }}"
    wait: true
    parameters:
      run_date: "{{ now() }}"
      retries: 2
      region: "us-east-1"
Properties

Deployment ID

Deployment UUID used to create the flow run.

Prefect Cloud account ID

Prefect Cloud account UUID required when calling the Cloud API.

API credentials

Authentication sent in the Authorization header. Prefect Cloud expects an API key (sent as Bearer); self-hosted can supply a base64 Basic token like "YWRtaW46cGFzcw==" or the full "Basic ..." header; leave empty for unauthenticated servers.

Defaulthttps://api.prefect.cloud/api

Prefect API endpoint

Base Prefect API URL. Defaults to https://api.prefect.cloud/api; for self-hosted instances provide your /api endpoint such as http://127.0.0.1: 4200/api.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Flow run parameters

Optional parameters passed to the flow run after rendering with the task context.

DefaultPT5S
Formatduration

Poll frequency

Polling interval while waiting; defaults to PT5S and only used when wait is true.

Defaulttrue

Wait for flow run completion

Whether to block until the flow run reaches a terminal state. Defaults to true; when true, FAILED/CRASHED/CANCELLED throw a task error.

Prefect Cloud workspace ID

Prefect Cloud workspace UUID required when calling the Cloud API.

Flow run ID

ID of the created flow run

Flow run URL

URL to view the flow run in Prefect UI (Cloud or self-hosted)

Flow run state

Terminal state when wait is true; initial state otherwise