Manage data agents in Cloud SQL for PostgreSQL Studio Stay organized with collections Save and categorize content based on your preferences.
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
- Add an IAM user or service account to the instance. Formore information, seeManage users withIAM database authentication for Cloud SQL.
- Grant the
cloudsql.studioUserandcloudsql.instanceUserroles to theIAM user at the project level. For more information, seeAdd IAM policy bindingfor a project. - You must also grant database privileges to an IAM user orservice account by logging in as the
postgresuser.GRANT ALL ON SCHEMApublic TO public;.
For more information, seeGrant database privileges to anindividual IAM user or service account.
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
INSTANCE_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:
In the Google Cloud console, go to the Cloud SQL page.
Select an instance from the list.
In the navigation menu, clickCloud SQL Studio.
Sign in toStudio using Identity and Access Management (IAM) authentication.
In theExplorer pane, next toData Agents, clickView actions.
ClickCreate agent.
InAgent name, provide a unique agent name. The agent name is case-sensitive and can contain letters, numbers, hyphens, and underscores.
Optional. InAgent description, add a description for your agent.
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-central1us-east1europe-west4asia-southeast1
ClickCreate.
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:
In the Google Cloud console, go to the Cloud SQL page.
Select an instance from the list.
In the navigation menu, clickCloud SQL Studio.
Sign in toStudio using Identity and Access Management (IAM) authentication.
In theExplorer pane, next toData Agents, clickView actions.
ClickEdit agent.
Optional: EditAgent description.
ClickBrowse in theUpload agent context file section, and select the agent context file.
ClickSave.
Delete a data agent
To delete a data agent, perform the following steps:
In the Google Cloud console, go to the Cloud SQL page.
Select an instance from the list.
In the navigation menu, clickCloud SQL Studio.
Sign in toStudio using Identity and Access Management (IAM) authentication.
In theExplorer pane, next toData Agents, clickView actions.
ClickDelete agent.
In theDelete agent confirmation dialog, enter the name of the agent.
ClickConfirm to delete the agent.
What's next
- Learn more aboutdata agents.
- Learn how toinspect and call a data agent.
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.