Agentic Workflow Loops
The Loop step repeats a sequence of steps for every item in an array of Records, strings, or UUIDs, with nesting limits and Debug behavior.
Overview
A Loop step repeats a sequence of steps once for every item in an array variable, instead of requiring a separate branch or workflow for each Record. Use a Loop step when an Agentic Workflow needs to inspect, evaluate, or act on every Record in a set, for example, checking a set of active contracts for inconsistent data such as a termination date on a contract that's still marked active, or iterating through active policies to build a second array of Records to calculate commission values.
Loops build on Agentic Workflow variables and on the way parallel paths inside a loop converge before continuing. Loops reuse the same branch-merging mechanism introduced for Agentic Workflow conditions.
Terminology
Array: The collection of values a Loop step iterates over. The values can be Records, strings, or UUIDs. An array can be empty, but never null.
Item: An entry within an array. An item can be an Object Record, a string, or a UUID.
Add Items to Array: The action of adding entries to an array variable.
Adding a Loop Step
Select Loop from the step-type selector, either the top selector on the canvas or the "+" dropdown between steps, where it's listed after Condition.

Adding a Loop step opens the Add Loop modal, with three sections:
Loop Type: The only option at the moment is For Each Item, which is pre-selected.
Description: The same optional description field every step type has.
Loop Settings: Where you choose the Array Variable and see the auto-generated Item Reference Variable.
If the workflow has no array variables yet, the Array Variable field shows “No options” and an Add Variable choice. Choose Add Variable to create one without leaving the modal. The new variable then appears in the field.
The Array Variable list only includes variables whose Cardinality is set to Array of Values, whether their type is Object Record, String, or UUID. For a nested loop, the array variable already used by the outer loop is excluded from that list for the inner loop, since reusing it could corrupt the iteration state of the outer loop. If it's selected, saving the step fails.
Once you choose an array variable, Kizen auto-generates the Item Reference Variable using the pattern <array variable name>_item (for example, _contact_list_item). If that name is already taken, an incrementing suffix is appended, for example _contact_list_item_1.
If you later change the Array Variable, what happens to the Item Reference Variable depends on the target: Selecting a variable of the same kind leaves it unchanged, so steps inside the loop that already reference it continue to work. The same kind means a Record array that points to the same Object, or a string array swapped for a UUID array (or the reverse). Selecting any other variable replaces it with a newly generated one and deletes the old one. That covers a Record array that points to a different Object, and any switch between a Record array and a string or UUID array. Any step inside the loop still referencing the deleted variable will generate an error when you try to save it.
Loop Anatomy
Adding a Loop step places two cards on the canvas. The Loop card is labeled Loop, with a summary that reads "For each item in <array variable name>," for example, "For each item in pets_array." Like other step cards, its description is truncated to two lines, with the full text available in a tooltip on hover.
A card labeled Next/Finish marks the end of the loop, with a summary that reads "Next item or finish loop and continue". It shares the Loop card's color, and unlike other step cards, it has no drag handle and no three-dot menu. Instead, every action on the loop lives on the Loop card.
A dotted line connects the Next/Finish card back up to the Loop card to show which steps belong to the loop. Steps placed after the Next/Finish card connect normally to whatever comes next in the Agentic Workflow.
Managing Loops
Hover over the Loop card to reveal a move handle you can drag to relocate the entire loop. While you're dragging it, every card inside the loop, including Next/Finish, switches to a placeholder style, and you can drop it anywhere but inside itself or into a loop that’s already at the maximum nested depth of three. Once you drop it in its new spot, downstream steps reconnect to the Next/Finish card the same way they would for any other step move.
Copying a loop and pasting it copies only the Loop and Next/Finish cards. None of the steps inside the loop come with it, the same way copying a Condition step copies the Condition but not the steps on its paths. The pasted loop gets its own Item Reference Variable, renamed with an incrementing suffix if the default name is already taken.
Deleting a loop is only possible from the Loop card. The Next/Finish card can't trigger it. Because deleting the Loop card removes every step inside the loop, Kizen asks you to confirm first: "All steps within this loop will be deleted as well." Steps that came after the loop are reconnected to wherever the loop used to start.
Behavioral Caveats and Limitations
Nesting Depth
Loops can be nested up to three levels deep: an outer loop containing an inner loop, which can contain one more inner loop. Once you're at that depth, Kizen removes Add Loop from the "+" menu and blocks pasting a copied loop inside it. Dragging a Loop step, or an existing loop, into a spot that would exceed the limit tags every step inside the loop with the restriction message: "Agentic Workflows only support a loop depth of 3."
No Branching
You can't create a branch inside a loop, and so the Create New Branch action is removed from the "+" menu while you're inside one. For the same reason, steps inside a loop have no Duplicate option in their three-dot menu, since duplicating a step creates a branch. This doesn't affect Condition or Goal steps, which produce paths rather than branches and remain usable inside a loop. Dragging in a set of steps that contains a branch (for example, a Condition step with branches downstream) marks every step inside the loop with the restriction message: "You cannot add branches to a loop".
No 'Go To' Agentic Workflow Step
You can't add a Go To Agentic Workflow Step inside a loop. It's removed from the list of available actions while you're dragging into one. Dragging in a Go To step, or a set of steps that contains one, tags every step inside the loop with the restriction message: "You cannot add Go To Steps to a loop". If the steps you're dragging in include a Condition step that has both a branch and a Go To step, either restriction message might appear. A Go To Agentic Workflow Step outside a loop also can't target a step inside one.
Modifying the Array Mid-Loop
While a loop is running, no other step is allowed to update the array variable it's iterating over. Attempting to do so pauses the updating step on failure with the error: "Array variable <variable name> cannot be updated while looping over its items." Update Variable and Search Records steps follow their normal step error handling when this happens. Code and LLM steps also follow their normal error handling but don't retry.
Archived Records
If a Record in the array is already archived before the loop reaches it, that item is skipped and the Next/Finish step's history is marked failed for that item. If a Record becomes archived while it's actively being processed inside the loop, handling depends on the step involved, for example, a step that tries to update a field on the now-archived Record fails at the point it attempts that interaction and pauses, following that step's normal error handling. If a Record driving an outer loop is archived while an inner loop is running on it, the inner loop finishes early.
Debug and Execution Behavior
Each Item Reference Variable is initialized alongside an Agentic Workflow's other variables, but that initialization step isn't shown on the standard canvas. It becomes visible in the Execution View and Debug View canvases, alongside the Agentic Workflow's other variables, with the card label Variable - Item Reference. In Debug view, it's iterated through the same way as other variable steps, initializing to blank.
Skipping the Loop card in Debug mode skips the entire loop: Every step inside becomes unreachable, and the first step after the Next/Finish card becomes the next pending step. For general Debug mode behavior, see Agentic Workflow Status & Lifecycle.
What's Next
Now that you know how to build and manage a Loop step, learn how the variables it depends on work, and see how it fits into a running Agentic Workflow.
Last updated
Was this helpful?