CLI register Gemini agents

uv run cortex-register-gemini-agents registers deployed Google Cloud Cortex Framework BigQuery conversational analytics data agents into a Gemini app (Engine) in Google Cloud Discovery Engine, and optionally creates or updates the app on demand.

Synopsis

uv run cortex-register-gemini-agents [-h] \
    [-c CONFIG_PATH | --config CONFIG_PATH] \
    [--enable-apis] [--create-app] \
    [--dry-run] [--disable-telemetry]

Replace the following:

  • CONFIG_PATH: path to your global configuration file, for example: config/config.yaml.

Options

The following table describes the command-line options for uv run cortex-register-gemini-agents:

Flag Description Default
-h, --help Show the help message and exit. None
-c, --config CONFIG_PATH Path to the global config.yaml file containing buildEnvironment.buildProjectId, conversationalAnalytics, and gemini configuration. config/config.yaml
--enable-apis Automatically enable missing required Google Cloud APIs (discoveryengine.googleapis.com and geminidataanalytics.googleapis.com) on buildEnvironment.buildProjectId without prompting. Mutually exclusive with --dry-run. false
--create-app Create or update the Gemini app (Engine) on demand before registering agents. Requires gemini.app.displayName in config.yaml. By default, the command only registers or updates agents in an existing app without modifying the app itself. false
--dry-run Run read-only pre-flight checks, build the app and agent payloads, and report reconciliation statuses without creating or updating resources in Google Cloud. Mutually exclusive with --enable-apis. Telemetry event logging is suppressed during --dry-run. false
--disable-telemetry Temporarily disable telemetry event logging during execution. Telemetry is also automatically suppressed when --dry-run is set. For more information, see Cortex Framework telemetry. false

Pre-flight checks and reconciliation

Before modifying Google Cloud resources, uv run cortex-register-gemini-agents runs read-only pre-flight checks against buildEnvironment.buildProjectId:

  • Required APIs: Verifies that discoveryengine.googleapis.com and geminidataanalytics.googleapis.com are enabled on buildEnvironment.buildProjectId.
  • Location support: Dynamically verifies that the resolved Gemini location (gemini.app.location, or lowercase data.bigQueryLocation when omitted) is supported by the Discovery Engine API (for example, global, us, or eu).
  • Existing app verification: When --create-app isn't passed, verifies that gemini.app.appId already exists and uses a compatible solution type (SOLUTION_TYPE_SEARCH or SOLUTION_TYPE_GENERATIVE_CHAT).
  • Live published data agents: Verifies that every enabled agent in gemini.agents exists as a live BigQuery conversational analytics DataAgent with a published_context populated (created with contextVersion: published using uv run cortex-create-ca-agents).

For each enabled agent, the tool fetches the canonical Agent2Agent (A2A) card from the live data agent, configures Google-managed OAuth authorization for end-user BigQuery credentials, imports starter prompts from published example queries, and evaluates one of four reconciliation statuses:

  • NEEDS_CREATION: The app (when --create-app is set) or registered agent doesn't exist yet and is created. Under --dry-run, if --create-app resolves the app as NEEDS_CREATION, all enabled agents are also reported as NEEDS_CREATION.
  • NEEDS_UPDATE: An existing managed app or agent differs from the target configuration and is updated in place, preserving server-side sharing settings on existing agents.
  • NO_CHANGE: The existing managed app or agent already matches the target configuration.
  • NOT_MANAGED: An existing app uses an incompatible solution type, or an existing registered agent with the same ID doesn't target the expected conversational analytics DataAgent card URL. Unmanaged resources aren't overwritten and cause the run to fail.

Exit codes

  • 0: All pre-flight checks and app or agent reconciliations (or dry-run checks) succeeded, or gemini is disabled or has no enabled agents and --create-app isn't set.
  • 1: Configuration validation failed (including combining --dry-run and --enable-apis, or setting --create-app without gemini.app.displayName), a pre-flight check failed, an existing resource resolved as NOT_MANAGED, or a Google Cloud API error occurred.

Examples

Run read-only pre-flight checks and preview registration statuses without modifying Google Cloud resources:

export CORTEX_CONFIG_FILE=config/config.yaml

uv run cortex-register-gemini-agents --config $CORTEX_CONFIG_FILE --dry-run

Register enabled conversational analytics data agents into an existing Gemini app:

export CORTEX_CONFIG_FILE=config/config.yaml

uv run cortex-register-gemini-agents --config $CORTEX_CONFIG_FILE

Create or update the Gemini app on demand, enable missing required APIs, and register enabled agents:

export CORTEX_CONFIG_FILE=config/config.yaml

uv run cortex-register-gemini-agents \
    --config $CORTEX_CONFIG_FILE \
    --create-app \
    --enable-apis

What's next