> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ravenna.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Waits, loops, and Goto

> Pause Ravenna workflows with Wait, Wait Until, Wait for Message, and Wait for Inactivity, repeat steps for each item with Loop, and retry earlier steps with Goto.

Use wait steps to pause a workflow until a time passes or something happens on the ticket, Loop to run steps once for each item in a list, and Goto to go back and run earlier steps again.

## Wait steps

| Step | Resumes when | Default | Output used downstream |
| - | - | - | - |
| Wait | Duration elapses | 8h | none |
| Wait Until | Target date and time, plus optional offset | none (date, time, and timezone required) | none |
| Wait for Message | A matching message arrives, or the duration elapses | 3d | Is Success (true = message arrived), Ticket Message ID |
| Wait for Inactivity | No matching message for the full duration | 8h | none |
| Wait for Approval | Ticket approval completes, or the duration elapses | 3d | On Approved / On Declined / On Timeout branches |

* Wait durations accept units (`10m`, `1h`, `2.5h`, `1d`), combinations with `+` and `-` (`1d - 8h`), and Forever. Wait also takes an optional From Date and Timezone.
* Wait Until takes a Date Offset with a sign (`-5d`, `+1w`) to resume before or after the target date.
* Wait for Message never counts workflow-generated or AI-generated messages. It does not branch; route on its Is Success result with an If / Else or a later action's filters.
* Wait for Inactivity restarts its timer on every matching message, so it can wait indefinitely on an active ticket. It has no timeout branch.
* Every wait step supports filters. If they evaluate to false, the step is skipped and its path stops.
* Workspace admins can skip a running Wait or Wait Until step. No other wait step can be skipped.

## Loop

* Adding a Loop creates a paired End Loop. Steps between them run once per item, sequentially, with a short pause between iterations.
* The collection must be a list output from an upstream step (Search Tickets, Search Users, Search Assets, Search Entitlements, or a list from an integration action).
* Iterations are capped at the smaller of the list length, the configured limit, and 50.
* An empty list skips the Loop, which stops its path: nothing after End Loop runs. Put must-run steps on a separate path or guard against empty results.
* Inside the loop, reference the current item and Loop Info (Index, Size, Limit).
* Steps inside a loop can't be duplicated. Loop and End Loop can't be reordered.

## Goto

* Goto jumps to an upstream step only. A target that isn't upstream fails the step.
* Budget defaults to 1 and can be at most 100. Once spent, the Goto stops jumping and continues down its On Limit Reached path.
* If its filters evaluate to false, the Goto is skipped and its path stops.
* Goto does not add an edge, so the graph stays acyclic for validation.

## Recipes

**Retry with backoff:** HTTP Request with Fail on error disabled, then If / Else on Is Success. False path: Wait (a few minutes), then Goto back to the HTTP Request with a small budget. On Limit Reached: notify a channel or open a ticket.

**Reminder until reply:** Send Message asking for information, then Wait for Message (requester, 2 days). If / Else on Is Success: True continues; False sends a reminder, then Goto back to the Wait for Message with a budget of 2, and On Limit Reached closes the ticket.

**Escalate when quiet:** Wait for Inactivity (assignee, 4h), then reassign and notify the manager.

**Act relative to a date:** Wait Until the date from a form field with a negative Date Offset to act before it, such as reminding a manager 5 days before a start date.

## Anti-patterns

* Using Wait for Inactivity as a timeout. It only continues after a quiet period and waits as long as replies keep coming. Use Wait for Message with a duration when you need a deadline.
* Expecting Wait for Message to branch on its own. Add an If / Else on its Is Success result.
* Placing must-run steps after a Loop whose list can be empty.
* Using Goto to skip ahead. It only jumps upstream; use conditions to skip steps instead.


## Related topics

- [Limits](https://docs.ravenna.ai/documentation/automate/workflows/limits.md)
- [Workflows](https://docs.ravenna.ai/documentation/automate/workflows/overview.md)
- [Actions](https://docs.ravenna.ai/documentation/automate/workflows/actions.md)
- [Workflow builder](https://docs.ravenna.ai/documentation/automate/workflows/workflow-builder.md)
- [Choose triggers and actions](https://docs.ravenna.ai/documentation/automate/workflows/triggers-actions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.