How to set precise rules for AI Agent

«Company Rules» is a key entity that encompasses your entire organization. It allows you to set up individual instructions that you want the AI Agent to follow for your company. All rules are formulated in simple English.

Company Rules for AI Agent

In every company, there are unique rules, definitions, and metrics specific to it. To adapt AI Agent to such characteristics, a feature called «Company Rules» has been developed.

«Company Rules» is a key entity that encompasses your entire organization. It allows you to set up individual instructions that you want the AI Agent to follow for your company. All rules are formulated in simple English.

These rules can vary widely, ranging from choosing a specific table for a particular type of query to setting specific KPIs or Budget Pacing.

Rules for Tables

At Improvado, we have several key tables that provide valuable information about the effectiveness of our marketing campaigns. There are both intermediate models and a main model that contains all the current and complete data.

Our analytics department specialists know exactly which table to use in each specific case. However, this often remains unclear to marketers. Previously, when working with AI Agent, marketing specialists had to choose a table based on the system's suggestions and then confirm their choice with the analysts.

Now this process is significantly simplified. Analysts can enter the appropriate settings in «Company Rules», and the AI Agent will automatically select the necessary table based on these rules.

Company Rule Example:

To answer marketing questions (about spending, campaign performance, and similar) — ause table “biz_paid_ads_attribution_all_models

Rules for Columns

A similar principle is applied when choosing columns in our databases.

For example, we have established a rule according to which leads obtained from Facebook are classified as «leads» + «lead_grouped».

To ensure the correct choice of columns and the formation of accurate SQL queries, we use the «Company Rules» feature.

Within these rules, we specify that certain columns should be summed up for tables related to Facebook. This allows the AI Agent to accurately adhere to our internal standards when selecting data and compiling queries.

Company Rule Example:

To answer on question about spend for Facebook — you MUST use “ads_creative_3059_facebook_all_data” table.

For the Facebook table: When you calculate leads you should sum columns: leads + leads_grouped and name this column “total_leads”.

Rules for Filters

As mentioned, «Company Rules» are applied at all stages of operation, including the filter configuration stage.

Let's consider an example: our table contains many attribution models, each capable of providing detailed answers to various questions. Additionally, there is a basic model capable of answering 95% of the questions asked by marketers and managers. It is important to always use this column to avoid duplication and incorrect data.

We can set in «Company Rules» that the AI Agent should by default consider this column. This significantly simplifies the work for users who do not have technical knowledge or are not familiar with the data, while ensuring the accuracy of the information.

Below is an example demonstrating the effectiveness of this approach.

Company Rule Example:

When you chose table: “biz_paid_ads_attribution_all_models” AND if user didn’t specify attribution model — you MUST put filter by default attribution_model ILIKE “Last Touch”

Definitions Description

In our tables, there are columns denoting different goals. They are named goal_1, goal_2, and so on, where each goal can represent something different: from leads to customers who have signed up for a product demo. For marketers, similar to the situation with choosing tables, it is often unclear which goal to choose when turning to the AI Agent.

With «Company Rules», we can clearly describe what each of these goals represents.

This same methodology is used by managers and marketers in our company. They may not know the data structure or the exact names of the goals, but thanks to the analysts who have filled the «Company Rules» with corresponding definitions, all employees can be confident in the correctness and relevance of the data used.

Company Rule Example:

## MQL Rules:

- To calculate MQL (Marketing Qualified Lead) you MUST use table: “biz_paid_ads_attribution_all_models”.

- To calculate MQL use goal = 5.

Advanced Rules

Setting Rules on Budget

With «Company Rules», you can configure dynamic conditions for managing KPIs, planning, and tracking budgets. Simply describe your specific requirements in the rules.

For example, setting a spending limit for Account A at $1000 per month or other similar conditions.

Company Rule Example:

We have budget per source (Google / Bing / LinkedIn / Terminus): $5000 per month. When I asked about budget analytics you MUST to add 1 columns with values: "Did not overcome" and "Overcome".

In the example above, we set a spending limit of $5000 per month for each source and added a rule defining the best way to display this data.

When I asked about budget analytics you MUST add 1 column with values: "Did not overcome" and "Overcome”

And AI Agent showed us all the months when expenses were higher or lower than the set limit.

Setting Rules on KPIs

Besides budget, you can also set various KPIs. In the example below, I requested to show all months when our KPIs for conversions from Google were not met.

First, I defined what we consider as KPI:

We have KPI — $50 per conversion (cost per 1 conversion) for Google source.

Then I specified how it should be displayed:

