> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic RAG and Business Rules Guide

This guide covers intelligent query processing with Agentic RAG and customizing responses through Business Rules in Search AI.

## Agentic RAG

Agentic RAG enhances retrieval accuracy through LLM-powered agents that process queries intelligently before retrieval.

### What is Agentic RAG?

Agentic RAG is an advanced form of RAG that uses autonomous agents to improve query understanding and retrieval accuracy. It dynamically adapts retrieval strategies based on query intent.

### Why Agentic RAG?

Standard RAG is optimized for unstructured data and uses a static retrieval configuration. This leads to suboptimal results for structured data queries, for example, a specific JIRA ticket query may return irrelevant results. Agentic RAG adds an intelligent layer using LLMs that analyzes query intent and dynamically determines the best retrieval parameters and filters, moving away from a one-size-fits-all approach.

### RAG Agents

#### Query Rephrase Agent

Enhances and clarifies user queries using conversation context and user intent, producing more precise and actionable queries.

Example:

* User query: "What about India?"
* Previous conversation: "What is the leave policy for America?"
* Rephrased query: "What is the leave policy for India?"

<Note>This agent is currently available only for the Advanced Search API. See the API documentation for usage details.</Note>

#### Result Type Classification Agent

Interprets the query to determine whether the user wants a direct answer or a list of search results, ensuring the appropriate response type is returned.

Examples:

* "Give me a list of tickets assigned to John." → Output: search
* "Give me details on the custom embeddings story." → Output: answers

<Note>This agent applies only when search results are enabled. Search results are currently accessible via API only — enable this agent only when using search results through the API.</Note>

#### Query Transformation Agent

Identifies key terms in a query, removes noise, and boosts documents containing those terms in their title or content — aligning results more closely with user intent.

Example:

* Query: "What is the work-from-home policy for the X company?"
* Extracted key terms: "Work from Home Policy", "X Company"
* Refined query: "X Company work-from-home policy details."

Result: Documents containing these terms in title or content are ranked higher.

#### Metadata Extractor Agent

Extracts relevant sources and fields from a query, maps them to structured data, and applies filters or boosts for accurate retrieval.

Example:

* Query: "Find Jira tickets assigned to John with status 'In Progress' and priority 'High'."
* Source identified: Jira
* Extracted fields: Assignee, Status, Priority
* Action: Filter applied (no boost needed)

### Supported Models

Currently, only **OpenAI 4.0** and **Azure OpenAI 4.0** models are supported for Agentic RAG.

### Enabling Agentic RAG

**Prerequisites**

* Configure LLM.

1. Navigate to **Responses** > **Agentic RAG**
2. Enable Agentic RAG (enables all agents by default)
3. All agents use the configured model

### Customizing Agents

To change model/prompt settings or enable/disable specific agents:

1. Go to **Generative AI Tools > GenAI Features**
2. Configure individual agent settings.

<Note>By default, enabling Agentic RAG activates all four agents, each using the selected model.</Note>

To change the model or prompt per agent, or to enable/disable individual agents, go to **Generative AI Tools** > **Gen AI Features**.

***

### Supported Models

| Model                                                    | Metadata Extractor | Query Rephrase | Query Transformation | Result Type Classification |
| -------------------------------------------------------- | ------------------ | -------------- | -------------------- | -------------------------- |
| Azure OpenAI — GPT-4, GPT-4 Turbo                        | ❌                  | ❌              | ❌                    | ❌                          |
| Azure OpenAI — GPT-4o, GPT-4o mini                       | ✅                  | ✅              | ✅                    | ✅                          |
| OpenAI — GPT-3.5 Turbo, GPT-4, GPT-4 Turbo               | ❌                  | ❌              | ❌                    | ❌                          |
| OpenAI — GPT-4o, GPT-4o mini                             | ✅                  | ✅              | ✅                    | ✅                          |
| Custom LLM (if underlying model is GPT-4o / GPT-4o mini) | ✅                  | ✅              | ✅                    | ✅                          |
| Kore.ai XO GPT                                           | ❌                  | ❌              | ❌                    | ❌                          |
| Amazon Bedrock                                           | ❌                  | ❌              | ❌                    | ❌                          |

***

### Testing Agentic RAG

Use the **Test** option on the Agentic RAG page to validate agent behavior. Enter a query and review the response.

