Gemini integration
This document explains how to register Google Cloud Cortex Framework BigQuery conversational analytics data agents in Gemini so business users across your organization can query enterprise data products using natural language.
After you provision domain-specific data agents from your deployed
Cortex Framework data products using
uv run cortex-create-ca-agents,
you can register and synchronize those agents automatically with
uv run cortex-register-gemini-agents,
or publish them manually in the Google Cloud console through
Agent Registry or the Agent2Agent (A2A)
protocol for cross-project setups.
Key benefits
Integrating Cortex Framework data agents with Gemini provides the following benefits:
- Declarative CLI registration and reconciliation: Configure your target
app and agents in
config/config.yamland runuv run cortex-register-gemini-agentsto fetch A2A agent cards, configure shared Google-managed OAuth credentials, syncstarterPrompts, and reconcile updates idempotently from CI/CD pipelines. - Organization-wide discovery and routing: Business users can browse
Cortex Framework domain agents in the
Agent Gallery, invoke a specific
agent using
@mention, or ask general analytical questions in Gemini that automatically route to the matching data agent. - Centralized agent governance: Administrators can preserve custom OAuth and sharing policies configured in the Google Cloud console, or govern cross-project discovery and regional traffic routing manually through Agent Registry and Agent Gateway.
- End-user IAM security: Queries execute in BigQuery using each signed-in user's OAuth 2.0 and IAM credentials, preserving dataset, table, column, and row-level access controls.
- Preserved semantic context: Retains all Cortex Framework
knowledge sources, table and column descriptions (
annotations/*.yaml),schemaRelationships,glossaryTerms, and verified queries (goldenQueries) synchronized byuv run cortex-create-ca-agents.
How the integration works
Registering Cortex Framework data agents in
Gemini with uv run cortex-register-gemini-agents follows these
stages:
- Data engineers configure
conversationalAnalyticsinconfig/config.yamlwithcontextVersion: publishedand runuv run cortex-create-ca-agentsto create and synchronize BigQuery conversational analytics data agents. For instructions, see Conversational analytics integration. - Administrators configure the
geminiblock inconfig/config.yamland runuv run cortex-register-gemini-agents(optionally previewing with--dry-run, or creating and updating the app on demand with--create-app). - The CLI verifies required Google Cloud APIs, confirms location support in
the Discovery Engine API, validates that each referenced data agent
exists with a
publishedcontext, retrieves each agent's canonical A2A card from the Conversational Analytics API, configures default Google-managed OAuth credentials, syncsstarterPromptsfromgoldenQueries, and registers or updates each agent in place. - Business users sign in to Gemini, complete a one-time OAuth 2.0 authorization prompt shared across Cortex Framework-managed agents in that project and location, and ask natural-language questions against your Cortex Framework data products.
For cross-project deployments where BigQuery and Gemini reside in different Google Cloud projects, or when you prefer console-driven registration, see Alternative: Manual or cross-project registration in the Google Cloud console.
Before you begin
Before registering your data agents in Gemini, verify the following prerequisites:
Provision published data agents
Deploy your Cortex Framework data product pipelines and run
uv run cortex-create-ca-agents with contextVersion: published (the default)
so that each referenced data agent exists in BigQuery with a
populated published context. Agents that only have a staging context fail
pre-flight validation during uv run cortex-register-gemini-agents. For setup
instructions, see
Conversational analytics integration.
Enable Google Cloud APIs
Enable the Discovery Engine API (discoveryengine.googleapis.com) and
the Conversational Analytics API (geminidataanalytics.googleapis.com) in
buildEnvironment.buildProjectId, or pass --enable-apis when running
uv run cortex-register-gemini-agents:
gcloud services enable discoveryengine.googleapis.com \
geminidataanalytics.googleapis.com \
--project=BUILD_PROJECT_ID
Replace the following:
BUILD_PROJECT_ID: the Google Cloud project ID configured inbuildEnvironment.buildProjectId, for example:my-cortex-project.
Verify license and regional alignment
uv run cortex-register-gemini-agents resolves the
Discovery Engine API location from gemini.app.location (normalized
to lowercase), defaulting to lowercased data.bigQueryLocation when omitted.
If you register agents manually through Agent Registry, the
storage region of your BigQuery data agent (configured in
conversationalAnalytics.location or data.bigQueryLocation) must also match
the Agent Registry region binding configured in your
Agent Gateway. You can't change a data agent's region after the
agent is created.
Identify or create an app in Gemini
Identify an existing Gemini app ID (appId) in
buildEnvironment.buildProjectId, or pass --create-app to
uv run cortex-register-gemini-agents (with gemini.app.displayName
configured) to create or update the app on demand. To create an app manually in
the Google Cloud console, see
Create an app.
Get the required roles
To get the permissions that you need to register, publish, and query Cortex Framework data agents in Gemini, ask your administrator to grant you the following IAM roles:
-
Register agents and manage apps (
uv run cortex-register-gemini-agents):- Gemini Enterprise Admin (
roles/discoveryengine.agentspaceAdmin) or Discovery Engine Admin (roles/discoveryengine.admin) onbuildProjectId - Gemini Data Analytics Data Agent Viewer (
roles/geminidataanalytics.dataAgentViewer), Data Agent User (roles/geminidataanalytics.dataAgentUser), or Data Agent Editor (roles/geminidataanalytics.dataAgentEditor) onbuildProjectId - Service Usage Consumer (
roles/serviceusage.serviceUsageConsumer) onbuildProjectId - Service Usage Admin (
roles/serviceusage.serviceUsageAdmin) onbuildProjectId(required only when passing--enable-apis)
- Gemini Enterprise Admin (
-
Publish and share data agents manually in BigQuery (optional console workflow):
Gemini Data Analytics Data Agent Owner (
roles/geminidataanalytics.dataAgentOwner) or Gemini Data Analytics Data Agent Editor (roles/geminidataanalytics.dataAgentEditor) onbuildProjectId -
Discover and query published data agents (business user):
- Gemini Data Analytics Data Agent User (
roles/geminidataanalytics.dataAgentUser) onbuildProjectId - BigQuery Studio User (
roles/bigquery.studioUser) or Gemini for Google Cloud User (roles/cloudaicompanion.user) onbuildProjectId - BigQuery Job User (
roles/bigquery.jobUser) on the query execution project - BigQuery Data Viewer (
roles/bigquery.dataViewer) on the underlying data product datasets
- Gemini Data Analytics Data Agent User (
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
For complete permission details, see Required roles for data agents and Register and manage A2A agents.
Configure gemini in config/config.yaml
Add a top-level gemini section to config/config.yaml alongside
buildEnvironment.buildProjectId and your enabled conversationalAnalytics
agents:
buildEnvironment:
buildProjectId: BUILD_PROJECT_ID
gemini:
enabled: true
app:
appId: cortex-gemini-assistant
displayName: "Cortex Gemini Assistant"
location: global
companyName: "Example Corp"
agents:
- agentId: cortex-sap-financial-analysis-agent
# Optional: defaults to the conversationalAnalytics agent displayName.
# displayName: "Financial Analysis Agent"
enabled: true
- agentId: cortex-sales-revenue-forecast-assistant
# displayName: "Sales Performance & Revenue Forecast Assistant"
enabled: false
- agentId: cortex-sap-inbound-logistics-risk-analyst
# displayName: "SAP Inbound Logistics Risk Agent"
enabled: false
Replace the following:
BUILD_PROJECT_ID: the Google Cloud project ID hosting both your provisioned BigQuery data agents and the Gemini app, for example:my-cortex-project.
The following table describes the gemini configuration fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
gemini.enabled |
boolean |
No | true |
Enable or disable execution of uv run cortex-register-gemini-agents. |
gemini.app.appId |
string |
Yes | None | Target Gemini app (Discovery Engine) ID. Must be 1–63 characters of lowercase letters, digits, hyphens, and underscores, starting with a lowercase letter or digit and not ending with a hyphen. |
gemini.app.displayName |
string |
With --create-app |
None | Human-readable app display name (1–256 characters). Required when passing --create-app; optional when only registering agents into an existing app. |
gemini.app.location |
string |
No | Lowercased data.bigQueryLocation |
Discovery Engine API location (such as global, us, or eu). Set to match your active Gemini license location. |
gemini.app.companyName |
string |
No | None | Company name stored in the app's commonConfig.companyName. When omitted on update, any existing server-side value is preserved. |
gemini.agents[].agentId |
string |
Yes | None | ID of an enabled, published conversational analytics data agent provisioned in buildEnvironment.buildProjectId. |
gemini.agents[].displayName |
string |
No | Inherited from data agent | Optional display name override shown in Gemini (1–256 characters). Falls back to the conversational analytics agent's displayName or agentId. |
gemini.agents[].enabled |
boolean |
No | true |
Whether to register or update this agent during uv run cortex-register-gemini-agents. |
Register agents with uv run cortex-register-gemini-agents
First preview pre-flight validation and planned registration status with
--dry-run (no resources are created or modified and telemetry is suppressed):
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-register-gemini-agents --config $CORTEX_CONFIG_FILE --dry-run
Register or update all enabled agents into an existing Gemini app:
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-register-gemini-agents --config $CORTEX_CONFIG_FILE
To create or update the configured Gemini app on demand before
registering agents, and automatically enable any missing required APIs, add
--create-app and --enable-apis (note that --enable-apis is mutually
exclusive with --dry-run):
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-register-gemini-agents \
--config $CORTEX_CONFIG_FILE \
--create-app \
--enable-apis
For full CLI options and exit codes, see the
uv run cortex-register-gemini-agents CLI reference.
Automated card, authentication, prompt, and reconciliation behavior
During each run, uv run cortex-register-gemini-agents manages registered
agents as follows:
- Automatic A2A card retrieval: Fetches each agent's canonical A2A card
JSON from
/v1beta/a2a/<ca_agent_name>/v1/cardon the resolved Conversational Analytics API endpoint and applies the effectivedisplayNameanddescription. - Shared Google-managed OAuth (
authorizationConfig.agentAuthorization): New registrations attach a deterministic first-party authorization resource (projects/<project>/locations/<location>/authorizations/geminidataanalytics_<uuid>) seeded by(project_id, location)so all Cortex Framework data agents in that project and location share a single per-user OAuth consent grant without manual client setup. On update, any existing non-emptyauthorizationConfigconfigured in the Google Cloud console (such as custom OAuth) is preserved, while a missing authorization configuration is backfilled automatically. starterPromptssynchronization: Copies eachnatural_language_questionfrom the live data agent'spublished_context.example_queries(goldenQueries) intostarterPrompts. Updates always includestarterPromptsin the patchupdateMask(defaulting to an empty list) so removing an upstream verified query clears the stale starter prompt.sharingConfigdefaults and preservation: Newly registered agents are created withsharingConfig: {"scope": "ALL_USERS"}. On subsequent updates,sharingConfigis excluded from the patchupdateMaskso sharing scopes customized by administrators in the Google Cloud console are preserved.- Idempotent reconciliation statuses:
NEEDS_CREATION: Creates the app (when--create-appis passed) or registers the agent.NEEDS_UPDATE: Updates mutable managed fields (displayName,companyNameon the app;displayName,description,starterPrompts, A2A card, or missing authorization on the agent) in place.NO_CHANGE: Resource already matches the target configuration; no write calls are issued.NOT_MANAGED: Protects incompatible or unmanaged resources—such as an existing Discovery Engine engine with an incompatible solution type (other thanSOLUTION_TYPE_SEARCHorSOLUTION_TYPE_GENERATIVE_CHAT), or an existing agent whose card URL doesn't target/projects/<buildProjectId>/locations/<caLocation>/dataAgents/<agentId>. Unmanaged resources are never overwritten and cause the command to exit with status code1.
Alternative: Manual or cross-project registration in the Google Cloud console
If your BigQuery data agents and Gemini app
reside in different Google Cloud projects, or if you prefer configuring
Agent Registry and Agent Gateway manually in the
Google Cloud console, use the following workflow instead of
uv run cortex-register-gemini-agents.
Configure Agent Gateway
If you publish your data agents through Agent Registry, your Gemini administrator must configure an Agent Gateway with a matching region binding:
- Set up an Agent Gateway
that includes an Agent Registry binding matching your data
agent's location (
conversationalAnalytics.locationordata.bigQueryLocation), such as US, EU, or Global. In the Google Cloud console, go to the Gemini page and open your app.
Go to Security > Configuration, and then enter the gateway resource name in the Agent Gateway configuration section. For detailed instructions, see Route Gemini traffic through Agent Gateway.
If you instead import agents directly using the A2A card JSON, skip to Publish data agents in BigQuery.
Publish data agents in BigQuery
After uv run cortex-create-ca-agents synchronizes your data agent, publish the
agent to additional channels in BigQuery Studio:
In the Google Cloud console, go to the BigQuery Studio Agents page.
Select the project configured in
buildEnvironment.buildProjectId.Select the Agent Catalog tab and click your provisioned Cortex Framework data agent.
Verify that the Region matches your agent's configured location (
conversationalAnalytics.locationordata.bigQueryLocation) and, if applicable, your Agent Gateway configuration.Click Publish, or click Publish updates if the agent was previously published.
In the Publishing channels pane, under Additional channels, choose your publishing method:
- Same project (Agent Registry): If BigQuery and Gemini are in the same project, in the Agent Registry section, select the Register this agent checkbox.
- Cross-project (A2A endpoint JSON): If BigQuery and Gemini are in different projects, in the Integrate via A2A (Agent2Agent) section, click Copy JSON to copy the A2A endpoint JSON data and share it with your Gemini administrator.
Click Publish or Publish updates.
Share the data agent in BigQuery with the users and groups who need access, granting them the roles listed in Get the required roles.
Register data agents in the Google Cloud console
As a Gemini administrator, register the published BigQuery data agent in your app using either Agent Registry or the A2A card JSON.
Option 1: Import from Agent Registry
- If Gemini is in a different project from your
BigQuery project,
manually register the agent
in Agent Registry in your Gemini project first
(otherwise, skip this step):
- In the Google Cloud console, open Agent Registry in your Gemini project, select the Agents tab, and then click Add agent.
- In the Agent details pane, for Type, select A2A, and for Region, select the region that matches your data agent and Agent Gateway configuration.
- Select Paste JSON, enter the A2A endpoint JSON data copied from BigQuery, and then click Save.
In the Google Cloud console, go to the Gemini Enterprise page and open your app.
In the navigation menu, click Agents > click Add agent.
In the Choose an agent type pane, locate Agents from Agent Registry and click Add.
Select your Cortex Framework data agent card, click Add agent, review the populated agent metadata, and then click Next.
In the Authenticate agent step, select how Gemini authenticates against the agent:
- Default Google-managed credentials: Google manages OAuth 2.0 credentials automatically without manual client setup.
- Custom OAuth: Select this option if your organization requires custom OAuth 2.0 credentials, and then enter your client ID, client secret, authorization URL, and token URL.
Click Finish.
Share the registered agent with authorized users and groups.
Option 2: Import using A2A card JSON
If BigQuery and Gemini are in different projects and you aren't using Agent Registry, import the A2A card JSON directly:
In the Google Cloud console, go to the Gemini Enterprise page and select your app.
In the navigation menu, click Agents > click Add agent.
In the Choose an agent type pane, locate Custom agent via A2A and click Add.
In the Agent card JSON field, enter the A2A card JSON copied from BigQuery.
Click Preview agent details > click Next.
In the Agent authorization step, select Default Google-managed credentials or configure Custom OAuth, and then click Finish.
Share the registered agent with authorized users and groups.
Discover and query agents
After the administrator registers and shares the agent, business users can query Cortex Framework data products in Gemini:
- Open Gemini for your organization.
- Discover or invoke the Cortex Framework data agent using any of
the following methods:
- Browse the Agent Gallery: Select the data agent card to start a dedicated conversation.
- Use
@mentionin chat: Enter@followed by the agent name (for example,@Financial Analysis Agent) in the main chat prompt to direct a question to that agent. - Ask a question in the main chat: Ask a natural-language question (for
example, one of your configured verified queries (
goldenQueries)) and let Gemini route the query to the matching data agent.
- Complete the one-time OAuth 2.0 sign-in prompt to authorize queries against BigQuery with your user credentials, and then verify the returned SQL analysis, tables, or charts.
For full administrator prerequisites, region requirements, and discovery options, see Publish a data agent in Gemini.
What's next
- Review CLI flags in CLI register Gemini agents.
- Configure and synchronize data agents in Conversational analytics integration.
- Review data agent CLI flags in CLI create conversational analytics agents.
- View
conversationalAnalyticsandgeminischema settings in Deployment configuration. - Synchronize governance metadata in Knowledge Catalog integration.
- Manage and monitor data agents in Create data agents.