---
title: RAG Path Setup
slug: rag-path-setup
docTags: 
createdAt: 2026-03-23T19:58:34.501Z
---

Once the document or custom script status shows <font color="#B91C1C">**Ready to Search**</font>, the next step is to configure a **Path** so the agent can retrieve trained knowledge during conversations.

This path uses a **JSON API node** to call the **RAG Search API** and fetch relevant results based on the user query.

### Step 1 — Create a New Path

Go to the **Builder** section.

Click **+ Add Path** and create a new path.

Example path name: **knowledge\_base path**

![](https://api.archbee.com/api/optimize/FEqjvWZnyymr_PEhXLLlG/aNNidX__TMOE8y7Ye8BVG_image.png)

### Step 2 — Add a JSON API Node

Inside the path, click **Add Node** and select **JSON API**.

This node will be used to call the RAG API and fetch trained knowledge.



![](https://api.archbee.com/api/optimize/FEqjvWZnyymr_PEhXLLlG/3yeLcBn85nyUnzuVVp7xF_image.png)

### Step 3 — Configure the JSON API Request

Set the request method to **POST**.

In the **Request URL** field, enter the RAG API endpoint.

Example:

:::BlockQuote
\<https\://RAG-SEARCH>
:::

Go to the **Body** tab and set **Content Type** as **JSON**.

Use the following request body:

:::BlockQuote
\{
&#x20; "botRef": \{\{bot.id}},
&#x20; "customerId": \{\{bot.customerId}},
&#x20; "limit": 3,
&#x20; "hybrid": false,
&#x20; "where": \{},
&#x20; "queries": \[
&#x20;   "\{\{user\_query}}"
&#x20; ]
}
:::

This request sends the user query to the RAG API and asks for the top matching results.

## Request Body Explanation

| Field      | Description                                      |
| ---------- | ------------------------------------------------ |
| botRef     | Unique identifier of the bot                     |
| customerId | Customer identifier of the bot account           |
| limit      | Maximum number of matching results to return     |
| hybrid     | Controls whether hybrid search is enabled or not |
| where      | Optional filter object for narrowing results     |
| queries    | Contains the user query sent for RAG search      |



![](https://api.archbee.com/api/optimize/FEqjvWZnyymr_PEhXLLlG/vKbjHb-Kmb9Wg4LeVQWzV_image.png)

### Step 4 — Test the API Request

Click **Send Request** to test the API.

The system will prompt you to enter test values for:

- bot.id
- bot.customerId
- user\_query

**Where to Find bot.id and customerId:**

**Bot ID (bot.id)** – Found in the Builder URL (last number in the URL). Example: 145265 **Customer ID (customerId)** – Found in Integrations → Engati API → Customer Identifier. Example: 120178


Enter sample values and submit the request.
Example:

- bot.id → 145265
- bot.customerId → 120178
- user\_query → general medicine

![](https://api.archbee.com/api/optimize/FEqjvWZnyymr_PEhXLLlG/tzCFS4nIbfyAY1rX-Jhma_image.png)

### Step 5 — Verify the API Response

Once the request is successful, the API response will appear in the **Response** section.

The returned data contains the matched documents from the trained RAG knowledge base.

Review the response and identify which part of the response needs to be stored as an attribute.

Example response structure:

:::BlockQuote
\{
&#x20; "response": \{
&#x20;   "documents": \[
&#x20;     "page\_content: Doctor Name: Dr. Priya Sharma Speciality: Neurology Hospital"
&#x20;   ],
&#x20;   "ids": \[
&#x20;     "2c1f08bd-06d5-4073-aa6b-d6a8726387c5"
&#x20;   ],
&#x20;   "metadata": \[
&#x20;     \{
&#x20;       "category": "default",
&#x20;       "created\_at": "Fri, 13 Mar 2026 05:43:02 GMT",
&#x20;       "document\_name": "a4d88c721470711d19ba2ca86f5ceb22",
&#x20;       "source": "69b3a3e25f9acf77e874bdc9",
&#x20;       "type": "CUSTOM\_SCRIPT"
&#x20;     }
&#x20;   ]
&#x20; },
&#x20; "status": \{
&#x20;   "message": "SUCCESS",
&#x20;   "status\_code": 1000
&#x20; }
}
:::

## Response Explanation

| Field               | Description                                                |
| ------------------- | ---------------------------------------------------------- |
| response.documents  | Retrieved text content from the trained RAG knowledge base |
| response.ids        | Unique IDs of the matched indexed records                  |
| response.metadata   | Additional source information about each matched record    |
| status.message      | API execution result                                       |
| status.status\_code | Status code returned by the API                            |



### Step 6 — Map the Response to an Attribute

In the **Attributes** section, create an attribute to store the required response value.

For example, you can create an attribute such as: **response**

Then map it to the response field returned by the API.

Example mapping: **Response.response**

This stores the selected API response inside an Engati attribute so it can be used later in the path or agent response.

![](https://api.archbee.com/api/optimize/FEqjvWZnyymr_PEhXLLlG/1icqbr4GETRMcW-_n1MEp_image.png)

### Step 7 — Save the Node

After configuring the request, testing the response, and mapping the attribute, click **Save**.

The JSON API node is now ready to fetch trained RAG knowledge during conversation flow execution.

## How This Works

When the path is triggered:

- The user query is sent to the **RAG Search API**
- The API returns the most relevant trained content
- The selected part of the response is stored in an **attribute**
- That attribute can then be used in the next nodes to generate the final agent reply

## 📚 Next Step

Once the RAG API response is stored in an attribute, you can use that attribute in the next node to send the retrieved answer back to the user.

👉 Continue to the next section: [4. Workflow Setup](docId\:uUhjiZq8X_4pijsSvst9Q)
