Loop Node
The Loop node is a component in the Sequential Agents category, designed to create loops within agent workflows. It allows the flow to return to a specific previous node, enabling repetitive or conditional execution of parts of the sequence.
Node Details
-
Name: seqLoop
-
Label: Loop
-
Version: 2.0
-
Type: Loop
-
Category: Sequential Agents
-
Base Class: Loop
Parameters
The Loop node accepts the following input parameters:
-
Agent | Condition | LLM | Tool Node
-
Name: sequentialNode
-
Type: Agent | Condition | LLMNode | ToolNode
-
Description: The predecessor node(s) in the sequence
-
Required: Yes
-
List: Yes (can accept multiple nodes)
-
-
Loop To
-
Name: loopToName
-
Type: string
-
Description: Name of the agent/LLM to loop back to
-
Required: Yes
-
Placeholder: “Agent”
-
Input/Output
Input
-
The node requires at least one predecessor node (Agent, Condition, LLM, or Tool).
-
The name of the node to loop back to must be specified.
Output
-
The node’s output is hidden (hideOutput: true).
-
It returns an ISeqAgentNode object containing:
-
id: The node’s ID
-
node: The name of the node to loop to (lowercase, underscores instead of spaces)
-
name: Same as ‘node’
-
label: The original label of the node to loop to
-
type: Always set to ‘agent’
-
predecessorAgents: Array of input sequential nodes
-
output: Same as ‘node’
-
Usage
The Loop node is used to create cycles in sequential agent workflows. It’s particularly useful for:
-
Implementing iterative processes where certain steps need to be repeated.
-
Creating conditional loops where the workflow returns to a previous state based on certain conditions.
-
Building complex decision trees or state machines within agent-based systems.
To use the Loop node:
-
Connect it to one or more predecessor nodes in the sequence.
-
Specify the name of the node you want to loop back to in the “Loop To” field.
The node will then create a loop in the workflow, directing the execution back to the specified node when reached.
Error Handling
The node will throw an error if:
-
No predecessor nodes are provided
-
The “Loop To” name is not specified