Condition Node¶
Condition Nodes allow you to create branches in a workflow, directing actions based on whether certain conditions are met. This helps control the flow’s execution.
The node can handle three types of conditions:
- If: Directs the flow to a specific path if certain criteria (Node, Context, or Value) are met.
- Else: Sets the node connection when no condition is met, allowing you to configure the next node to connect to.
- Else If: Allows you to configure another set of criteria (Node, Context, or Value) to be met when the initial If condition is not satisfied.
Note
Due to security reasons, a condition can be called a maximum of 10 times in an agent flow. Exceeding this limit will result in an error.
Add and Configure a Condition Node¶
Setting up a Condition node in an Agent Flow involves adding the node at the appropriate location in the flow and configuring various node properties, as explained below.
Steps to add and configure the node:
-
On the Agents tab, click the name of the agent to which you want to add the node. The Agent Flow page is displayed.
-
Click the Go to flow button for the in-development version of the flow for editing.
-
In the flow builder, click the “+” icon on any existing node on the canvas and select Condition from the pop-up menu. (Alternatively, you can drag the Condition node from the Assets panel onto the canvas.)
-
Click the added node to open its properties dialog box. The General Settings for the node are displayed.
-
Enter or select the following information:
- Custom Name: Enter an appropriate name for the node.
-
If/Else Condition: Define the IF ELSE/ELSE IF conditions using context variables and the AND/OR operator. You can use Node, Context, or Value.
-
In the IF section, select the context variable you want to use - enter "{{context." and select the node/variable from the list and then close the braces with "}}".
For example:
-
Select an appropriate Operator from the drop-down list. For example, Contains.
-
Enter the value for the condition. If you want to use a context variable, start entering "{{context." and then select the node/variable, and then close the braces with "}}".
For example:
-
Additionally, you can use an AND/OR logical operator to add more criteria to the condition.
-
In the Then Go To drop-down list, select the node to connect to if the condition is met.
-
In the ELSE section, select the node you want to trigger if the IF condition fails.
-
-
Finally, test the flow and fix any issues found: Click the Run Flow button at the top-right corner of the flow builder.
Standard Error
If a condition is true or false but has no connected node, the following error message is displayed: "Path not defined. Please check the flow."