Search rules let you define which knowledge sources (or parts of knowledge sources) an advanced AI agent should use in different situations when creating AI-generated answers to questions from your users.
You must be a client admin to configure search rules.
This article contains the following topics:
- About search rules
- Creating a search rule
- Adding a search rule to a procedure
- Adding a search rule to a dialogue
- Editing the default search rule
Related articles:
About search rules
In AI agents - Advanced, a default search rule is already configured for you. This default rule is configured so that the AI agent searches all articles from all imported knowledge sources when sending an AI-generated answer (either a generative reply or an answer created with agentic AI) to a user.
However, you can create additional search rules to customize which knowledge sources are searched in specific scenarios. For example, you can create search rules based on URL, locale, labels, and (for AI agents with agentic AI) segments to customize the experience for different user segments.
Without a specific search rule applied, the default search rule is applied, which searches all knowledge sources unless you've configured it differently.
Creating a search rule
Creating a search rule is the first step in determining which knowledge sources your AI agent should use in a specific situation. How you create a search rule is slightly different depending on whether you're:
Creating a search rule for agentic AI
You can create a search rule to be used with agentic AI.
When you create the rule, you can specify which segments should trigger it, or else add it to a procedure or dialogue later. When a conversation’s session data matches the specified segment, or else when the user reaches the specified point within a conversation flow, the AI agent searches only the knowledge sources configured in your rule when forming its AI-generated reply.
To create a search rule
- In AI agents - Advanced, in the top-right corner, use the AI agent drop-down field to select the AI agent you want to create a search rule for.
- In the left sidebar, click Content > Knowledge > Search rules.
- Click Create search rule.
The Create search rule window opens.
- In Name, enter a descriptive name for your search rule.
This name appears only on the Search rules page to help you recognize and maintain your rules.
- In Description, add a description for the rule to help you remember what it’s for and to allow the AI to understand the purpose of the rule.
- In Knowledge sources, select a knowledge source that you’ve previously imported.
- (Optional) If you want this rule to search only a subset of the selected
knowledge source:
- Select Set filter criteria.
- Leave Match all conditions selected, or else select
Match any conditions to determine how the rule’s
conditions should be evaluated.Note: It's important to make sure your conditions make logical sense together. If you select Match all conditions but your conditions conflict, no results will be returned.
- In the first of the three condition fields, select url, locale, or labels.
- In the operator field, select one of the available operators:
Equals, Does not equal, Contains,
Includes any, Includes all, or Includes
noneNote: If you're creating a search rule based on labels, you must use Includes any, Includes all, or Includes none.
- In the third condition field, enter the actual URL, locale, or label (based on the parameter you selected above) that you want the rule to evaluate.
- (Optional) Click Add condition and repeat the previous
three steps to add a new condition to filter the search
rule.
- (Optional) Click Add knowledge source and repeat steps 6–7 to add and configure another knowledge source for this search rule.
- Under Application criteria, select one of the following options
in When to apply:
- Only when referenced in procedures or dialogues: The search rule applies only when it’s been specifically referenced in a procedure or dialogue.
- When ALL segments match or when referenced: The search rule applies when it’s been specifically referenced in a procedure or dialogue, and also when it matches all of the segments you select in the next step.
- When ANY segment matches or when referenced: The search rule applies when it’s been specifically referenced in a procedure or dialogue, and also when it matches any of the segments you select in the next step.
- If you selected When ALL or When ANY above, click Apply to segments and
select which segments should trigger the
search rule.
If a conversation’s session data matches one of the selected segments, the search rule is applied to any AI agent response that uses generative replies or agentic AI.
- Click Save.
- (Optional) Add your search rule to a procedure or dialogue following the steps below.
Creating a search rule for generative replies
You can create a search rule to be used with generative replies.
After you create the rule, you must add it to a Generative replies block within a dialogue. When a user reaches this block within a conversation flow, the AI agent searches only the knowledge sources configured in your rule when forming a generative reply.
To create a search rule
- In AI agents - Advanced, in the top-right corner, use the AI agent drop-down field to select the AI agent you want to create a search rule for.
- In the left sidebar, click Settings > Generative replies > Search rules.
- Click Create rule.
- In Rule name, enter a descriptive name.
This name appears only on the Search rules page to help you recognize and maintain your rules.
- In Description, add a description for the rule to help you remember what it’s for.
- In Search knowledge source, select a knowledge source that you’ve
previously imported.
- Expand the Advanced settings section to add conditions for the
selected knowledge source:
- In Match condition below, select All or Any
to determine how the rule’s conditions should be evaluated.Note: It's important to make sure your conditions make logical sense together. If you select All but your conditions conflict, no results will be returned.
- In Select a parameter, select url, locale, or labels.
- In the Equals field, leave Equals selected or else
select from one of the other available operators: Does not
equal, Contains, Includes any, Includes
all, Includes none
Note: If you're creating a search rule based on labels, you must use Includes any, Includes all, or Includes none.
- In Add value, enter the actual URL, locale, or label (based on the parameter you selected above) that you want the rule to evaluate.
- (Optional) Click the plus icon (+) and repeat steps 7.1–7.4 to
add and configure another condition.
- In Match condition below, select All or Any
to determine how the rule’s conditions should be evaluated.
- (Optional) Click the plus icon (+) below the conditions for your first knowledge source and repeat steps 6–7 to add and configure another knowledge source for this search rule.
- Click Save.
- Add your search rule to a dialogue following the steps below.
Adding a search rule to a procedure
You can add your search rule to a procedure to determine which knowledge sources your AI agent should use when providing an answer based on agentic AI.
To add a search rule to a procedure
- Open the procedure you want to add a search rule to.
- Click the plus icon (+) and select Share knowledge answer with search
rule.
- Select the search rule you want to apply.
- Click Update draft.
Adding a search rule to a dialogue
You can add a search rule to a dialogue to determine which knowledge sources your AI agent should use when providing a generative reply.
Search rules must be added to a Generative replies block within a dialogue.
To add a search rule to a dialogue
- Open the dialogue builder for the dialogue you want to add a search rule to.
- Select the Generative replies block where you want the search rule to apply.
- Toggle Use default search rule off.
- In Select rule, select the search rule you created.
- Click Publish.
Editing the default search rule
A default search rule exists for your AI agent already. This rule is configured to use all imported knowledge sources.
You can’t delete the default rule, but you can edit it if you want to configure a different default behavior. For example, you can edit it to use one specific knowledge source as the default.
Because the default search rule controls the AI agent’s default search behavior, it doesn’t have to match any segments or be added to a procedure or dialogue.
To edit the default search rule
- In AI agents - Advanced, in the top-right corner, use the AI agent drop-down field to select the AI agent you want to create a search rule for.
- In the left sidebar, click either of the following:
- Settings > Generative replies > Search rules for an AI agent with generative replies.
- Content > Knowledge > Search rules for an AI agent with agentic AI.
- To the right of the Default (Default) search rule, click the options menu
(
) and select View.
- In the Edit rule pane, configure the default search rule as desired.
For help, see Creating a search rule.