Triggers automatically start your flow based on events.

A trigger can be a scheduled date, a new file arrival, a new message in a queue, or the end of another flow's execution.

Defining triggers

Use the triggers keyword in the flow and define a list of triggers. You can have several triggers attached to a flow.

The trigger definition looks similar to the task definition — it contains an id, a type, and additional properties related to the specific trigger type.

The workflow below will be automatically triggered every day at 10 AM, as well as anytime when the first_flow finishes its execution. Both triggers are independent of each other.

yaml
id: getting_started
namespace: company.team
tasks:
  - id: hello_world
    type: io.kestra.plugin.core.log.Log
    message: Hello World!

triggers:
  - id: schedule_trigger
    type: io.kestra.plugin.core.trigger.Schedule
    cron: 0 10 * * *

  - id: flow_trigger
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionFlowCondition
        namespace: company.team
        flowId: first_flow

Add a trigger to your flow

Let's look at another trigger example. This trigger will start our flow every Monday at 10 AM.

yaml
triggers:
  - id: every_monday_at_10_am
    type: io.kestra.plugin.core.trigger.Schedule
    cron: 0 10 * * 1
Click here to see the full workflow example with this Schedule trigger

To learn more about triggers, check out the full triggers documentation.

Was this page helpful?