Manage data agents in Cloud SQL for PostgreSQL Studio

MySQL  |  PostgreSQL  |  SQL Server

Preview — Data agents

This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms, and theAdditional Terms for Generative AI Preview Products. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

For information about access to this release, see the access request page.

This document describes how to create a data agent in Cloud SQL for PostgreSQL Studio using an agent context file. A data agent is associated with a single agent context file.

To learn about data agents, seeData agents overview.

Before you begin

Complete the following prerequisites before creating an agent.

Enable required services

Enable the following services for your project:

Prepare a Cloud SQL instance

Make sure that you have access to an existing Cloud SQL instance or create a new one.For more information, seeCreate instances forCloud SQL.

Required roles and permissions

Grantexecutesql permission to Cloud SQL instance

To grant theexecutesql permission to Cloud SQL instance and enable the Cloud SQLData API, run the following command:
gcloud components updategcloud beta sql instances patchINSTANCE_ID --data-api-access=ALLOW_DATA_API
ReplaceINSTANCE_ID with your Cloud SQL instance ID.

To perform steps in this tutorial, sign in toGoogle Cloud, and then authenticate to the databaseusing IAM authentication.

Create a data agent

To create a data agent, perform the following steps:

  1. In the Google Cloud console, go to the Cloud SQL page.

    Go to Cloud SQL

  2. Select an instance from the list.

  3. In the navigation menu, clickCloud SQL Studio.

  4. Sign in toStudio using Identity and Access Management (IAM) authentication.

  5. In theExplorer pane, next toData Agents, clickView actions.

  6. ClickCreate agent.

  7. InAgent name, provide a unique agent name. The agent name is case-sensitive and can contain letters, numbers, hyphens, and underscores.

  8. Optional. InAgent description, add a description for your agent.

  9. Optional. ClickShow Advanced Options and inSelect a location, select a region for storing agent context.You can select from the following list of supported regions:

    • us-central1
    • us-east1
    • europe-west4
    • asia-southeast1
  10. ClickCreate.

Note: Creating the first agent in a project can take several minutes.

Build agent context

After creating an agent, follow the steps inBuild contexts using Gemini CLI to create an agent context file. You can then edit your agent to upload the context file.

Edit an agent

To edit a data agent, perform the following steps:

  1. In the Google Cloud console, go to the Cloud SQL page.

    Go to Cloud SQL

  2. Select an instance from the list.

  3. In the navigation menu, clickCloud SQL Studio.

  4. Sign in toStudio using Identity and Access Management (IAM) authentication.

  5. In theExplorer pane, next toData Agents, clickView actions.

  6. ClickEdit agent.

  7. Optional: EditAgent description.

  8. ClickBrowse in theUpload agent context file section, and select the agent context file.

  9. ClickSave.

Delete a data agent

To delete a data agent, perform the following steps:

  1. In the Google Cloud console, go to the Cloud SQL page.

    Go to Cloud SQL

  2. Select an instance from the list.

  3. In the navigation menu, clickCloud SQL Studio.

  4. Sign in toStudio using Identity and Access Management (IAM) authentication.

  5. In theExplorer pane, next toData Agents, clickView actions.

  6. ClickDelete agent.

  7. In theDelete agent confirmation dialog, enter the name of the agent.

  8. ClickConfirm to delete the agent.

Note: Before you delete a database, you must delete all agents associated with that database.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.