Capture and Reuse Execution Results Across Tasks and Flows

For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append .md to any kestra.io/docs/* URL for plain Markdown.

Outputs let you pass data between tasks and flows.

Outputs are stored in the flow’s execution context and accessible by all downstream tasks and flows. Each task defines its own output attributes; see the task’s plugin documentation for details, or inspect them in the Input/Output tab of the Execution page.

Output reference syntax

Task outputs are referenced with {{ outputs.<task_id>.<attribute> }} in any dynamic property:

id: task_outputs_example
namespace: company.team
tasks:
- id: produce_output
type: io.kestra.plugin.core.debug.Return
format: my output {{ execution.id }}
- id: use_output
type: io.kestra.plugin.core.log.Log
message: The previous task output is {{ outputs.produce_output.value }}

File outputs are previewable and downloadable from the execution’s Input/Output tab; any output can be inspected and debugged using the built-in expression evaluator on the same tab. See Outputs in the tutorial.

For loop iteration outputs, sibling task outputs, and the loopOutputs() function, see Flowable tasks and the Loop how-to guide.

Internal storage

Tasks that produce large results write them to Kestra’s internal storage and return a URI. Downstream tasks reference the URI directly. For a full explanation of how internal storage works, including fetchType and file lifetime, see Data Storage.

id: output_sample
namespace: company.team
tasks:
- id: output_from_query
type: io.kestra.plugin.gcp.bigquery.Query
sql: |
SELECT * FROM `bigquery-public-data.wikipedia.pageviews_2023`
WHERE DATE(datehour) = current_date()
ORDER BY datehour desc, views desc
LIMIT 10
store: true
- id: write_to_csv
type: io.kestra.plugin.serdes.csv.IonToCsv
from: "{{ outputs.output_from_query.uri }}"

Flow outputs

Flows can declare strongly typed outputs that are surfaced in the Overview tab and accessible to parent flows via the Subflow task:

id: flow_outputs
namespace: company.team
tasks:
- id: mytask
type: io.kestra.plugin.core.debug.Return
format: this is a task output used as a final flow output
outputs:
- id: final
type: STRING
value: "{{ outputs.mytask.value }}"

Supported output types: ARRAY, BOOLEAN, DATE, DATETIME, DURATION, EMAIL, ENUM, FILE, FLOAT, INT, JSON, MULTISELECT, SECRET, STRING, TIME, URI, YAML.

Child flow output access

A child flow’s declared outputs are accessible in the parent via {{ outputs.<subflow_task_id>.outputs.<output_id> }}:

id: parent_flow
namespace: company.team
tasks:
- id: subflow
type: io.kestra.plugin.core.flow.Subflow
flowId: flow_outputs
namespace: company.team
wait: true
- id: log_subflow_output
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.subflow.outputs.final }}"

The double outputs is intentional: the first accesses the Subflow task’s outputs, the second accesses the child flow’s declared output final.

Conditional output values

A ternary expression selects between output values based on task state:

id: conditionally_return_output
namespace: company.team
inputs:
- id: run_task
type: BOOL
defaults: true
tasks:
- id: main
type: io.kestra.plugin.core.debug.Return
format: Hello World!
runIf: "{{ inputs.run_task }}"
- id: fallback
type: io.kestra.plugin.core.debug.Return
format: fallback output
outputs:
- id: flow_output
type: STRING
value: "{{ tasks.main.state != 'SKIPPED' ? outputs.main.value : outputs.fallback.value }}"

Encrypted outputs

Available on:

v>=0.23Enterprise EditionCloud

Script tasks can emit encrypted outputs that are masked in the UI using the encryptedOutputs syntax:

id: encrypted_output
namespace: company.team
tasks:
- id: hello
type: io.kestra.plugin.scripts.shell.Script
script: |
echo '::{"outputs":{"plaintext":"plaintext_value"}}::'
echo '::{"encryptedOutputs":{"encrypted":"my secret value"}}::'
- id: print
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.hello['vars']['encrypted'] }}"

The encrypted output is stored and displayed encoded. See Script outputs and metrics for full details.

Was this page helpful?