Agent Script Reference: Conditional Expressions

if and else conditions deterministically specify what actions to take or which prompts to include. To specify complex conditions, use parentheses () to group and and or operators within a condition.

For example, you can check a variable’s value and then run an action based on the result:

If you need to nest and and oroperators, you can use parentheses (). In this example, the grouped condition (@variables.HasSalesInterest == True or @variables.WantsMeeting == True) is evaluated first. The condition evaluates as true if either one of HasSalesInterest or WantsMeeting is true.

You can also check a variable in order to set other variables.

You can use a conditional expression to determine which natural-language prompt to include.

You can use if and else inside reasoning instructions to conditionally include different prompt lines for the LLM.

You can check whether a variable has a value.

Currently, Agent Script supports if and else logic, but it doesn’t support else if logic after an if statement.

Related Topics