> For the complete documentation index, see [llms.txt](https://docs.ownchat.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ownchat.app/bot/utility/ai-agent.md).

# AI Agent

### Overview &#x20;

The AI Agent action allows you to build an intelligent bot workflow that collects customer input, processes it using a configured AI provider, and responds accordingly. You can extend the AI Agent with tools that connect to external services like Google Sheets, assign conversations, close conversations, and update customer fields.

{% embed url="<https://app.supademo.com/demo/cms5y5d502rjfqmqqbdtw5nvn?utm_source=link>" %}

### Step 1: Add the AI Agent to Your Workflow &#x20;

1. Use the **search box** to find and filter available messaging nodes.

{% embed url="<https://app.supademo.com/demo/cmt3zvftq014zyq0jfphqlhp0?utm_source=link>" %}

2. Drag the **AI Agent** node onto the canvas to add it to your bot workflow.

{% embed url="<https://app.supademo.com/demo/cmt465udk0003zi0jh8nfvfk7?utm_source=link>" %}

3. Enter the response text for the AI Agent and click **Text** to select the data type.

{% embed url="<https://app.supademo.com/demo/cmt46bcek00s3yv0jhw8o75vl?utm_source=link>" %}

4. Click **Create Agent** to finalize the initial AI Agent setup.

{% embed url="<https://app.supademo.com/demo/cmt46gbh701aoyq0jetw5fgfo?utm_source=link>" %}

***

### Step 2: Collect Customer Input &#x20;

You can collect customer messages using one of two actions before passing them to the AI Agent.

#### Option A: Ask for Text &#x20;

The **Ask for Text** action collects the customer's message as plain text and passes it to the AI Agent.

1. Use the search box to find **Ask for Text** and add it to your workflow.

{% embed url="<https://app.supademo.com/demo/cmt46ic1t00sbyv0jkazc2vx4?utm_source=link>" %}

2. Click **Variables** to insert dynamic values into your message.

{% embed url="<https://app.supademo.com/demo/cmt46ktmu00lhxi0jzwvxr473?utm_source=link>" %}

3. Click the **Flow** tab to view and manage all stored responses.

{% embed url="<https://app.supademo.com/demo/cmt46n3j400070v0j89zs07vv?utm_source=link>" %}

4. Search for variables and click the variable reference to insert the AI Agent response into your message.

{% embed url="<https://app.supademo.com/demo/cmt48cjn5000fy10jzvd7ah2x?utm_source=link>" %}

5. Enter an error message in the error field to handle invalid input.

{% embed url="<https://app.supademo.com/demo/cmt48g07o00tfxi0jxwd2eppc?utm_source=link>" %}

6. Click **Save Changes** to apply the configuration.

{% embed url="<https://app.supademo.com/demo/cmt48n23a010wyv0jmiiob6xy?utm_source=link>" %}

7. Connect the **Ask for Text** output to the **AI Agent** action. This passes the collected customer message to the AI Agent for processing.

#### Option B: AI Smart Ask &#x20;

The **AI Smart Ask** action understands customer input and can provide interactive response options such as a list or buttons, based on the content and context provided.

1. Add **AI Smart Ask** to your workflow.

{% embed url="<https://app.supademo.com/demo/cmt48swvr010yyv0jlbgv35do?utm_source=link>" %}

2. Click **Variables** to insert dynamic customer data into your message.

{% embed url="<https://app.supademo.com/demo/cmt48usho00tuxi0jgb7vm3mf?utm_source=link>" %}

3. Click the **Flow** tab to view and manage all action responses.

{% embed url="<https://app.supademo.com/demo/cmt48w4fu01ipyq0jrwiugfkb?utm_source=link>" %}

4. Click the variable reference to insert the AI Agent response into your message.

{% embed url="<https://app.supademo.com/demo/cmt493uwq0119yv0j1cqcxo9n?utm_source=link>" %}

5. Click **Save Changes** to preserve your configuration.

{% embed url="<https://app.supademo.com/demo/cmt495bjl011byv0j5f060rj6?utm_source=link>" %}

6. Connect the **AI Smart Ask** output to the **AI Agent** action. The AI Agent analyzes the customer's response and sends a relevant reply using buttons or a list.

{% embed url="<https://app.supademo.com/demo/cmt497fla00tzxi0jfsehvhrx?utm_source=link>" %}

***

### Step 3: Configure the AI Agent &#x20;

1. Click the **dropdown arrow** to expand the AI model settings.

{% embed url="<https://app.supademo.com/demo/cmt4992km01iryq0jisdw4e9z?utm_source=link>" %}

2. Click **Edit Agent** to open the configuration panel.<br>

{% embed url="<https://app.supademo.com/demo/cmt49aegl011dyv0jtbktow4h?utm_source=link>" %}

#### Basic Tab &#x20;

1. Click the **Basic** tab to view and save the response to a variable.<br>

{% embed url="<https://app.supademo.com/demo/cmt49cut8011fyv0jsocm55d8?utm_source=link>" %}

#### Model Tab &#x20;

1. Click the **Model** tab to configure AI provider and model settings.

{% embed url="<https://app.supademo.com/demo/cmt49e8gi0005y30j28evtt43?utm_source=link>" %}

2. Click the **AI provider** dropdown and select your provider (for example, **OpenAI** or **OwnAI**).

{% embed url="<https://app.supademo.com/demo/cmt49gav000u1xi0jzrcnl75q?utm_source=link>" %}

3. Select your preferred AI model (for example, **GPT-4o**).

{% embed url="<https://app.supademo.com/demo/cmt6pr4ke06p3xi0jp2al7ef6?utm_source=link>" %}

4. Adjust the **Temperature** slider to control response randomness and creativity.

{% embed url="<https://app.supademo.com/demo/cmt6psni7000rxm0jrrikql37?utm_source=link>" %}

5. Click the checkbox to show additional configuration options:

{% embed url="<https://app.supademo.com/demo/cmt6pzcvi00050u0ksp323p6r?utm_source=link>" %}

* Select **Plain Text** as the response format.

{% embed url="<https://app.supademo.com/demo/cmt6q1h4306wxyv0j5j26qdoy?utm_source=link>" %}

* Select **Medium** from the **Response Verbosity** dropdown to set a balanced output level.

{% embed url="<https://app.supademo.com/demo/cmt6q35hd0001zo0jqg8oiod6?utm_source=link>" %}

6. Click **Show Additional Options** to add the advanced settings.

{% embed url="<https://app.supademo.com/demo/cmt6q74b20002z40kh9imlme1?utm_source=link>" %}

#### System Prompt and User Message &#x20;

1. Enter your instructions in the **System Prompt** field. The AI Agent uses this prompt to guide the conversation.

{% embed url="<https://app.supademo.com/demo/cmt6q9l3b06wzyv0j8s79iq7l?utm_source=link>" %}

2. Enter a custom message in the **Override User Message** field. This message is sent to the AI Agent instead of the user's original message.

{% embed url="<https://app.supademo.com/demo/cmt6qymqz06yfyv0jclv050s5?utm_source=link>" %}

2. Click **Variables** and select **lastMessage.text** to configure the message variable if needed.

{% embed url="<https://app.supademo.com/demo/cmt6r44xx06qxxi0jm8xj1h4i?utm_source=link>" %}

#### Knowledge Base &#x20;

1. If you want the AI Agent to reference documents when responding, enable the **Knowledge Base** toggle.

{% embed url="<https://app.supademo.com/demo/cmt6rp1ja0039180j1pjz4wue?utm_source=link>" %}

2. Click the **Search Documents** field to find and select the documents to add.<br>

{% embed url="<https://app.supademo.com/demo/cmt6wftvr03xbyn0j5ctxbyu0?utm_source=link>" %}

3. The AI Agent will use these documents as a reference when generating responses.

#### Conversation Memory &#x20;

1. Toggle **Enable Conversation Memory** to allow the AI to load and reference previous messages in the conversation.<br>

{% embed url="<https://app.supademo.com/demo/cmt6wri8l03zvyn0jtrrro87j?utm_source=link>" %}

#### Save Configuration &#x20;

1. Click **Save Configuration** to store all AI Agent settings.

{% embed url="<https://app.supademo.com/demo/cmt6wtcnd00d4180jh7wubz7z?utm_source=link>" %}

***

### Step 4: Add Tools &#x20;

Tools extend the AI Agent's capabilities by connecting it to external actions. Click the **Tools** tab to view and configure available tools.<br>

{% embed url="<https://app.supademo.com/demo/cmt6wwjra0003zl0kah54jc3c?utm_source=link>" %}

Click **Add Tool,** then click the Select an Action dropdown to choose the action for each tool.<br>

{% embed url="<https://app.supademo.com/demo/cmt6wxxcc0001w20j7n3ypr9a?utm_source=link>" %}

***

#### Tool 1: Google Sheets — Append Row &#x20;

Use this tool to save customer details collected by the AI Agent into a Google Sheet.

**Before selecting the connection:** Integrate Google Sheets with your connected Google account and create the connection in the **Apps** section first.<br>

{% embed url="<https://app.supademo.com/demo/cmt6x28oi07c4xi0jfz5exrup?utm_source=link>" %}

In the AI Agent's system prompt, instruct the agent to trigger this tool. For example:

"Once you collect the customer's Name, Phone Number, and Requirement, use the Google Sheet Append Row tool to add these details as a new row in the connected Google Sheet."

#### Configuration steps:

1. Select **Google Sheets — Append Row** from the action dropdown.

{% embed url="<https://app.supademo.com/demo/cmt6wzx6h0004xu0juxqk2h61?utm_source=link>" %}

2. Select your Google Sheets connection from the **Select Connection** dropdown.

{% embed url="<https://app.supademo.com/demo/cmt6x28oi07c4xi0jfz5exrup?utm_source=link>" %}

3. Click **Select Spreadsheet** and choose your target spreadsheet.<br>

{% embed url="<https://app.supademo.com/demo/cmt716hxa008rvq0jc8k5l107?utm_source=link>" %}

2. Click **Select Sheet (Tab)** and choose the sheet tab (for example, Sheet1).

{% embed url="<https://app.supademo.com/demo/cmt718111008tvq0jatwanqge?utm_source=link>" %}

3. Click **Add New Field** to define the data fields:<br>

{% embed url="<https://app.supademo.com/demo/cmt71b99e085txi0jjc469qr7?utm_source=link>" %}

* Enter the **Field Name** (for example, customer name).

{% embed url="<https://app.supademo.com/demo/cmt71hgg300keyp0j67x0sc7y?utm_source=link>" %}

* Enter a **Description** explaining the field's purpose.

{% embed url="<https://app.supademo.com/demo/cmt71j4sx04ldyn0jx0xrt1me?utm_source=link>" %}

* Select **Extracted by AI** from the dropdown to indicate the data source.

{% embed url="<https://app.supademo.com/demo/cmt71lhia00l0yp0jr7aasz4s?utm_source=link>" %}

6. Repeat to add additional fields (for example, user\_email).
7. Click **Create Tool & Continue** to save.

{% embed url="<https://app.supademo.com/demo/cmt71qq3r00lgyp0jheviik51?utm_source=link>" %}

***

#### Tool 2: Google Sheets — Read Sheet &#x20;

Use this tool to allow the AI Agent to read data from a Google Sheet.

1. Click **Add Tool** and select **Google Sheets — Read Sheet** from the action dropdown.<br>

{% embed url="<https://app.supademo.com/demo/cmt71si4507hfyv0jv9n2v6a9?utm_source=link>" %}

2. Select your connection from the **Select Connection** dropdown.<br>

{% embed url="<https://app.supademo.com/demo/cmt71why00875xi0j0chh9ne0?utm_source=link>" %}

3. Select your target spreadsheet and sheet tab.<br>

{% embed url="<https://app.supademo.com/demo/cmt71xvsv07hqyv0jn8x3yw8h?utm_source=link>" %}

3. Click **Create Tool & Continue** to save.

{% embed url="<https://app.supademo.com/demo/cmt71z4yv00d2vq0jc2mc1vun?utm_source=link>" %}

#### Tool 3: Assign Conversation &#x20;

Use this tool to automatically assign a conversation to a specific user or team.

1. Click **Add Tool** and select **Ownchat — Assign Conversation** from the action dropdown.

{% embed url="<https://app.supademo.com/demo/cmt720kt207hsyv0ju5v4qto2?utm_source=link>" %}

2. Click the **Select Assign To** dropdown and choose **User** or **Team**.

{% embed url="<https://app.supademo.com/demo/cmt721wk7000lx80jwbq6nvuy?utm_source=link>" %}

3. Click **Select Assign User** and select the user (for example, Poornima).
4. Click **Create Tool & Continue** to save.<br>

{% embed url="<https://app.supademo.com/demo/cmt7236nc07hwyv0jj5ugivzf?utm_source=link>" %}

***

#### Tool 4: Close Conversation &#x20;

Use this tool to automatically close a conversation when the AI Agent determines it is complete.

1. Click **Add Tool** and select **Ownchat — Close Conversation** from the action dropdown.<br>

{% embed url="<https://app.supademo.com/demo/cmt724oms00devq0jtgql0gud?utm_source=link>" %}

2. Click **Create Tool & Continue** to save.<br>

{% embed url="<https://app.supademo.com/demo/cmt7264oj00lvyp0jrfoibxme?utm_source=link>" %}

***

#### Tool 5: Update Customer Fields &#x20;

Use this tool to update customer data fields collected during the conversation.

1. Click **Add Tool** and select **Ownchat — Update Customer Fields** from the action dropdown.<br>

{% embed url="<https://app.supademo.com/demo/cmt727jjy07i0yv0jm4ysk5pa?utm_source=link>" %}

2. Click **Add New Field** to add a custom field.<br>
3. Select a **Customer Field** from the dropdown to fetch a field from the Field Collection.<br>

{% embed url="<https://app.supademo.com/demo/cmt729qor04pcyn0jhp7aznl8?utm_source=link>" %}

4. Enter the required value and click **Add Field** to define the parameter.
5. Click **Create Tool & Continue** to save.

{% embed url="<https://app.supademo.com/demo/cmt72bazp07i2yv0jwdw9notx?utm_source=link>" %}

***

### Step 5: Review and Publish &#x20;

1. After adding all tools, click the **Basic** tab update button to confirm the AI Agent configuration.<br>

{% embed url="<https://app.supademo.com/demo/cmt72e49e087mxi0ju5am9btr?utm_source=link>" %}

2. Review the list of tools that have been added to the AI Agent.

{% embed url="<https://app.supademo.com/demo/cmt72g2i600dvvq0j7yiziiwe?utm_source=link>" %}

3. Click **Publish** to deploy your bot configuration to production.<br>

{% embed url="<https://app.supademo.com/demo/cmt72igx10001zi0jno2sw1vm?utm_source=link>" %}

***

### Summary &#x20;

| Step | Action                                                                                                               |
| ---- | -------------------------------------------------------------------------------------------------------------------- |
| 1    | Add AI Agent node to the canvas and create the agent                                                                 |
| 2    | Add Ask for Text or AI Smart Ask to collect customer input                                                           |
| 3    | Configure the AI Agent — provider, model, prompt, knowledge base, and memory                                         |
| 4    | Add tools: Google Sheets Append, Google Sheets Read, Assign Conversation, Close Conversation, Update Customer Fields |
| 5    | Review tools and click Publish to deploy                                                                             |
