> For the complete documentation index, see [llms.txt](https://docs.karini.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.karini.ai/amazon-q-data-accessor-integration.md).

# Amazon Q Data Accessor Integration

### Overview

Karini AI integrates with Amazon Q Business, so you can use the Amazon Q Index to build agentic RAG applications. With this integration, you can build an agentic application on a variety of knowledge bases, such as the Amazon Q Index Retriever, Amazon Bedrock Knowledge Bases, and Karini's native knowledge bases. The setup involves creating an agent prompt, adding the Amazon Q Accessor Retriever tool, and publishing a workflow recipe for use in a copilot.

### Prerequisites

* An active AWS account
* An Amazon Q Business application
* IAM Identity Center (IDC) configured
* Access to the Karini AI platform

Before you start, make sure your Amazon Q Business application is provisioned and configured.

### In the AWS Management Console

Create and configure an Amazon Q Business application by following the official [Amazon Q Business documentation](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/setting-up.html).

After configuring Amazon Q Business, set it up in Karini AI so agents get secure, context-aware access to its data.

*Note: Use the External Id from your Karini Organization page as the Tenant Id when you create the Karini AI data accessor in Amazon Q Business.*

### In Karini AI

1. **Configure the agent prompt:** define the agent's objective, query input, and execution parameters.
   * Navigate to **Prompt Playground** and click **Add New**.
   * Set the following:
     * **Name:** a unique name
     * **Task:** Agent
     * **Max State Updates:** 10 (the default is 3)
     * **Prompt:** instructions defining the agent's purpose
     * **Agent Input:** a sample query
   * Click **Save**. The **Tools** tab appears.

<figure><img src="https://415930246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7ZrVuiAUMyuYVvrK5KaB%2Fuploads%2FlRor41OUl6tFTuJKpRpW%2Fimage.png?alt=media&amp;token=8cfd8266-2fd0-4635-a321-2177a3594c84" alt=""><figcaption></figcaption></figure>

2. **Add the Amazon Q Accessor Retriever tool** to the agent prompt.
   * In the **Tools** tab, set:
     * **Name:** a unique name for the tool.
     * **Description:** a brief summary of the tool's purpose and how it supports the agent.
     * **Tool Type:** **Amazon Q Accessor Retriever**.
     * **Application ID:** the Amazon Q Business Application ID for your deployment.
     * **Retriever ID:** the unique Amazon Q Business retriever ID.
     * **Application Region:** the AWS region where the Amazon Q Business application is hosted.
     * **IDC Application ARN:** the ARN of the IAM Identity Center (IDC) client integrated with Amazon Q Business.
     * **IDC Region:** the AWS region where IAM Identity Center is configured.
     * **Max Results:** the maximum number of results retrieved per query.
   * **Save** the configuration.
3. **Test and publish:** validate the agent across models and publish the best configuration.
   * Open the **Test & Compare** tab.
   * Evaluate responses across models.
   * Click **Select as best answer** on the best-performing output.
   * **Save** and **Publish** the prompt.

{% hint style="info" %}
You can't currently connect to the Amazon Q Business application from Prompt Playground.
{% endhint %}

4. **Create the workflow recipe:** link the agent with the chat nodes.

   * Go to **Recipes** and click **Add New**.
   * Set **Type: Workflow** and **Runtime: Karini**.
   * Enter a **Name** and **Description**.
   * Add and connect the following nodes:
     * **Chat** (enable Citations and Follow-up Questions)
     * **Start**
     * **Agent** (select the published prompt)
     * **End**
   * Click **Save**, then **Publish**.

   For detailed guidance, refer to the [Workflow Recipe](https://docs.karini.ai/recipes/workflow-recipe.md) documentation.

<figure><img src="https://415930246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7ZrVuiAUMyuYVvrK5KaB%2Fuploads%2FsmWxYsN9XzrcQMCzBKVg%2Fimage.png?alt=media&amp;token=eedad91d-d9aa-446f-a5fc-0abdb4f590cb" alt=""><figcaption></figcaption></figure>

5. **Create the copilot and authorize Amazon Q:**
   * On the recipe page, click **Actions** and select **Create Copilot**. For copilot settings, refer to [Create copilot](https://docs.karini.ai/recipes/workflow-recipe/create-copilot.md).
   * Open the copilot from **Copilots**.
   * Click **Authorize Amazon Q Index**. This redirects you to your **AWS OIDC provider** in the AWS Console.

<figure><img src="https://415930246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7ZrVuiAUMyuYVvrK5KaB%2Fuploads%2FqAIhl6075jR13BXWiBjc%2Fimage.png?alt=media&amp;token=0157e3e5-6dd7-4f6c-9375-d27a69bb1b5a" alt=""><figcaption></figcaption></figure>

Once authentication succeeds, the copilot is configured to retrieve data from **Amazon Q Business**. Users can ask questions about their Amazon Q Business data, and the copilot returns relevant results with detailed source information for each response.

Refer to the detailed setup walkthrough in the following video.

{% embed url="<https://youtu.be/l7a111f0U2g>" %}
