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

# RAG (Knowledge Base)

> Attach data sources and collection items to ground agent responses.

## Attaching RAG

Use the RAG tab to select data sources and specific items (documents, tables, etc.). The selected list is saved with the agent and used at runtime.

<Steps>
  <Step title="Open RAG tab">
    <Frame>
      <img src="https://mintcdn.com/phinite/spbPnSZPWmAXAKhH/images/open-rag-tab.png?fit=max&auto=format&n=spbPnSZPWmAXAKhH&q=85&s=7c49103f5eb516772efa09a7fd0e0ffd" alt="Open Rag Tab" width="1918" height="870" data-path="images/open-rag-tab.png" />
    </Frame>

    Select the agent block and open RAG.
  </Step>

  <Step title="Choose a data source">
    <Frame>
      <img src="https://mintcdn.com/phinite/spbPnSZPWmAXAKhH/images/choose-a-data-source.png?fit=max&auto=format&n=spbPnSZPWmAXAKhH&q=85&s=9758567708750f3d082de58ad1d9d3d3" alt="Choose A Data Source" width="1916" height="873" data-path="images/choose-a-data-source.png" />
    </Frame>

    Pick a source, then fetch and select items relevant to the agent’s task.
  </Step>

  <Step title="Save">
    <Frame>
      <img src="https://mintcdn.com/phinite/spbPnSZPWmAXAKhH/images/save-rag.png?fit=max&auto=format&n=spbPnSZPWmAXAKhH&q=85&s=523dc93c827342c4681d554a419fe3ed" alt="Save Rag" width="1917" height="873" data-path="images/save-rag.png" />
    </Frame>

    Confirm to persist selections.
  </Step>
</Steps>

<Note>
  UI is implemented in `studio/components/drawer/RAG.tsx` and uses Redux slices for data sources and items.
</Note>
