LoopFor each
- Step kind
- ForEach
- Items
- Trigger.Invoices
- Each
- Invoice
- Operation
- PurchaseOrders
Inputs
- ItemsexpressionRequired
- The list to run over, read from the run’s values, such as { Field: Trigger.Invoices }. A value that is not a list fails the attempt.
- Eachstring
- The name each item is read under inside Input or the body. Required with Steps, and with an Input that reads the item.
- Operationstring
- A declared tool or workflow run once per item. Give Operation or Steps, not both.
- Inputmapping
- What each item’s operation is called with. Where absent, the item itself is the whole input.
- Stepsstep[]
- A body run once per item, starting from the item.
- Outputoutput contract
- What each item’s value is narrowed to.
- AttemptsintegerDefault
1 - How many attempts the step may take. A retry runs only the items that failed.
- OnExhaustedpolicy
- What happens when the attempts run out.
Outputs
- <index>any
- Each item’s value under its position in the list: the operation’s result, or the last value its body produced. An empty list completes at once with an empty result.
One operation per item
- ForEach: Orders
Items: { Field: Trigger.Invoices }
Each: Invoice
Operation: PurchaseOrders
Input:
number: { Field: Invoice.PurchaseOrder }A body of steps per item
- ForEach: Review
Items: { Field: Trigger.Documents }
Each: Doc
Steps:
- ExecuteTool: Read
Operations: [FetchDocument]
Input:
path: { Field: Doc.Path }
- DeliverResults: HandOver
- ModelCall: Judge
Instructions: Judge the document against the review checklist.
Output:
Structured:
type: object
properties:
Verdict: { type: string }Every item must succeedOne failed item does not stop the others; they all run to an end. The step completes only when every item has succeeded, and a retry reruns only the failed items. Inside a body,
Exit ends that item’s pass and the other items carry on.