Condition Node¶
Condition nodes let you 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: It directs the flow to a specific path if criteria (Node, Context, or Value) are met.
- Else: It sets the node connection when no condition is met, allowing you to configure the next node to connect to.
- Else If: It 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.
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 Go to flow to edit the in-development version of the flow.
-
In the flow builder, click the “+” icon on any existing node on the canvas and select Condition from the pop-up menu. (Alternatively, 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 "}}".
Example:
{{context.ambiguous_sub_categories}}
-
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 or variable, and then close the braces with "}}".
Example:
{{context.steps.Sub_Category_Detection.output}}
-
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 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 and follow the onscreen instructions.
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."