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.

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.

Flow run parameters

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

Reference (ref) of the pluginDefaults to apply to this task.

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