A command-line interface for managing agents in Google Cloud Gemini Enterprise (formerly known as Agentspace). This CLI tool allows you to easily register, view, list, update, and delete agents from your terminal, supporting both ADK agents running on Agent Engine and any A2A agents running anywhere else (e.g. Cloud Run).
This script provides a convenient wrapper around the Google Discovery Engine API, simplifying the registration and management of agents within a Gemini Enterprise application. It was created because there is currently no gcloud CLI support for registering and managing agents in Gemini Enterprise. The tool handles authentication, request formatting, and provides clear feedback for all operations.
🎉 Major Update: A2A Protocol Support
- Register and manage A2A (Agent-to-Agent) protocol agents
- Support for agents running anywhere: Cloud Run, external services, or ADK agents with A2A enabled
- Flexible input options: JSON file or individual fields
🏷️ Rebranding: Agentspace is now Gemini Enterprise
This tool supports two types of agents:
ADK agents deployed on Google's Reasoning Engine (aka. Agent Engine). This is the traditional deployment method.
Use when:
- Your agent is built with ADK and deployed on Agent Engine
Agents supporting the Agent-to-Agent (A2A) protocol.
Use when:
- Your agent runs on Cloud Run, Cloud Functions, or anywhere with an external endpoint
- Your agent is built with any agentic framework that supports A2A
- Python 3.9+
- Google Cloud SDK installed and authenticated. Run
gcloud auth loginandgcloud auth application-default loginto set up your credentials.
There are two recommended ways to use this tool:
For easy, system-wide access, you can install this tool from PyPI:
pip install agentspace-registration-cli(Note: The package name on PyPI is agentspace-registration-cli, but the command to run it is agentspace-reg)
Alternatively, you can download the script and run it directly:
curl -O https://raw.githubusercontent.com/0nri/agentspace-registration-cli/main/agentspace_registration_cli.py
chmod +x agentspace_registration_cli.pyAfter installation via pip, the tool is available as agentspace-reg.
If you downloaded the script directly, you will invoke it with python agentspace_registration_cli.py. All examples below use the agentspace-reg command.
These examples show how to manage ADK agents deployed on Reasoning Engine.
agentspace-reg register \
--source_type agentengine \
--project_id "my-ai-project-12345" \
--app_id "customer-support-app" \
--display_name "TechSupportBot" \
--description "Provides technical support and troubleshooting assistance." \
--tool_description "An AI agent that helps users with technical issues and product questions." \
--adk_deployment_id "7845692103458921067" \
--icon_uri "https://example.com/icon.png"agentspace-reg update \
--source_type agentengine \
--project_id "my-project-id" \
--app_id "my-app-id" \
--agent_id "existing-agent-id" \
--display_name "Updated Support Bot" \
--description "Updated description" \
--tool_description "Updated tool description" \
--adk_deployment_id "7845692103458921067"These examples show how to manage A2A protocol agents (Cloud Run, external services, or ADK with A2A enabled).
The tool can automatically fetch agent cards from URLs (following the A2A standard of hosting at .well-known/agent-card.json):
agentspace-reg register \
--source_type a2a \
--project_id "my-ai-project-12345" \
--app_id "my-app" \
--display_name "Cloud Run Agent" \
--description "Agent hosted on Cloud Run" \
--agent_card_json "https://my-agent.run.app/.well-known/agent-card.json"Alternatively, create a local agent card JSON file (my-agent-card.json):
{
"protocolVersion": "v1.0",
"name": "Cloud Run Data Agent",
"description": "Analyzes data from BigQuery",
"url": "https://my-agent-xyz.run.app",
"iconUrl": "https://example.com/icon.png",
"version": "1.0.0",
"capabilities": {
"streaming": true
},
"skills": [
{
"id": "data-analysis",
"name": "Data Analysis",
"description": "Analyze data and provide insights",
"tags": ["analytics", "bigquery"],
"examples": ["Analyze sales data", "Show revenue trends"]
}
],
"defaultInputModes": ["text/plain"],
"defaultOutputModes": ["text/plain", "application/json"]
}Then register the agent:
agentspace-reg register \
--source_type a2a \
--project_id "my-ai-project-12345" \
--app_id "my-app" \
--display_name "Cloud Run Data Agent" \
--description "Analyzes data from BigQuery" \
--agent_card_json "./my-agent-card.json"agentspace-reg register \
--source_type a2a \
--project_id "my-ai-project-12345" \
--app_id "my-app" \
--display_name "Simple Chat Agent" \
--description "A simple chatbot agent" \
--agent_name "Simple Chat Agent" \
--agent_url "https://my-chatbot.run.app" \
--agent_version "1.0.0" \
--protocol_version "v1.0" \
--skills_json '[{"id":"chat","name":"Chat","description":"Chat with users","tags":["conversation"],"examples":["Hello","How are you?"]}]' \
--default_input_modes "text/plain" \
--default_output_modes "text/plain"For agents that need to access Google Cloud resources on behalf of users:
agentspace-reg register \
--source_type a2a \
--project_id "my-project" \
--app_id "my-app" \
--display_name "BigQuery Agent" \
--description "Queries BigQuery on behalf of users" \
--agent_card_json "./bigquery-agent-card.json" \
--auth_ids "my-oauth-config"agentspace-reg update \
--source_type a2a \
--project_id "my-project-id" \
--app_id "my-app-id" \
--agent_id "existing-agent-id" \
--display_name "Updated Cloud Run Agent" \
--description "Updated description" \
--agent_card_json "./updated-agent-card.json"These operations work for both agent types.
agentspace-reg view \
--project_id "your-gcp-project-id" \
--app_id "your-app-id" \
--agent_id "the-id-of-the-agent-to-view"agentspace-reg list \
--project_id "your-gcp-project-id" \
--app_id "your-app-id"This action cannot be undone.
agentspace-reg delete \
--project_id "your-gcp-project-id" \
--app_id "your-app-id" \
--agent_id "the-id-of-the-agent-to-delete"| Flag | Description | Required For |
|---|---|---|
--project_id |
The ID of your Google Cloud project. | All actions |
--app_id |
The ID of the Gemini Enterprise app. | All actions |
--display_name |
The display name of the agent. | register, update |
--description |
The user-facing description of the agent. | register, update |
--agent_id |
The ID of the agent to view, update, or delete. | view, update, delete |
--source_type |
Agent source type: agentengine or a2a (default: agentengine) |
register, update |
| Flag | Description | Required For |
|---|---|---|
--tool_description |
The LLM-facing prompt that describes the agent's capabilities. | register, update (agentengine) |
--adk_deployment_id |
The ID of the reasoning engine where the ADK agent is deployed. | register, update (agentengine) |
--icon_uri |
A public URI for the agent's icon. | Optional (agentengine only) |
--auth_ids |
Comma-separated list of authorization resource IDs (supports multiple). | Optional (agentengine) |
| Flag | Description | Required For |
|---|---|---|
--agent_card_json |
Path to JSON file or JSON string with complete agent card. | register, update (a2a) OR use individual fields |
--agent_name |
The name of the A2A agent (in agent card). | register, update (a2a, if no card JSON) |
--agent_url |
The endpoint URL of the A2A agent. | register, update (a2a, if no card JSON) |
--agent_version |
The version of the agent (e.g., "1.0.0"). | register, update (a2a, if no card JSON) |
--skills_json |
JSON string or file path with skills array. | register, update (a2a, if no card JSON) |
--protocol_version |
A2A protocol version (default: "v1.0"). | Optional (a2a) |
--capabilities_json |
JSON string or file path with capabilities object. | Optional (a2a) |
--default_input_modes |
Comma-separated input modes (default: "text/plain"). | Optional (a2a) |
--default_output_modes |
Comma-separated output modes (default: "text/plain"). | Optional (a2a) |
--auth_ids |
Authorization resource ID (only first one used for A2A). | Optional (a2a) |
| Flag | Description | Default |
|---|---|---|
--discovery_location |
Location where your Gemini Enterprise app is created. | global |
--reasoning_location |
Location where your reasoning engine is deployed (agentengine only). | global |
--auth_location |
Location where your authorization resources are created. | global |
This tool supports multi-region deployments where your Discovery Engine (i.e. Gemini Enterprise), Reasoning Engine (i.e. Agent Engine), and Authorization resources can be deployed in different Google Cloud regions.
You can find the correct location values in the Google Cloud Console:
--discovery_location: Check the "Location" column in the AI Applications page--reasoning_location: Find this in the "Agent Engine Details" page--auth_location: Check where your authorization resources are created--adk_deployment_id: Located in the "Agent Engine Details" page (format: "1234567890123456789")--app_id: Found in the "ID" column of the AI Applications page
agentspace-reg register \
--source_type agentengine \
--project_id "my-ai-project-12345" \
--app_id "customer-support-app" \
--display_name "DataAnalysisBot" \
--description "Analyzes customer data and provides insights." \
--tool_description "An AI agent specialized in data analysis and reporting." \
--adk_deployment_id "3721958460127834952" \
--discovery_location "us" \
--reasoning_location "us-central1" \
--auth_location "us-east1"For A2A agents, the agent card must include these fields:
protocolVersion: A2A protocol version (e.g., "v1.0")name: Agent namedescription: Agent descriptionurl: Agent endpoint URLversion: Agent versionskills: Array of skill objectsdefaultInputModes: Array of input MIME typesdefaultOutputModes: Array of output MIME types
iconUrl: URL or data URI for agent iconcapabilities: Object with capability flags (e.g.,{"streaming": true})
Each skill must include:
id: Unique skill identifiername: Skill namedescription: Skill descriptiontags: Array of tags (optional)examples: Array of example queries (optional)
For the complete A2A protocol specification, see the Agent2Agent (A2A) Protocol Official Specification.
Both agent types can use OAuth 2.0 authorization to access Google Cloud resources on behalf of users.
First, create OAuth 2.0 credentials and register them as an authorization resource:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-H "X-Goog-User-Project: PROJECT_ID" \
"https://discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/global/authorizations?authorizationId=my-oauth-config" \
-d '{
"serverSideOauth2": {
"clientId": "YOUR_OAUTH_CLIENT_ID",
"clientSecret": "YOUR_OAUTH_CLIENT_SECRET",
"authorizationUri": "YOUR_AUTH_URI",
"tokenUri": "YOUR_TOKEN_URI"
}
}'Then reference it when registering your agent with --auth_ids "my-oauth-config".
- Agent Engine: Supports multiple authorization resources via comma-separated list
- A2A: Supports only one authorization resource (first one used if multiple provided)
Issue: Error: Missing required flags
- Solution: Ensure you've provided all required flags for your agent type. Use
--source_type agentengineor--source_type a2aand check the required flags table above.
Issue: Error parsing JSON input
- Solution: Validate your JSON syntax. For
--skills_jsonand--capabilities_json, ensure the JSON is properly formatted and quoted in your shell.
Issue: HTTP 404: Agent not found
- Solution: Verify the
--agent_idis correct. Use thelistcommand to see all available agents.
Issue: HTTP 403: Permission denied
- Solution: Ensure your Google Cloud credentials have the Discovery Engine Admin role.
Issue: A2A agent icon not displaying
- Solution: Make sure the
iconUrlin your agent card is either a publicly accessible URL or a valid data URI.