---
title: Human review and waits
description: "Pause a run for a person's decision, an event from another system, or a wake time, and read the outcome safely."
---

Pause a run for a person's decision, an event from another system, or a wake time, and read the outcome safely.

## Wait for a review, an event or a time

A workflow body pauses for a person's decision, an event another system
sends, or a wake time. The run parks and resumes when the response, event or
time arrives.

- `wait_for_review(Schema, subject=result, context=..., timeout="72h")`
  suspends for a human decision. `subject` is required and must be the result
  of a step or primitive call, not a field of one, so Andon can snapshot its
  producer provenance. A reviewer who needs several results gets a tuple or
  record of whole results, such as `subject=(summary, risks)`; the review
  depends on each result you pass to the tuple or record. `context` is
  optional presentation material. Put `FileRef`s (not filename strings) in
  the context for any documents the reviewer needs; the console renders
  each as an openable evidence chip. Use
  `wait_for_event(Schema, timeout=...)` for API signals. The run imports
  `Schema` by name when a response arrives, so declare it as a class at module
  scope under its own name, or use a builtin, a `Literal` of strings, numbers,
  booleans or `None`, or a list, dict, tuple, or union of those; deploy
  rejects an `Annotated` type, a class defined inside a function, or a
  `Literal` of enum members. Both return
  `WaitOutcome[Schema]`, a union of `WaitCompleted[Schema]` (with `value` and
  `timed_out=False`) and `WaitTimedOut` (with only `timed_out=True`). Branch on
  the bare `.timed_out` field, then read `.value` only in that branch's
  `false=` arm; deploy validation rejects unguarded projections. Passing or
  returning the whole union is legal when the consumer handles both variants.
  The label defaults to the result's variable binding;
  pass `label=` when the external rendezvous identity must differ. Labels use
  the stable-key grammar `[a-z_][a-z0-9_]*`. Timeout is required. Durations are
  strings: `"30s"`, `"5m"`, `"2h"`, `"7d"`. Run signal discovery reports the
  stable label and the current event occurrence id. Responders use that id to
  read the event detail, including a review's subject and subject schema, and to
  submit a response without risking a later occurrence that reused the label.
- `wait_for_event(Schema, metadata=Record(...), timeout=...)` says what the
  wait is about, such as the email thread it waits on, so a Gmail trigger can
  answer it (see [Triggers](/authoring/triggers)). `metadata` is an instance of a
  dataclass or Pydantic model declared at module scope, built from workflow
  values; deploy rejects any other value. It is stored once with the wait and
  shown in the event detail as declared. `context` stays what a responder is
  shown and is not matched on.
- `sleep(duration, then=...)` or `sleep(until=..., then=...)` durably waits,
  then runs `then` and returns its result. Pass exactly one of `duration` and
  `until`; `then` is required. `then` is an arm, as in `branch`: a call
  written inside it runs after the wake, and a local body holds several
  calls. `duration` is a constant such as `"3d"`, counted from when the sleep
  becomes eligible: once every value its arm uses is ready and, for a sleep
  inside a `branch` arm, once that arm is chosen. `until` is a workflow value
  that resolves to a timezone-aware `datetime`, such as a field of the input,
  a step's result or a constant cutoff; it is validated where the sleep runs.
  The arm runs at the later of the wake time and its values being ready, and
  a time already past wakes at once. A result bound before the sleep is
  computed on its own schedule, so `sleep("3d", then=status)` makes `status`
  available three days after it is ready. The wake time is fixed when the
  sleep becomes eligible; when it falls after the end of the run's life the
  run fails at once. A polling loop is `body=lambda state: sleep("1d",
  then=check(state))`.

  ```python
  review = wait_for_review(Decision, subject=prepare_review(claim), timeout="10d")
  approved = is_approved(review)
  return branch(approved, true=sleep("3d", then=send_reminder(claim)))
  # approved on day 5: the reminder goes out on day 8
  ```
