> For the complete documentation index, see [llms.txt](https://developer.kizen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.kizen.com/docs/integrations-and-plugins/integrations/mysql/add-mysql-data-to-an-agentic-workflow.md).

# Add MySQL Data to an Agentic Workflow

{% hint style="success" %}
**Audience:** Admins, Developers, Solution Architects

**Purpose:** Explains how to read and write MySQL data from an <code class="expression">space.vars.automation</code> to query or update your external MySQL database
{% endhint %}

## Overview

{% hint style="warning" %}
**Caution:** This setup reflects Kizen's default configuration. Your administrator may have customized your layout, so columns or navigation may appear differently. Trial accounts may have limited features.
{% endhint %}

Once you set up the MySQL integration in <code class="expression">space.vars.Kizen\_company\_name</code>, you can read and write MySQL data directly from <code class="expression">space.vars.automations</code> with the Read Data and Write Data actions.

***

## Before You Begin

To add MySQL data to an <code class="expression">space.vars.automation</code>, you need:

* A MySQL connection to <code class="expression">space.vars.Kizen\_company\_name</code>. See [Enable MySQL in Kizen](/docs/integrations-and-plugins/integrations/mysql/enable-mysql-in-kizen.md) for details.
* A MySQL user account with the necessary read or write privileges on the target database tables.

***

## Add MySQL data to an Agentic Workflow

To add MySQL data to an <code class="expression">space.vars.automation</code>:

{% stepper %}
{% step %}

#### Go to the Agentic Workflow builder

In the global navigation, select **Agentic Workflows**. Then, to open the builder, do one of the following:

* Select **New Agentic Workflow**.
* Select the name of an existing <code class="expression">space.vars.automation</code>.

<div data-with-frame="true"><figure><img src="/files/lzKaVI7e5AOZZ1FMqBl2" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Add an action to the workflow

Select **+**, and then select **Add Action**.

<div data-with-frame="true"><figure><img src="/files/4LDpBWhuH4BQ4KPdgIM3" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Select the MySQL Connection action

In the Add Action modal that appears, scroll to the Integration section, and select the MySQL Connection card.

<div data-with-frame="true"><figure><img src="/files/ZhYb3FmqYtDt9HPhXbhj" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Choose whether to read or write MySQL data

In the Action Settings section of the Add Action modal, select the **Action** dropdown menu, and do one of the following:

* To read MySQL data, select **Read Data**.
* To write MySQL data, select **Write Data**.

<div data-with-frame="true"><figure><img src="/files/AQeJuD7v8cJKzGi8t1TE" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
**Caution:** The Write Data action can insert, update, or delete records in your external MySQL database. Validate your query against a non-production database before running it against production data.
{% endhint %}
{% endstep %}

{% step %}

#### Configure the sources for the script inputs

For each of the fields in the Script Inputs section of the modal, select the source of the field's value from the **Input Source** dropdown menu, and then configure the source with the additional controls that appear.

<div data-with-frame="true"><figure><img src="/files/HoM4mrxS8TGsQZorTDoz" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
**Note:** The order of the fields on the screen depends on whether you selected the Read Data or Write Data action.
{% endhint %}

The fields are as follows:

| Field                     | Type      | Description                                                                                                                                                           | Required?                                 |
| ------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| **Database**              | `String`  | The name of the target MySQL database.                                                                                                                                | Yes                                       |
| **Return Single Value**   | `Boolean` | Whether you expect to return a single value (`true`) or multiple values (`false`).                                                                                    | Yes                                       |
| **Query**                 | `String`  | The `SELECT` statement to execute.                                                                                                                                    | Yes                                       |
| **Connection Secret Tag** | `String`  | The name of the MySQL environment from your integration secret to execute the query on. Configure this source when you have more than one environment in your secret. | Not in a single-environment configuration |

{% hint style="info" %}
**Note:** Always use the `LIMIT` clause in `SELECT` queries against large tables. Results sets larger than 5 MB might be truncated or cause memory issues.
{% endhint %}
{% endstep %}

{% step %}

#### Configure the destination for the result of the query

The result of the query comes back as a string. Find the Result field in the Script Outputs section of the modal, open its **Output Destination** dropdown menu, select where to store the result string, and then configure the destination with the additional controls that appear.

<div data-with-frame="true"><figure><img src="/files/o39fCMq3PTg1qTr3R8CK" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Configure error handling

In the Error Handling section of the modal, specify how to handle errors in this step of the <code class="expression">space.vars.automation</code>.

<div data-with-frame="true"><figure><img src="/files/XYE28AKjBqpeCYQ0sP7S" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### **Save the MySQL Connection action**

Select **Save.**
{% endstep %}
{% endstepper %}

***

## What's Next

Your <code class="expression">space.vars.automation</code> can now read from or write to your MySQL database. For details on how to fix common technical issues, continue to [Troubleshoot MySQL](/docs/integrations-and-plugins/integrations/mysql/troubleshoot-mysql.md).

<details>

<summary><strong>Related Topics</strong></summary>

* [MySQL](/docs/integrations-and-plugins/integrations/mysql.md)
* [Enable MySQL in Kizen](/docs/integrations-and-plugins/integrations/mysql/enable-mysql-in-kizen.md)
* [Troubleshoot MySQL](/docs/integrations-and-plugins/integrations/mysql/troubleshoot-mysql.md)

</details>

***

*Oracle, Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.kizen.com/docs/integrations-and-plugins/integrations/mysql/add-mysql-data-to-an-agentic-workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
