Skip to content

Rules

The Rules page allows you to define, configure, and manage rules that control agent behavior based on variable conditions. Rules are evaluated for selected agents and can set variables, trigger flows, or set final responses depending on the outcome of a condition.

Permissions

Access to the Rules page and its functionalities is typically controlled by user permissions. Users with owner, admin, editor, or rules permissions can manage rules.

Overview

Rules are evaluated for each agent and can have two outcomes:

  • If True Outcome: What happens if the rule's condition is met.
  • If False Outcome: What happens if the rule's condition is not met (optional; blank means no operation).

Each rule can perform one of the following actions:

  • Set a variable: Assign a value to a variable, or copy from another variable.
  • Set a response: Set a response and terminate execution.
  • Execute a flow: Trigger an action flow or predefined sequence (e.g., delivery, API call).
  • Set Authentication: Allows a rule to turn authentication to True or False. Used as final step in a Privacy Action flow to indicate user has been authorized.

Rules List

Helper Buttons

  • Add Variable: Opens a dialog to create a new variable that can be used within your Rules configurations
  • Lookup Names: Opens a dialog to look up the exact names of Prompts, Connectors, and Variables, etc... available for the selected agent.

Adding a New Rule

To create a new rule:

  1. Navigate to the Rules page.
  2. Ensure an account is selected, as rules are associated with an account.
  3. Expand the "New Rule" section.
  4. Fill out the form fields:
  5. Rule Name: A descriptive name for the rule (e.g., "Set Full Name if Provided").
  6. Rule Status: Toggle to enable or disable the rule. Only enabled rules are evaluated.
  7. Agent(s): Select one or more agents this rule applies to.
  8. Rule Condition: Python expression using variables (e.g., var['value'] > 10 and var['status'] == 'active').
  9. Result Variable: Variable used to store the rule's response or result.
  10. True Outcome Type: What should happen if the condition is True? Options: Set a variable, Set a final response, Execute a flow.
  11. Rule True Outcome: Action or value to set if the condition is True. Example for 'Set variable': {"set": {"variable": "full_name", "value": "{var['first_name']} {var['last_name']}"}}.
  12. False Outcome Type: What should happen if the condition is False? Options: Set a variable, Set a final response, Execute a flow.
  13. Rule False Outcome: Action or value to set if the condition is False. Leave blank for no operation.
  14. Click "Create Rule" to save.

Editing Rules

  • Click the edit button next to a rule to update its configuration.
  • The same fields as above are available for editing.

Listing Rules

  • Rules for the selected agent are listed with their name, status, agents, condition, outcomes, and last modified date.
  • Use the edit and delete buttons to manage rules.

Adding Agents to Rules

  • You can add an agent to an existing rule if the agent is not already included.
  • Use the "Include rule" form to select and add rules to the agent.

Rule Condition Syntax

Rule conditions are Python expressions that reference the var dictionary, which holds variable data. Example:

var['value'] > 10 and var['status'] == 'active'

Outcome Examples

Setting a Variable

  • Condition: var["first_name"] != "" and var["last_name"] != ""
  • If True Outcome Type: Set variable
  • Set a variable: { "set": { "variable": "full_name", "value": "{var['first_name']} {var['last_name']}" } }
  • If False Outcome: (No operation)

Setting a Final Response

  • Condition: var["full_name"] != ""
  • If True Outcome Type: Set response
  • Set a response: { "response": "Your full name is {var['full_name']}" }
  • If False Outcome: (No operation)

Executing a Flow

  • Condition: var["email"] != ""
  • If True Outcome Type: Execute a flow
  • Run Action Flow: { "0": { "action": "retrieve customer" } }
  • If False Outcome: (No operation)

Example: Set Authentication Status

  • Condition: var['status_field'] == "authentication success"
  • If True Outcome Type: Set Authentication
  • True Outcome Text: {'value': 'True'} (or set to False)
  • If False Outcome Type: Set response
  • If False Outcome: {"response": "You have not successfully authenticated." }

Tips

  • Leave the False Outcome fields blank for no operation if false.
  • Use variable placeholders in curly braces (e.g., {var['first_name']}) to reference variable values in outcomes.
  • Only enabled rules are evaluated.