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 .md to any kestra.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.

ValueDuration
PT0.250S250 milliseconds
PT2S2 seconds
PT1M1 minute
PT3.5H3 hours, 30 minutes
P6DT4H6 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: timeout
namespace: 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: PT5S

Flow-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?