Prevent Hanging Tasks by Setting Maximum Execution Times
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.
A timeout defines the maximum duration a runnable task is allowed to run. If a task run exceeds that duration, Kestra stops it and marks it as failed — preventing hangs and bounding costs for long-running cloud jobs like Snowflake queries or AWS Batch tasks.
Format
Timeouts use the ISO 8601 duration format. Week, month, and year designators are not supported. See also: retries.
| Value | Duration |
|---|---|
| PT0.250S | 250 milliseconds |
| PT2S | 2 seconds |
| PT1M | 1 minute |
| PT3.5H | 3 hours, 30 minutes |
| P6DT4H | 6 days, 4 hours |
Example
The costly_query task sleeps for 10 seconds, but the timeout is set to 5 seconds, causing the task to fail.
id: timeoutnamespace: company.team
tasks: - id: costly_query type: io.kestra.plugin.scripts.shell.Commands taskRunner: type: io.kestra.plugin.core.runner.Process commands: - sleep 10 timeout: PT5SFlow-level timeout
There is no flow-level timeout. To cancel a workflow execution that exceeds a specific duration, use MAX_DURATION-type SLA.
Was this page helpful?