Flows, Tasks, and the Execution Model
A flow is Kestra's core abstraction: a YAML document that defines what to run, in what order, with what inputs. Tasks are the steps inside a flow. Executions are the runtime instances. Namespaces organize everything. These four concepts are the vocabulary for every product conversation.
Flows: the fundamental unit
A flow in Kestra is a YAML document that defines:
- What namespace it belongs to (organization and access control)
- What triggers it (schedule, webhook, event, or manual)
- What inputs it accepts (typed parameters validated at runtime)
- What tasks it runs (in what order and with what dependencies)
- What outputs it produces
A minimal flow looks like this:
```yaml
id: hello-world
namespace: my.team
tasks:
- id: greet
type: io.kestra.plugin.core.log.Log
message: Hello, {{ inputs.name }}!
inputs:
- id: name
type: STRING
triggers:
- id: daily
type: io.kestra.plugin.core.trigger.Schedule
cron: "0 9 * * *"
```
What this expresses declaratively: every morning at 9am, run the greet task with the name input. No Python environment, no import statements, no dependency management — just the definition.
Flows are versioned. Every time you save a flow, Kestra keeps the history. You can compare revisions, roll back to a previous version, and see exactly what changed. This is a first-class feature, not an afterthought — it enables GitOps workflows where flows are committed to a repository and synced into Kestra via the Git Sync plugin.
The board itself — the space where play happens. A flow is the goban: it defines the space where tasks execute, with its own rules (inputs, triggers, namespace) that govern the game played within it.
Tasks: runnable vs. flowable
Tasks come in two fundamental types:
Runnable tasks perform actual work: call an API, run a SQL query, execute a Python script, send a Slack message, transfer a file. They have inputs, they do something, they produce outputs. Most of the 1300+ Kestra plugins are runnable tasks.
Flowable tasks orchestrate other tasks — they define control flow logic rather than doing work themselves:
- Sequential (default): run tasks one after another
- Parallel: run multiple tasks concurrently, wait for all to complete
- Switch: branch to different task sequences based on a value
- ForEachItem: iterate over a list and run a task (or subflow) for each item
- If: conditional execution based on an expression
- Pause: stop and wait for human approval or a timeout
- EachParallel: iterate in parallel
The distinction matters for product thinking: when users ask for "more control flow options," they're asking for new flowable task types. When they ask for "more integrations," they're asking for new runnable task types (plugins). These are very different engineering investments.
Task outputs and inputs are strongly typed. A task that fetches data from an API produces a typed output object. The next task references that output with Pebble expression syntax: {{ outputs.previousTask.someField }}. This creates a data contract between tasks that Kestra validates at flow definition time, not just at runtime.
Executions, namespaces, and the execution lifecycle
Executions are runtime instances of a flow. Every time a flow runs — whether triggered by a schedule, webhook, manual start, or another flow — it creates an execution. Each execution has:
- A unique ID
- A state: CREATED → RUNNING → SUCCESS / FAILED / KILLED / PAUSED
- Task run records: one per task, each with its own state, inputs, outputs, and logs
- Execution labels: key-value pairs for filtering and searching
The execution lifecycle is what makes observability possible. You can filter all executions by flow, namespace, state, label, or time range. You can drill into a specific execution and see exactly which task failed, what its inputs were, and what error it produced. This is the core value of an orchestration platform over cron — every run is a first-class record, not a line in a log file.
Namespaces are the organizational layer. They work hierarchically (prod.data.finance, prod.data.marketing) and define:
- Access control: which teams can see and modify which flows
- Plugin defaults: default configurations that apply to all flows in a namespace (e.g., always use this AWS region)
- Secrets inheritance: secrets defined at the namespace level are available to all flows within it
- Task defaults: per-task-type configuration that overrides the defaults for the entire namespace
For a PM, namespaces are the enterprise feature that enables multi-tenant deployments. A bank running Kestra across 20 different business units uses namespaces to ensure each unit's workflows are isolated from others.
Select any text in the lesson to ask a question. Press Esc to close.