Utility Functions
now()
Returns the current datetime. Accepts a timeZone argument:
{{ now() }}{{ now(timeZone="Europe/Paris") }}max() and min()
Returns the largest or smallest of its arguments:
{{ max(5, 10, 15) }}{# output: 15 #}{{ min(5, 10, 15) }}{# output: 5 #}range()
Generates a list of integers up to and including end. The step defaults to 1:
{{ range(0, 3) }}{# output: [0, 1, 2, 3] #}{{ range(0, 6, 2) }}{# output: [0, 2, 4, 6] #}uuid()
Generates a UUID in URL-safe base62 encoding:
{{ uuid() }}id()
Generates a short unique ID using Kestra’s internal ID utility:
{{ id() }}ksuid()
Generates a K-Sortable Unique Identifier (timestamp-prefixed, base62-encoded). Useful when sort order by creation time matters:
{{ ksuid() }}nanoId()
Generates a NanoID. length defaults to 21 and alphabet defaults to alphanumeric plus -_:
{{ nanoId() }}{{ nanoId(length=10) }}randomInt()
Generates a random integer. The upper bound is excluded:
{{ randomInt(1, 10) }}{# generates a random integer from 1 to 9 (10 is excluded) #}randomPort()
Picks an available local port. Useful in test or dev container flows:
{{ randomPort() }}http()
Fetches a remote payload directly from an expression:
{{ http(uri = 'https://dummyjson.com/products/categories') | jq('.[].slug') }}Use it sparingly. It is convenient for dynamic dropdowns and lightweight lookups, but task-level HTTP calls are usually easier to observe and retry.
fileSize()
Returns the size in bytes of a file from internal storage:
{{ fileSize(outputs.download.uri) }}fileExists()
Returns true if the file exists:
{{ fileExists(outputs.download.uri) }}isFileEmpty()
Returns true if the file has no content:
{{ isFileEmpty(outputs.download.uri) }}Was this page helpful?