Manage context sets in Spanner Studio

This document describes how to create context sets in Spanner Studio using a context set file. Context set names must be unique within a database.

To learn about context sets, see Context sets 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


This tutorial requires you to have a database in your Spanner instance. For more information, see Create a database.

Required roles and permissions

Create a context set

To create a context set, perform the following steps:

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

    Go to Spanner

  2. Select an instance from the list, and then select a database.

  3. In the navigation menu, click Spanner Studio.

  4. In the Explorer pane, next to Context sets, click View actions.

  5. Click Create context set.

  6. In Context set name, provide a unique context set name. The context set name is case-sensitive and can contain letters, numbers, hyphens, and underscores.

  7. Optional. In Context set description, add a description for your context set.

  8. Click Create.

Build context sets

After creating a context set, follow the steps in Build contexts using Gemini CLI to create a context set file. You can then edit your context set to upload the context set file.

Edit a context set

To edit a context set, perform the following steps:

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

    Go to Spanner

  2. Select an instance from the list, and then select a database.

  3. In the navigation menu, click Spanner Studio.

  4. In the Explorer pane, next to Context sets, click View actions.

  5. Click Edit context set.

  6. Optional: Edit Context set description.

  7. Click Browse in the Upload context set file section, and select the context set file.

  8. Click Save.

Delete a context set

To delete a context set, perform the following steps:

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

    Go to Spanner

  2. Select an instance from the list, and then select a database.

  3. In the navigation menu, click Spanner Studio.

  4. In the Explorer pane, next to Context sets, click View actions.

  5. Click Delete context set.

  6. In the Delete context set confirmation dialog, enter the name of the context set.

  7. Click Confirm to delete the context set.

What's next