# Flow

The Flow is the base of your workload, it defines all the tasks you want to perform and the order in which they will be run.

# Flow sample

The flow model is a yaml document describing how Kestra will schedule and compute your workload.

Here is a full sample flow demonstrating the flow definition.
The following code is a sample existing task in Kestra used for testing purposes.

# Flow Properties

id: samples
namespace: io.kestra.tests
revision: 8

description: "Some flow **documentation** in *Markdown*"

labels:
  env: prd
  country: FR

inputs:
  - name: my-value
    type: STRING
    required: false
    defaults: "default value"
    description: This is a not required my-value

variables:
  first: "1"
  second: "{{vars.first}} > 2"
  third: "{{vars.second}} > 3"

tasks:
  - id: date
    type: io.kestra.core.tasks.debugs.Return
    description: "Some tasks **documentation** in *Markdown*"
    disabled: false
    format: "A log line content with a contextual date variable {{taskrun.startDate}}"

errors:
  - id: failed-echo
    type: io.kestra.core.tasks.debugs.Echo
    format: I'm failing {{task.id}}

listeners:
  - description: "some listener **documentation** in *Markdown*"
    conditions:
      - type: io.kestra.core.models.conditions.types.ExecutionStatusCondition
        in:
          - SUCCESS
    tasks:
      - id: execution-failed-listener
        type: io.kestra.core.tasks.scripts.Bash
        commands:
          - echo "I'm a listeners"

triggers:
  - id: monthly
    type: io.kestra.core.models.triggers.types.Schedule
    description: "some trigger **documentation** in *Markdown*"
    cron: 0 0 1 * *
    backfill:
      start: 2020-01-01T00:00:00+02:00

taskDefaults:
  - type: io.kestra.core.tasks.debugs.Echo
    level: ERROR

disabled: false
Field Description
id Flow identifier, must be unique across namespaces.
namespace Each task lives in one arbitrary namespace, this is useful for task organization. A Namespace is required.
revision A Flow version, handled internally by kestra, and is incremented for each modification save, not a required field since it is autogenerated.
description Description for documentation, more details here
labels List of labels (key & value as string) for this flow.
inputs List of inputs for the current flow, more details here
inputs.[].name The name for this input, allowing it to be used as variables(vars) on the current flow
inputs.[].type The type for this input, for example (STRING, FILE, etc...)
inputs.[].required Determines if the input is required (and prevents the flow from executing without this input)
inputs.[].defaults The default value of the input if no value is provided
inputs.[].description Description for documentation, more details here
variables A list of variables (such as key, value, etc) for the current flow that can be reached with {{ vars.name }}
tasks A list of related tasks for the current flow, all tasks will be run sequentially.
tasks.[].id The unique task id for the current flow.
tasks.[].type The task type is a full java class name.
tasks.[].description Description for documentation, more details here
tasks.[].disabled This task is disabled, and will be kept on the flow source, but never executed.
tasks.[].timeout This is the max duration of the current task, in a Duration format like PT15M.
tasks.[].xxx Each task type comes with a specific field that is documented on the plugins page
errors A list of error tasks for the current flow, all listed tasks will be run sequentially only if there is an error on the current execution.
errors.[].xxx The same property as tasks, error can be any normal tasks, more details here
listeners List of listeners for the current flow, more details here
listeners.[].description Description for documentation, more details here
listeners.[].condition The condition that will be validated in order to launch or skip this listener
listeners.[].tasks.[].xxx The same property as tasks, the task to run for this listener
triggers Triggers are external events (such as date and/or time, for example) to launch this job, more details here
triggers.[].id A unique trigger id which can't be updated.
triggers.[].type The trigger type is a full java class name.
triggers.[].description Description for documentation, more details here
triggers.[].disabled Disabled the triggers
triggers.[].xxx Like tasks, each trigger has its own properties
taskDefaults Default value for current tasks, in order to avoid repeat the same properties on each tasks
taskDefaults.[].type The task type is a full java class name.
taskDefaults.[].forced If the default value is set to Forced, the taskDefault will always overwrite the user properties for the task (default false).
taskDefaults.[].values.xxx The properties (just like Tasks) that you want to be set as default.
disabled The flow can be disabled to prevent any executions.