Flow icon
Return icon

Trigger a flow when other flows finish successfully

Trigger a Kestra flow when two upstream flows complete successfully within a time window. Build event-driven, dependency-aware pipelines with flow triggers.

Categories
Core
id: flow-downstream
namespace: company.team

triggers:
  - id: multiple_listen_flow
    type: io.kestra.plugin.core.trigger.Flow
    dependsOn:
      - flowId: flow_a
        namespace: company.team
        states:
          - SUCCESS
      - flowId: flow_b
        namespace: company.team
        states:
          - SUCCESS
    window:
      lookback: P1D

tasks:
  - id: task_c
    type: io.kestra.plugin.core.debug.Return
    format: "{{ task.id }}"

This blueprint wires up a downstream flow that runs automatically once two upstream flows, flow_a and flow_b, both finish successfully inside a rolling 24-hour window. It solves the classic fan-in dependency problem: when a final step (a report, a load, an aggregation) must wait for several independent pipelines to complete, you should not hardcode brittle schedules and hope they line up. Instead, this flow listens for completion events and fires the moment all conditions are met, giving you reliable cross-flow orchestration without polling or guesswork.

How it works

The flow is intentionally minimal so the trigger logic stays front and center.

  • A single task task_c of type io.kestra.plugin.core.debug.Return echoes the task id as a placeholder for your real downstream logic.
  • A trigger multiple_listen_flow of type io.kestra.plugin.core.trigger.Flow listens to executions across the instance.
  • The trigger's dependsOn list has two entries, each pinned to a specific upstream flow with flowId: flow_a and flowId: flow_b in the company.team namespace, and each requiring states: [SUCCESS].
  • A top-level window.lookback: P1D (a 24-hour evaluation window) means the downstream flow fires only when both upstream flows have succeeded inside that rolling day.

What you get

  • Event-driven fan-in: one flow starts automatically after multiple upstream flows succeed.
  • No fragile time coupling between dependent pipelines.
  • A clear, declarative dependency graph expressed in YAML.
  • A reusable pattern you can scale to three, four, or more upstream flows.

Who it's for

  • Data engineers coordinating multi-source ingestion before a downstream load or transform.
  • Platform teams building dependency-aware DAGs across many separate flows.
  • Analytics teams that need a report to run only after every feeding pipeline lands.

Why orchestrate this with Kestra

A flow's own scheduler can only fire on time, not on the completion of other flows. Kestra flow triggers react to real execution events, so the downstream flow runs exactly when its upstream dependencies finish rather than on a guessed clock offset. You get declarative YAML, built-in retries, full execution lineage across flows, and a dependsOn list paired with a window.lookback that captures multi-flow completion. That cross-flow, event-based dependency is the specific gap a single flow's cron schedule cannot fill.

Prerequisites

  • A running Kestra instance.
  • Two upstream flows named flow_a and flow_b in the company.team namespace.

Secrets

This blueprint references no secrets.

Quick start

  1. Add this flow to your company.team namespace.
  2. Ensure flow_a and flow_b exist in the same namespace.
  3. Execute both upstream flows so each completes with status SUCCESS.
  4. Confirm task_c runs automatically once both succeed inside the 24-hour window.

How to extend

  • Replace task_c with your real workload (a transform, a load, a notification).
  • Add more entries to dependsOn (each with its own flowId) to wait on additional flows.
  • Adjust window.lookback to widen or shift the evaluation period.
  • Point the dependsOn entries at flows in other namespaces to coordinate across teams.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.