Developers can use the Conversational Analytics API, which is accessed through geminidataanalytics.googleapis.com
, to build an artificial intelligence (AI)-powered chat interface, or data agent
. The API uses natural language to answer questions about structured data in BigQuery, Looker, and Looker Studio, and also supports querying data from AlloyDB, GoogleSQL for Spanner, Cloud SQL, and Cloud SQL for PostgreSQL through the new QueryData
method. With the Conversational Analytics API, you provide your data agent with business information and data ( context
), as well as access to tools such as SQL, Python, and visualization libraries. These agent responses are presented to the user and can be logged by the client application, creating a seamless and auditable data chat experience.
Learn how and when Gemini for Google Cloud uses your data .
Get started with the Conversational Analytics API
To start using the Conversational Analytics API, you can first review the architecture and key concepts documentation to understand how agents process requests, the workflows for agent creators and users, conversation modes, and Identity and Access Management (IAM) roles.
To start building data agents, complete the steps in the setup and prerequisites documentation. For guided walkthroughs, sample applications, SDKs, and other development tools, see Conversational Analytics API tutorials, demos, and tools .
Setup and prerequisites
Before you use the API or the examples, complete the following steps:
- Enable the Conversational Analytics API : Describes prerequisites to enable the Conversational Analytics API.
- Conversational Analytics API access control with IAM : Describes how to use Identity and Access Management to share and manage access to data agents.
- Authenticate and connect to a data source with the Conversational Analytics API : Provides instructions for authenticating to the API and configuring connections to your BigQuery, Looker, Looker Studio, and Cloud Databases data (AlloyDB, GoogleSQL for Spanner, Cloud SQL, and Cloud SQL for PostgreSQL).
- Customer-managed encryption keys (CMEK) : Describes how to use your own encryption keys in Cloud Key Management Service to protect data agents and conversations that use Looker data sources.
Build and interact with a data agent
After completing the previous steps, use the Conversational Analytics API to build and interact with a data agent by following these steps:
- Build a data agent using HTTP : Provides a complete example of building and interacting with a data agent by using direct HTTP requests with Python.
- Build a data agent using the Python SDK : Provides a complete example of building and interacting with a data agent by using the Python SDK.
- Guide agent behavior with authored context : Learn how to provide authored context to guide agent behavior and improve response accuracy. You can also view examples of authored context with BigQuery data sources and with Looker data sources .
- Render a Conversational Analytics API agent response as a visualization : Provides an example of processing chart specifications from API responses and rendering them as visualizations by using the Python SDK and the Vega-Altair library.
Best practices
Review the following guides to learn about best practices for using the Conversational Analytics API:
- Manage BigQuery costs for your agents : Learn how to monitor and manage BigQuery costs for your Conversational Analytics API agents by setting project-level, user-level, and query-level spending limits.
- Ask effective questions : Learn how to craft effective questions for your agents to get the most out of the Conversational Analytics API.
- Data retention and deletion : Learn about data retention and deletion for Conversational Analytics API data agents and conversations.
- Troubleshoot Conversational Analytics API errors : Troubleshoot common Conversation Analytics API errors.
- Known limitations : Provides detailed information about known limitations of the Conversational Analytics API, including limitations of queries, data, visualizations, and questions.
- Render agent responses for Looker data sources : Learn best practices for rendering Conversational Analytics API responses in a user interface when you're using Looker data sources.
API reference and client libraries
- Gemini Data Analytics REST reference : Provides detailed descriptions of API versions, methods, endpoints, and type definitions.
- SDKs and development tools : Lists language-specific client libraries.
Key API operations
The API provides the following core endpoints for managing data agents and conversations:
POST
/v1beta/projects/*/locations/*/dataAgents
POST
/v1beta/projects/*/locations/*/dataAgents:createSync
GET
/v1beta/projects/*/locations/*/dataAgents/*
POST
/v1beta/projects/*/locations/*/dataAgents/*:getIamPolicy
setIAMpolicy
endpoint to share a data agent with other users.POST
/v1beta/projects/*/locations/*/dataAgents/*:setIamPolicy
PATCH
/v1beta/projects/*/locations/*/dataAgents/*
PATCH
/v1beta/projects/*/locations/*/dataAgents/*:updateSync
GET
/v1beta/projects/*/locations/*/dataAgents
GET
/v1beta/projects/*/locations/*/dataAgents:listaccessible
get
permission on the agent. You can use the creator_filter
field to manage which agents this method returns: -
NONE(default): Returns all data agents that are accessible to the user, regardless of who created the agents. -
CREATOR_ONLY: Returns only the data agents that are accessible to the user and that were created by that user. -
NOT_CREATOR_ONLY: Returns only the data agents that are accessible to the user and that were created by others.
DELETE
/v1beta/projects/*/locations/*/dataAgents/*
DELETE
/v1beta/projects/*/locations/*/dataAgents/*:deleteSync
POST
/v1beta/projects/*/locations/*/conversations
POST
/v1beta/projects/*/locations/*:chat
POST
/v1beta/projects/*/locations/*:chat
POST
/v1beta/projects/*/locations/*:chat
GET
/v1beta/projects/*/locations/*/conversations/*
GET
/v1beta/projects/*/locations/*/conversations
GET
/v1beta/projects/*/locations/*/conversations/*/messages
DELETE
/v1beta/projects/*/locations/*/conversations/*
cloudaicompanion.topics.delete
Identity and Access Management permission is required to call this endpoint.POST
/v1beta/projects/*/locations/*/conversations:queryData
Send feedback
Use the following links to file a bug or request a feature.

