---
title: RAG (Custom Data Indexing)
slug: rag-custom-data-indexing
docTags: 
createdAt: 2026-03-23T17:48:35.975Z
---

## Overview

RAG Custom Script Training allows the AI agent to **fetch data dynamically from external sources and index it as knowledge**.

Instead of uploading documents or URLs, a **custom script retrieves data, converts it into structured JSON, and returns it to the system for indexing**.

This approach is useful when data changes frequently or comes from external systems.

## Supported Data Sources

Using custom scripts, data can be fetched from various external sources and indexed for **RAG search**.

Below are sample examples demonstrating how data can be retrieved, converted into **structured JSON**, and indexed as knowledge for the AI agent.These scripts transform external data into a format that the system can process for **retrieval and response generation**.

You can adapt similar scripts to integrate data from your own systems.

## RAG Search Using Custom Scripts

This method allows the AI to **index external data sources** such as:

- Google Sheets
- External APIs
- Custom backend services

The script must return **structured JSON** that includes:

### Example Structure

:::BlockQuote
<font color="#2166AE">{
 "keys_to_index": ["page_content","metadata"],"page_content":"content for AI retrieval","metadata": {
   "source":"external_data"
 }
}</font>
:::

The **keys\_to\_index** field tells the system which data should be indexed for retrieval.

### Supported Sources

- <font color="#B91C1C"> </font>– Fetch spreadsheet data and convert it into JSON format for indexing.
- <font color="#B91C1C"> </font>– Crawl webpages listed in a sitemap and extract content programmatically.&#x20;
- <font color="#B91C1C"></font> – Retrieve data from backend services or external APIs.&#x20;

Follow the steps below to complete the setup:

👇 **Watch the Configuration Video**

::embed[****]{url="https://youtu.be/THsVa_BgP6s?si=-a3aaluLuTfeinVo"}

## 📚 Next Steps

Once the Custom Script indexing status shows Ready to Search, configure the agent workflow so the AI can retrieve knowledge from the indexed website content.
➡️ Continue with [RAG Path Setup](docId\:M0f5aGwvekRbuek6Jq_C4)
