docs/guides/agent/agent_component_reference/iteration.mdx
A component that splits text input into text segments and iterates a predefined workflow for each one.
An Interaction component can divide text input into text segments and apply its built-in component workflow to each segment.
An Iteration component is essential when a workflow loop is required and the loop count is not fixed but depends on number of segments created from the output of specific agent components.
Each Iteration component includes an internal IterationItem component. The IterationItem component serves as both the starting point and input node of the workflow within the Iteration component. It manages the loop of the workflow for all text segments created from the input.
:::tip NOTE The IterationItem component is visible only to the components encapsulated by the current Iteration components. :::
You are allowed to pull other components into the Iteration component to build an internal workflow, and these "added internal components" are no longer visible to components outside of the current Iteration component.
:::danger IMPORTANT To reference the created text segments from an added internal component, simply add a Reference variable that equals IterationItem within the Input section of that internal component. There is no need to reference the corresponding external component, as the IterationItem component manages the loop of the workflow for all created text segments. :::
:::tip NOTE An added internal component can reference an external component when necessary. :::
The Iteration component uses input variables to specify its data inputs, namely the texts to be segmented. You are allowed to specify multiple input sources for the Iteration component. Click + Add variable in the Input section to include the desired input variables. There are two types of input variables: Reference and Text.
The delimiter to use to split the text input into segments: