New to Kestra?
Use blueprints to kickstart your first workflows.
Package a Python script as a reusable Kestra subflow. Pass typed inputs, run it in Docker, and return outputs to parent flows through one clean interface.
Turn a Python script into a reusable, parameterized building block. This blueprint packages a Python script as a Kestra subflow that accepts typed inputs, executes inside an isolated Docker container, and returns a structured output. Parent flows call it like a function: pass arguments in, get results back, without duplicating logic or worrying about the implementation details. This is the foundation for modular, DRY orchestration where complex logic stays encapsulated behind a simple interface.
arg1 and arg2, both INT with defaults of 1 and 2.python task of type io.kestra.plugin.scripts.python.Commands runs the script.io.kestra.plugin.scripts.runner.docker.Docker task runner for isolated, reproducible execution, and declares the kestra pip dependency.main.py is provided via inputFiles. It parses --arg1 and --arg2 with argparse, multiplies them, prints the result, and emits it with Kestra.outputs({'result': result}).commands block invokes python main.py --arg1 {{ inputs.arg1 }} --arg2 {{ inputs.arg2 }}, wiring the flow inputs into the script.io.kestra.plugin.core.flow.Subflow, sets wait: true, passes inputs, and maps result from {{ outputs.python.vars.result }}.Plain scripts have no contract, no isolation, and no reuse story. Kestra wraps your Python in declarative YAML with typed inputs, container execution, and explicit outputs. Subflows give you composition the way functions do in code, while event triggers, automatic retries, and built-in execution lineage handle the operational concerns a standalone script or a bare cron job cannot: you get observability, replay, and parent-child traceability across every call.
{{ secret('NAME') }} values.arg1 and arg2 if you like.result output in the execution view.io.kestra.plugin.core.flow.Subflow task pointing at this flowId.inputs and read {{ outputs.<taskId>.vars.result }} downstream.main.py with your own logic and add inputs to match.Kestra.outputs({...}) for richer return values.dependencies for heavier workloads.