Step Sleep (:sleep)
Quick Answer
Use :sleep to pause a flow without blocking workers.
Provide exactly one duration field: :seconds, :millis, or :duration.
Use :sleep for fixed in-run delays such as deployment-lag buffers, polling
gaps, or rate-limit spacing. Do not use :wait as a timer; waits are for
external signals, webhooks, CLI actions, or human actions.
Canonical Shape
| Field | Type | Required | Notes |
|---|---|---|---|
:type | keyword | Yes | Must be :sleep |
:seconds | int | One-of | Integer seconds |
:millis | int | One-of | Integer milliseconds |
:duration | string | One-of | Duration string (for example "5m", "2h", "1d") |
:timeout | int | No | Common step timeout option |
:retry | map | No | Common step retry option |
Limits And Behavior
- Exactly one of
:seconds,:millis, or:durationcan be set. - If none is set, sleep defaults to
1second. - Maximum duration is constrained by the workflow max-duration limit.
- In Temporal-backed runs,
:sleepuses a workflow timer and is still captured
as a normal step for run inspection.
Result Shape
{:slept-seconds 30}
Canonical Example
{:functions [{:id :retry-delay
:language :clojure
:code "(fn [input]\n {:seconds (min 300 (max 1 (* 5 (or (:attempt input) 1))))})"}]
:flow
'(let [delay (flow/step :function :compute-delay
{:ref :retry-delay
:input (flow/input)})]
(flow/step :sleep :backoff
{:seconds (:seconds delay)}))}