Manage data agents in AlloyDB Studio

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

To learn about data agents, see Data agents overview.

Before you begin

Complete the following prerequisites before creating an agent.

Enable required services

Enable the following services for your project:

Prepare an AlloyDB for PostgreSQL cluster and instance

  • Make sure that you have access to an existing AlloyDB cluster and instance or create a new one.
  • Populate the database with the data and schema that the end user wants to access.

Required roles and permissions

  • Add an Identity and Access Management (IAM) user or service account to the cluster at the database level. For more information, see Manage database users.
  • Grant the alloydb.databaseUser role to the IAM user at the project level. For more information, see Add IAM policy binding for a project.

Create a data agent

To create a data agent, perform the following steps:

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

    Go to AlloyDB

  2. Select a cluster from the list.

  3. In the navigation menu, click AlloyDB Studio.

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

  5. In the Explorer pane, next to Data Agents, click View actions.

  6. Click Create agent.

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

  8. Optional. In Agent description, add a description for your agent.

  9. Optional. Click Show Advanced Options and in Select a location, select a region for storing agent context.

  10. Click Create.

Build agent context

After creating an agent, follow the steps in Build 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 AlloyDB page.

    Go to AlloyDB

  2. Select a cluster from the list.

  3. In the navigation menu, click AlloyDB Studio.

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

  5. In the Explorer pane, next to Data Agents, click View actions.

  6. Click Edit agent.

  7. Optional: Edit Agent description.

  8. Click Browse in the Upload agent context file section, and select the agent context file.

  9. Click Save.

Delete a data agent

To delete a data agent, perform the following steps:

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

    Go to AlloyDB

  2. Select a cluster from the list.

  3. In the navigation menu, click AlloyDB Studio.

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

  5. In the Explorer pane, next to Data Agents, click View actions.

  6. Click Delete agent.

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

  8. Click Confirm to delete the agent.

What's next