To display it you have to create a column "KPI status" with values: "Meet", "Not Meet".

Company Rule Example:

We have KPI - $50 per conversion (cost per 1 conversion) for Google source. To display it you have to create a column "KPI status" with values: "Meet", "Not Meet.

Such rules can be set separately for different sources, campaigns, accounts, and so on.

Setting Rules on Naming Convention

One of the most common cases that our clients and we use internally is parsing the names of our marketing campaigns using «Company Rules».

Watch a short video on how we used the Interpret Results and Company Rules features to parse campaign names from various sources and form a unified table.

Company Rule Example:

Based on the campaign names provided in the data, it appears that the naming convention follows a certain structure. Here are the rules and examples:

1. Platform Identifier: The campaign name starts with the platform identifier. This could be 'bing' or 's' (possibly standing for another platform). For example, 'bing-s-competitors-states' and 's-brand-usa'.

2. Campaign Type: The next part of the campaign name seems to indicate the type of campaign. This could be 'competitors', 'brand', 'keywords' etc. For example, "bing-s-competitors-states' and 's-brand-usa'.

3. Geographical Target: The last part of the campaign name seems to indicate the geographical target of the campaign. This could be 'usa', 'canada, 'uk' etc. For example, 'bing-s-competitors-states' and 's-brand-usa'.

4. Additional Information: In some cases, there might be additional information appended at the end of the campaign name. For example, 's-brand-usa-tae' where 'tae' could be an acronym for a specific strategy or target within the 's-brand-usa' campaign.

So, the common structure for the naming convention can be summarized as:

[Platform Identifier]-[Campaign Type]-[Geographical Target]-[Additional Information (if any)]

We first asked to show several campaigns from Bing and Google, and then asked AI to create rules based on the table using our Interpret Result tool. After adding these rules to «Company Rules», AI successfully completed the task.

In just 3 minutes, your naming convention for various sources will be ready.

Basic Guidelines for Properly Formulating Company Rules

Clear and Complete Instructions

Write clearly and concisely. AI is smart enough to figure out what you mean, but the clearer the rule, the better it will perform. The less ambiguity, the better. A simple test to see how well you've written the instruction is to ask if your colleague understands it. If yes, then AI will too.

Bad example:
Our KPI for conversion is $50 per conversion.
Good example:
We have a KPI for Google Ads: $50 per conversion (cost per 1 conversion). We calculate conversion using a column called “conversions”.
If a user asks to display it, you should create a separate column "KPI_status" with values: "Meet", "Not Meet".

Formatting Rules

Try to separate different parts of the logic in the text using any dividers. The main thing is that it should be clear what relates to what.

This is important because AI selects relevant rules based on the user's question. If the rules are structured, it will be easier for it to choose the relevant one.

Bad example:

Use table “google_ads” to answer questions about google ads, google’s campaigns performance. Calculate Facebook leads using the sum of leads and leads_grouped. For Snapchat, treat swipes as clicks.

Good example:

Google Rules:

Use table “google_ads” to answer questions about Google Ads, Google’s campaigns performance.

Facebook Rules:

Calculate Facebook’s leads using the sum of leads and leads_grouped.

Snapchat Rules:

Treat swipes as clicks for Snapchat Ads

Few-Shot Prompting

This technique significantly improves the quality of the response. To have the AI Agent follow even the most complex instructions, just give it an example of what you expect as the final result. Show what you input and what you expect as output, literally 2-3 examples, and there’s a high likelihood that your rule will always work.

Bad example:

When I ask you to break our naming convention, you have to come up with how to do that on your own and split our ad campaigns into separate columns.

Good example:

We have our Facebook campaigns naming. Couple examples below:




When I ask you to split our campaign names by our naming convention rules, then you have to split campaign names into 3 columns: “source”, “year”, “goal”, “ad_type”.

For example, for the first campaign, it will be:

fb as a source, 2023 as a year, leads as a goal, banner as an ad type.

It's always better to show what the ideal result looks like to reduce the level of ambiguity.


«Company Rules» allow solving many tasks, simplifying and speeding up everyday processes.

The task of analysts is to describe your data in 'Company Rules' so that managers, marketers, and other non-technical users of the company can quickly get answers to any data questions using our AI Agent.

The main thing is not to leave «Company Rules» empty. The sooner you start, the more effectively the AI Agent will work.

Frequently asked questions

No items found.
No items found.
No items found.
☶ On this page


Improvado team is always happy to help with any other questions you might have! Send us an email.

Contact your Customer Success Manager or raise a request in Improvado Service Desk.