Pause the current execution and wait for approval (either by humans or other automated processes).
All tasks downstream from the Pause task will be put on hold until the execution is manually resumed from the UI.
The Execution will be in a Paused state, and you can either manually resume it by clicking on the "Resume" button in the UI or by calling the POST API endpoint /api/v1/executions/{executionId}/resume
. The execution can also be resumed automatically after the pauseDuration
.
type: "io.kestra.plugin.core.flow.Pause"
Pause the execution and wait for a manual approval.
id: human_in_the_loop
namespace: company.team
tasks:
- id: before_approval
type: io.kestra.plugin.core.debug.Return
format: Output data that needs to be validated by a human
- id: pause
type: io.kestra.plugin.core.flow.Pause
- id: run_post_approval
type: io.kestra.plugin.scripts.shell.Commands
runner: PROCESS
commands:
- echo "Manual approval received! Continuing the execution..."
- id: post_resume
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} started on {{ taskrun.startDate }} after the Pause"
Vacation approval process pausing the execution for approval and waiting for input from a human to approve or reject the request.
id: vacation_approval_process
namespace: company.team
inputs:
- id: request.name
type: STRING
defaults: Rick Astley
- id: request.start_date
type: DATE
defaults: 2042-07-01
- id: request.end_date
type: DATE
defaults: 2042-07-07
- id: slack_webhook_uri
type: URI
defaults: https://reqres.in/api/slack
tasks:
- id: send_approval_request
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
url: "{{ inputs.slack_webhook_uri }}"
payload: |
{
"channel": "#vacation",
"text": "Validate holiday request for {{ inputs.request.name }}. To approve the request, click on the `Resume` button here http://localhost:28080/ui/executions/{{flow.namespace}}/{{flow.id}}/{{execution.id}}"
}
- id: wait_for_approval
type: io.kestra.plugin.core.flow.Pause
onResume:
- id: approved
description: Whether to approve the request
type: BOOLEAN
defaults: true
- id: reason
description: Reason for approval or rejection
type: STRING
defaults: Well-deserved vacation
- id: approve
type: io.kestra.plugin.core.http.Request
uri: https://reqres.in/api/products
method: POST
contentType: application/json
body: "{{ inputs.request }}"
- id: log
type: io.kestra.plugin.core.log.Log
message: Status is {{ outputs.wait_for_approval.onResume.reason }}. Process finished with {{ outputs.approve.body }}
Pause the execution and set the execution to WARNING if it has not been resumed after 5 minutes.
id: pause_warn
namespace: company.team
tasks:
- id: pause
type: io.kestra.plugin.core.flow.Pause
pauseDuration: PT5M
behavior: WARN
- id: post_resume
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} started on {{ taskrun.startDate }} after the Pause"
RESUME
RESUME
WARN
CANCEL
FAIL
Pause behavior, by default set to RESUME. This property controls happens when a pause task reach its duration.
Tasks that are resumed before the duration (for example, from the UI) will not use the behavior property but will always succeed. Possible values are:
- RESUME: continues with the execution
- WARN: ends the Pause task in WARNING and continues with the execution
- FAIL: fails the Pause task
- CANCEL: cancels the execution
duration
Duration of the pause — useful if you want to pause the execution for a fixed amount of time.
Deprecated: use pauseDuration
instead.
A runnable task that will be executed when it's paused.
Inputs to be passed to the execution when it's resumed.
Before resuming the execution, the user will be prompted to fill in these inputs. The inputs can be used to pass additional data to the execution, which is useful for human-in-the-loop scenarios. The onResume
inputs work the same way as regular flow inputs — they can be of any type and can have default values. You can access those values in downstream tasks using the onResume
output of the Pause task.
duration
Duration of the pause. If not set, the task will wait forever to be manually resumed except if a timeout is set, in this case, the timeout will be honored.
The duration is a string in ISO 8601 Duration format, e.g. PT1H
for 1 hour, PT30M
for 30 minutes, PT10S
for 10 seconds, P1D
for 1 day, etc. If no pauseDuration and no timeout are configured, the execution will never end until it's manually resumed from the UI or API.