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.mdto anykestra.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.
Do not use outputs to fetch sensitive data such as passwords, secrets, or API tokens. All data fetched via outputs is stored in clear text in the backend database, internal storage, logs, and API responses. Use Secrets instead. Enterprise Edition and Kestra Cloud offer native integrations with external secrets managers.
Using outputs
Reference a previous task’s output with {{ outputs.<task_id>.<attribute> }} in any dynamic property:
id: task_outputs_examplenamespace: 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 if you’re unfamiliar with either.
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. Pass that URI to downstream tasks:
id: output_samplenamespace: 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_outputsnamespace: 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.
Pass data between flows
Access a child flow’s declared outputs in the parent via {{ outputs.<subflow_task_id>.outputs.<output_id> }}:
id: parent_flownamespace: 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.
Return outputs conditionally
Use a ternary expression to return different outputs based on task state:
id: conditionally_return_outputnamespace: 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 EditionCloudScript tasks can emit encrypted outputs that are masked in the UI using the encryptedOutputs syntax:
id: encrypted_outputnamespace: 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?