Strategy ONE

Preview Feature: Enable SQL Template for Agents

Starting in Strategy One (December 2025), you can enable the SQL template to allow for custom instructions for specific calculations or questions. This is an improvement on the current approach of using Customer Instruction and column description, because it is easier to use.

These SQL template rules define how queries are structured and calculated beyond standard column selections. They incorporate custom instructions, calculation logic, and column interpretations to ensure accurate, context-aware results tailored to each use case.

  • Rules can be based on metrics only, but not attributes only.
  • Rules can be based on both an attribute and a metric.

  • Add the configuration under the metric.

  • The rule takes effect when the question is related to the metric the rule is based on.

Preview features are early versions of features and are not to be used in a production environment as the core behavior remain subject to change between preview and GA. By selecting to expose preview features, you can access these features and use them as you would any other dashboard functionality. The official versions of preview features are included in subsequent releases.

Enable the Feature Flags

  1. In Library Server, add the line services.ai.v2.sqlTemplateEnabled=true. This displays the Enable SQL Template toggle on the General panel of agents.

  2. In the chat/AI service, add the line SQLER_TEMPLATE=True.

Enable the SQL Template

  1. Create a new agent or open an existing agent and click the Edit icon in the upper right.
  2. Click the General panel .
  3. Toggle on Enable SQL Template.

    A Rules tab displays.

Create a Rule

  1. After you enable the SQL template, click the Rules panel .

  2. Click Add Rule.
  3. Rename the rule by typing over the default name at the top.
  4. From the Based On drop-down list, select an object or search for one. You can select multiple objects.
  5. If you select a metric, you can configure actions for that metric only. Follow the steps below:
    1. To do so, expand the metric and click the Add icon next to Configurations.

    2. Select an Action from the drop-down list.

    3. If you select Group By, follow the steps in To group the rule.

    4. If you select Filter By, follow the steps in To filter the rule.

    5. Select Break By to restart the metric calculation for each attribute element. In the Object box, select the object to break by or search for it. The object is selected first and then grouped in the SQL query.

    6. If you select Order By, follow the steps in To order the rule.

    7. If you select Forbid With, in the Object box, select the object to forbid or search for it. You can select multiple objects.

    8. If you select Require, in the Object box, select the object to require or search for it. You can select multiple objects.

    9. You can add another configuration by repeating these steps.

    The remaining steps apply filters, ordering, grouping, and advanced settings for all metrics in the rule.

  6. To filter the rule:
    1. Click the Add icon next to Filters.
    2. In the When box, determine when to apply the filter, such as Category is Music. To always filter the rule, type always.
    3. From the drop-down list, select the object to compare or search for it.
    4. By default, the operator is equals exactly (=). To change the operator to similar to, click = and select ~.
    5. In the box, type the expression to compare the object to.

      For example, the following rule includes only the Northeast region in revenue calculations. If the question "What is the revenue by region?" is asked, the agent returns the Northeast revenue value. Using the ~ means that the comparison is not case-sensitive, so Northeast, NorthEast, and northeast are all considered the same.

  7. To order the rule:
    1. Click the Add icon next to Order By.
    2. In the When box, determine when to order the rule, such as Category is Music. To always order the rule, type always.
    3. From the Order By drop-down list, select the object to order by or search for it.
    4. Choose Ascending or Descending (the default) order.

      For example, the following rule sorts Profit values in ascending order for the Music category. If the question "Show me the Profit for all Items in Music Category" is asked, the values are sorted in ascending order. If the question "Show me the Profit for all Items in Books Category" is asked, the values are sorted in descending order, the default.

  8. To group the rule:
    1. Click the Add icon next to Group By.
    2. In the When box, determine when to order the rule, such as Category is Music. To always order the rule, type always.
    3. From the Group By drop-down list, select the object to group by or search for it. The object is selected first in the SELECT clause of the SQL query.

      For example, the following rule groups Profit values by the Category ID. If the question "What is the Profit by Region" is asked, the values are separated by region (from the question) and category (from the rule).

  9. You can configure Advanced Settings for time, preferences, and guards. For example, the following preference displays the category ID rather than the description.

  10. You can create additional rules following the steps above.
  11. Save your changes.