Strategy ONE

Best Practices: Working with Agents

Use these best practices to improve your queries, custom instructions, denied answers, and column descriptions.

  • Write queries in clear, simple language.

    • Keep sentences short and declarative.

    • Avoid vague verbs like “explore” or “discuss”.

    • Avoid filler like “it is important to note that” which wastes tokens and blurs intent. Instead, say exactly what you want, such as “list 5…” and “compare X vs Y”.

  • Refer as directly as possible to the data and the agent’s SQL as possible. Refer to column names, elements, and SQL with precision. Specifically, refer to attribute column names in the following format using a double underscore between the column name and column form name:

    • “Fresh Foods Department” refers to **Department__DESC** = ‘FRUIT’, ‘VEGETABLES’, ‘FRESH FOOD’

  • Give the model a role in the first line (for example, “You are a Senior Sales Advisor…”) to anchor tone, depth, and decision making.

  • Separate sections with markdown headings like ##Role##, ##Task##, ##Constraints##, and ##Output## so the AI can mirror your structure.

  • Keep each instruction atomic: one behavior per bullet without “and/or” chains inside a single sentence. The longer or more verbose an instruction, the more room is left for interpretation and inconsistency.

  • Use numbered lists for sequence tasks to encourage step‑by‑step reasoning. For example:

    1. Select column A

    2. Sum metric B

    3. Filter by ‘xyz’

  • Ask explicitly for reasoning when useful, such as “Think step by step…” or “Ensure that you check for phrases which refer to filtering on the user’s identity, then…”.

  • Put the most important constraints near the top. Define filters, on-the-fly calculations, and then formatting.

  • Use bold (by adding double asterisks before and after wording) and upper-case words to highlight key constraints, important wording, and column names. For example:

    • **YOU MUST ALWAYS** filter results using ILIKE with wildcards at that start, end, and between the first and last names using the provided person's name in both **Manager__DESC** and **Employee__DESC** columns

  • Use double quotes to refer to text or phrases in a user question. Use double quotes for key words like "day", "day of week", or "weekday". An example is **ALWAYS** refer **Day of Week__DESC**. Use single quotes to refer to attribute elements, as in “North West” refers to **City__DESC** = ‘Manchester’ AND ‘Liverpool’.

  • When you are referring to SQL, wrap it in fenced code blocks (```).

  • Use consistent phrasing patterns to create a predictable instruction style. For example, always start bullets with “Use”, “Avoid”, “Return”.

  • Avoid contradictory instructions such as “be concise but very detailed”. Pick one and state it plainly.

  • AI works well with examples so provide clear examples that demonstrate ideal responses.

  • Write negative instructions explicitly, such as “DO NOT…” or “YOU MUST NEVER…".

  • In long instructions, use horizontal rules (---) to separate meta instructions from task‑specific context, for example, - Step 1, --Step 1.1, and so on.

  • Use custom instructions for the most pivotal, complex (SQL or multi-column instructions), and interpretation-specific (picking the column) instructions. In contrast, use column descriptions for aliases, business logic, filtering logic, and anything else after the agent picks the column. For examples on how to write instructions, see Custom Instructions Example and Column Description Instructions Example.

  • In custom instructions, target the SQL-writing underlying agent within Strategy's Agentic architecture by prefacing an instruction with ##SQLER##. Use these instructions to directly influence any SQL functions and query formatting.

    • Remember to wrap SQL in fenced code blocks (```) when writing SQL in your instruction. For an example on how to write ##SQLER## instructions, see Custom Instructions Example.

  • Use rejected questions to deny answers based on the user’s question, intent, or any trigger words or phrases. For examples on how to write denied answers instructions, see Denied Answers Instructions Example.

  • Use AI to assess and score your instructions on grammar, conciseness, and specificity. Sometimes, the smallest changes in grammar or adapting your instructions to true markdown writing style can help improve the performance of instructions.

  • Iteration is key when writing instructions. Assess the agent's consistency in understanding questions, note failure points, and improve the specificity and importance of instructions rather than rewriting everything each time.

Custom Instructions Example

When a user question refers to a comparison against the budget, **YOU MUST ALWAYS** pick **Sales** and **Sales Forecast**.

When applying a user identity filter, **YOU MUST ALWAYS** filter on both the **Manager__DESC** and **Employee__DESC** columns using an OR operator.

##SQLER##

**YOU MUST ALWAYS** use the following SQL template when a user question contains "perform", "performer", "performers", "KPIs" or "performance" (E.g., "What was my performance...", "Who are the top performers..." or "How is their performance..."):

```

SELECT "Manager__DESC", "Employee__DESC", “Date__DESC”,

SUM("Productivity") AS Productivity,

SUM("Sales") AS Sales,

SUM("Discount") AS Discount,

SUM("Worked Hours") AS Hours,

FROM "Sales ADC"

GROUP BY "Manager__DESC", "Employee__DESC", “Date__DESC”

```

Denied Answers Instructions Example

When a user question asks about "salary" or any phrases referring to employees’ pay, **YOU MUST ALWAYS** deny the answer and provide the following explanation: "Apologies, I cannot answer this question as this breaches our HR policies due to your request being classified as personal data. If you believe that there is a valid reason for you to see this information, please check our HR Dashboard (https://company.library.com/MicroStrategyLibrary/app/xyz123/xyz123) or contact John Smith (john.smith@company123.com) with your feedback."

Column Description Instructions Example

“Fresh Foods Department” refers to **Department__DESC** = ‘FRUIT’, ‘VEGETABLES’, ‘FRESH FOOD’.

Use the following SQL template to filter for the latest reporting period:

```

WITH recentperiod AS

(SELECT "Reporting Period__ID"

FROM "Engineer Day ADC"

ORDER BY "Reporting Period__ID" DESC

LIMIT 1),

```

When filtering on a **Subdepartment__DESC**, for example, ‘SUMMER HATS’ or ‘FRESH JUICE’, **YOU MUST ALWAYS** use ILIKE with wildcards at the start, end, and in-between the words of the element. For example, if a user question asks “show sales for summer hats”, the WHERE clause in the SQL should be:

```

WHERE "Subdepartment__DESC" ILIKE '%Summer%Hats%'

```