Manage data agents in Spanner 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 Spanner 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 Spanner instance
- Make sure that a Spanner instance is available. For more information, seeCreate an instance.
- Populate the database with the data and schema that the end user wants to access.
Required roles and permissions
- Add an IAM user or service account to the cluster. For more information, seeApply IAM roles.
- Grant the
spanner.databaseReaderroles to the IAM user at the project level. For more information, seeAdd IAM policy binding for a project. - Grant roles and permissions to the IAM user at the project-level for the required databases.
Create a data agent
To create a data agent, perform the following steps:
In the Google Cloud console, go to the Spanner page.
Select an instance from the list, and then select a database.
In the navigation menu, clickSpanner Studio.
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.
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 Spanner page.
Select an instance from the list, and then select a database.
In the navigation menu, clickSpanner Studio.
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 Spanner page.
Select an instance from the list, and then select a database.
In the navigation menu, clickSpanner Studio.
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 2025-12-17 UTC.