$npx -y skills add google/agents-cli --skill google-agents-cli-publishgoogle-agents-cli-publish is an agent skill published from google/agents-cli, installable through the skills CLI.
| 1 | # Gemini Enterprise Registration |
| 2 | |
| 3 | > **Requires:** A deployed agent. For Agent Runtime, `deployment_metadata.json` (created by `agents-cli deploy`) enables auto-detection. For Cloud Run or GKE, provide the agent card URL and flags directly. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | 1. **Agent must be deployed** — the agent must be running and reachable |
| 8 | 2. **Gemini Enterprise app must exist** — Create one in Google Cloud Console → Gemini Enterprise → Apps before registering |
| 9 | 3. **`deployment_metadata.json`** (Agent Runtime only) — Created automatically by `agents-cli deploy`; contains the agent runtime ID, deployment target, the A2A flag, and the agent directory |
| 10 | |
| 11 | ## Required Permissions for A2A on Cloud Run |
| 12 | |
| 13 | - **`roles/run.servicesInvoker`** granted to the Discovery Engine service account (`service-<PROJECT_NUMBER>@gcp-sa-discoveryengine.iam.gserviceaccount.com`) on the Cloud Run service. |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Registration Modes |
| 18 | |
| 19 | ### A2A Registration (Cloud Run / GKE) |
| 20 | |
| 21 | Every scaffolded agent serves the Agent-to-Agent protocol. A2A is the default — and only — registration type on **Cloud Run** and **GKE**, which have no reasoning engine, so Gemini Enterprise registers them over A2A. Pass the agent card URL and the command fetches the card and registers it; display name and description default to the card's `name`/`description`. |
| 22 | |
| 23 | ```bash |
| 24 | # A2A on Cloud Run / GKE |
| 25 | agents-cli publish gemini-enterprise \ |
| 26 | --agent-card-url https://my-service-abc123.us-east1.run.app/a2a/app/.well-known/agent-card.json \ |
| 27 | --gemini-enterprise-app-id projects/123456/locations/global/collections/default_collection/engines/my-app |
| 28 | ``` |
| 29 | |
| 30 | Pass `--display-name` / `--description` to override the card defaults. For Agent Runtime, use ADK registration (below). |
| 31 | |
| 32 | ### ADK Registration (default on Agent Runtime) |
| 33 | |
| 34 | This is the **default and recommended registration for Agent Runtime** deployments: Gemini Enterprise invokes the agent natively via `:streamQuery` on its reasoning engine resource, authenticating end-to-end. Under the hood, `:streamQuery` dispatches to the `AdkApp`'s `streaming_agent_run_with_events` method — when debugging an ADK invocation, search the runtime's `reasoning_engine_stderr` logs for that method name to trace the failure. It's also the path to use when the agent needs an OAuth authorization (`--authorization-id`). The agent is registered directly via its reasoning engine resource name; no agent card URL is needed. |
| 35 | |
| 36 | ```bash |
| 37 | agents-cli publish gemini-enterprise \ |
| 38 | --registration-type adk \ |
| 39 | --agent-runtime-id projects/123456/locations/us-east1/reasoningEngines/789 \ |
| 40 | --gemini-enterprise-app-id projects/123456/locations/global/collections/default_collection/engines/my-app \ |
| 41 | --display-name "My Agent" \ |
| 42 | --description "Handles customer queries" \ |
| 43 | --tool-description "Answers questions about products" |
| 44 | ``` |
| 45 | |
| 46 | --- |
| 47 | |
| 48 | ## Programmatic Mode (CI/CD) |
| 49 | |
| 50 | The command is non-interactive by default — pass all required values via flags or environment variables. This makes it safe for CI/CD pipelines. |
| 51 | |
| 52 | ### Via flags |
| 53 | |
| 54 | ```bash |
| 55 | agents-cli publish gemini-enterprise \ |
| 56 | --agent-runtime-id "$AGENT_RUNTIME_ID" \ |
| 57 | --gemini-enterprise-app-id "$GEMINI_ENTERPRISE_APP_ID" \ |
| 58 | --display-name "Production Agent" \ |
| 59 | --registration-type adk |
| 60 | ``` |
| 61 | |
| 62 | ### Via environment variables |
| 63 | |
| 64 | Most flags have an env var alternative (`--metadata-file`, `--interactive`, and `--list` do not): |
| 65 | |
| 66 | ```bash |
| 67 | export AGENT_RUNTIME_ID="projects/123456/locations/us-east1/reasoningEngines/789" |
| 68 | export GEMINI_ENTERPRISE_APP_ID="projects/123456/locations/global/collections/default_collection/engines/my-app" |
| 69 | export GEMINI_DISPLAY_NAME="Production Agent" |
| 70 | export GEMINI_DESCRIPTION="Handles customer queries" |
| 71 | |
| 72 | agents-cli publish gemini-enterprise |
| 73 | ``` |
| 74 | |
| 75 | --- |
| 76 | |
| 77 | ## Interactive Mode (`--interactive`) |
| 78 | |
| 79 | Pass `--interactive` (or `-i`) to be guided through any missing values with interactive prompts. The command will list available Gemini Enterprise apps, offer to auto-detect the agent runtime ID from metadata, and prompt for display name and description. |
| 80 | |
| 81 | ```bash |
| 82 | agents-cli publish gemini-enterprise --interactive |
| 83 | ``` |
| 84 | |
| 85 | --- |
| 86 | |
| 87 | ## Complete Flag Reference |
| 88 | |
| 89 | | Flag | Env Var | Desc |