while
Esta página aún no está disponible en tu idioma.
The while block repeats a set of steps as long as a condition evaluates to true. The condition is checked before each iteration, so the body may never execute if the condition is false initially.
Syntax
while steps.check.has_more_pages launch fetch_page from: "@mashin/actions/http/get" with task url: steps.check.next_url
compute check { has_more_pages: steps.fetch_page.next_url != null, next_url: steps.fetch_page.next_url, items: steps.check.items.concat(steps.fetch_page.items) }How it works
- The condition expression is evaluated
- If the condition is false, the loop exits immediately (body does not execute)
- If the condition is true, the body steps execute
- After the body completes, the condition is evaluated again
- The loop continues until the condition becomes false
- The last iteration’s result becomes the block output
Governance
Each iteration of the while loop is individually governed. Every step inside the body goes through the governance pipeline on every pass. This means:
- An
askstep inside the loop checks permissions and records costs on each iteration - Token budgets are checked before each LLM call, not once for the entire loop
- If a permission check fails mid-iteration, the loop halts (unless wrapped in
on failure) - Cost tracking reflects the total cost across all iterations
The while block itself is a control-flow construct and does not require its own permissions.
Step type
while blocks have step type :control in the execution trace. Steps inside the body retain their own types (:reason, :call, etc.).