When Agentic RAG is enabled, a **Retrieval** tab is added to the debug logs, showing:

* The sequence of agents invoked
* LLM input and output per agent
* Time taken by each LLM call

***

### Considerations

* **Response Time:** Multiple LLM calls per query may increase overall response latency. Factor this into performance expectations.
* **Cost:** Larger prompt sizes from metadata enrichment increase token usage and costs. Budget accordingly.
* **Control:** The LLM dynamically decides between boosting and filtering. Additional fine-tuning may be needed for specific use cases.
* **Source Accuracy:** Inaccurate source identification can lead to irrelevant results. Maintaining high source data quality improves retrieval relevance.

## Business Rules

Business Rules customize and personalize answers based on organizational requirements and policies by applying context-aware logic on retrieved content.

Business Rules are policies applied during answer generation that refine results before they are returned to the user. They operate on retrieved content (chunks) and modify how those results are used to generate answers.

### Purpose

Business rules define how results are promoted, positioned, or filtered. Use cases include:

* Personalized recommendations
* Promotional offers
* Content filtering
* Access control
* Language-based prioritization

### How Business Rules Work

1. User query received
2. Relevant chunks retrieved from Answer Index
3. Business rules evaluate conditions
4. Chunks filtered/modified based on rule outcomes
5. Filtered chunks used for answer generation

### Rule Types

**Contextual Rules** - Use context information (user profile, geography, search history) to specify conditions and actions.

### Defining Business Rules

Each rule consists of:

| Component  | Description                                                 |
| ---------- | ----------------------------------------------------------- |
| Name       | Unique identifier for the rule                              |
| Conditions | Criteria that trigger the rule (based on context variables) |
| Outcomes   | Actions performed when conditions are met                   |

### Condition Configuration

**Select Context** - Specify the context variable for the condition. Dynamic suggestions show available variables.

**Custom Data** - Use `customData` field from Search APIs for business rules. Example: `customData.userContext.location`

### Outcome Actions

| Action | Description                             | Factor Range            |
| ------ | --------------------------------------- | ----------------------- |
| Boost  | Prioritize chunks by boost factor       | 1-5 (5 = maximum boost) |
| Lower  | De-prioritize results by lower factor   | 1-5                     |
| Hide   | Remove from search results              | -                       |
| Filter | Filter results as per response criteria | -                       |

### Response Configuration

Define which chunks the action applies to using chunk fields and values.

**Example:** To target chunks where title contains 'Confidential':

* Field: `chunkTitle`
* Operator: `contains`
* Value: `Confidential`

Available chunk fields can be viewed in the Content Browser.

### Example Business Rule

**Scenario:** Restrict confidential information to managers in a specific department.

| Component | Configuration                                     |
| --------- | ------------------------------------------------- |
| Condition | `userContext.dept` does not equal `[target_dept]` |
| Action    | Hide                                              |
| Response  | Chunks where `chunkTitle` contains `Confidential` |

### Important Notes

* Multiple conditions use logical **AND** (all must be satisfied)
* Multiple outcomes use logical **AND** (all are applied)
* Values are **case-sensitive** and use **entire word matching**
* Example: "Confidential" ≠ "confidential" ≠ "confidentially"

### Managing Business Rules

| Action              | Steps                                               |
| ------------------- | --------------------------------------------------- |
| Add Rule            | Click **+Contextual Rule** button                   |
| Activate/Deactivate | Use slider button in rules list                     |
| Edit Rule           | Select rule from list, make changes, click **Save** |
| Delete Rule         | Open rule details, click **Delete** button          |

## Quick Reference

### Agentic RAG Agents

| Agent                      | Function                                         |
| -------------------------- | ------------------------------------------------ |
| Query Rephrase Agent       | Rephrase user query based on context             |
| Result Type Classification | Answer vs. Search Results classification         |
| Query Transformation       | Key term extraction, noise removal               |
| Metadata Extractor         | Extract relevant sources and fields from a query |

### Business Rule Actions

| Action      | Effect                      |
| ----------- | --------------------------- |
| Boost (1-5) | Increase chunk priority     |
| Lower (1-5) | Decrease chunk priority     |
| Hide        | Remove from results         |
| Filter      | Apply field-based filtering |

***
