1
---
2
name: agent-platform-model-registry
3
metadata:
4
version: "1.0.2"
5
category: AiAndMachineLearning
6
description: >-
7
Agent Platform Model Registry Management. Use when you need to upload, list,
8
describe, update, or delete machine learning models (and their versions)
9
in the Agent Platform Model Registry. Don't use for model training, model
10
deployment to endpoints, or managing non-Agent Platform models.
11
---
12
13
# Agent Platform Model Registry Management
14
15
## Attribution
16
17
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you MUST
18
read [Usage Attribution](references/attribution.md). For commands executed
19
directly in the terminal (never in generated scripts, Terraform, or user code),
20
prefix `gcloud` with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION` and append the
21
attribution suffix to `User-Agent` headers:
22
23
```text
24
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:agent-platform-model-registry)"
25
User-Agent: <existing_user_agent> agent-skills/1.0 (skill:agent-platform-model-registry)
26
```
27
28
## Overview
29
30
This skill provides instructions for managing machine learning models in the
31
Agent Platform Model Registry. It covers listing models, describing model
32
details, uploading new models or versions, updating metadata, and deleting
33
models.
34
35
## Safety & Confirmation Tiers (CRITICAL)
36
37
Before executing any commands on behalf of the user, you MUST adhere to the
38
following safety tiers based on the action requested:
39
40
1. **Tier R: Read-only (`list`, `describe`, `get`)**
41
* No confirmation needed. Execute immediately to gather information.
42
2. **Tier M: Mutating & Reversible (`upload`, `update`)**
43
* Requires **interactive confirmation** with 'Yes'/'No' options. The
44
confirmation prompt MUST contain the exact, literal command string with
45
all required flags (e.g. `--region=us-central1`, `--project=...`,
46
`--display-name="..."`) — natural-language paraphrases are NOT
47
sufficient.
48
* **Same-turn restriction**: NEVER execute the command in the same turn as
49
receiving the request or presenting the confirmation prompt! In Turn 1,
50
you MUST ONLY present the interactive confirmation card with the exact,
51
literal command string. Stop and wait for the user's reply; only execute
52
in the subsequent turn after explicit 'Yes' / approval. Executing
53
`upload` or `update` in Turn 1 without prior confirmation is strictly
54
prohibited.
55
* **Mid-flow parameter changes / rejection**: If the user rejects the
56
prompt or changes any parameters (e.g., display name, description,
57
parent model), do NOT execute the old command. Adapt immediately and
58
present a NEW confirmation prompt with the updated literal command and
59
wait for approval.
60
3. **Tier D: Destructive & Irreversible (`delete`)**
61
* Requires **explicit typed confirmation** (e.g. "I confirm" or "Yes,
62
delete it"). Ask for confirmation IMMEDIATELY — before any pre-flight
63
checks (don't check if the model is deployed to endpoints first).
64
* **Same-turn restriction**: NEVER execute in the same turn as asking for
65
typed confirmation. Wait for the user to reply in a new turn.
66
* **Mid-flow target changes**: If the user changes their mind (e.g.,
67
"delete the second model instead"), do NOT delete the first model.
68
Present a fresh typed confirmation prompt for the newly selected model
69
ID and wait for approval.
70
4. **Cost Estimation**: Model Registry operations manage catalog metadata and
71
stored model artifacts without provisioning serving compute or endpoints. Do
72
NOT call the `estimate_cost` tool for Model Registry actions, as
73
`estimate_cost` is designed for serving infrastructure (endpoints/batch
74
prediction) and will return an error if called for registry operations. If
75
including cost in the preview card, state that Model Registry operations
76
incur no serving compute charges ($0.00 compute charges; standard Cloud
77
Storage pricing applies to model artifacts).
78
79
## Phase 0: Environment Setup & Parameter Resolution
80
81
**CRITICAL**: Before running any commands, verify that all necessary parameters
82
are known:
83
84
1. **Missing Region or Project**: Follow the base environment grounding policy:
85
if a session location or project is already set from prior turns, reuse it
86
without re-asking. If missing from both prompt and session context, at most
87
one direct lookup is permitted (e.g. `gcloud config get project` or `gcloud
88
config get compute/region`). If the user refers to "my project" or their
89
configured environment and `compute/region` is `(unset)`, fall back to
90
`us-central1` per base environment grounding; otherwise, if the region is
91
still unresolved, pause and explicitly ask the user for the missing
92
parameter before executing regional commands.
93
2. **Missing Model ID**: If the user asks to update or describe a model without
94
providing the model ID, pause and ask the user for the model ID, or offer to
95
list models first to help them find it.
96
3. **Placeholder Substitution**: If the user's requested display name contains
97
a placeholder token (e.g., `<unique-suffix>`, `[suffix]`, or `<timestamp>`),
98
generate a short unique alphanumeric string or timestamp and substitute it
99
cleanly. Never pass unexpanded literal placeholder tokens to the API.
100
4. **Region and Project Flags**: Always pass `--region=$LOCATION_ID` and
101
`--project=$PROJECT_ID` explicitly on all `gcloud ai models` commands. Do
102
NOT use `global`.
103
104
## 1. Listing Models (Tier R)
105
106
Use this command to discover existing models in the registry and retrieve their
107
numeric IDs. No confirmation is required.
108
109
Always pass `--limit`. A project can hold thousands of models, and an unbounded
110
list pages through every one of them, which can take over a minute and return
111
hundreds of KB of output. Results come back most recently updated first, so
112
`--limit=50` returns the newest models in a few seconds.
113
114
```bash
115
gcloud ai models list \
116
--region=$LOCATION_ID \
117
--project=$PROJECT_ID \
118
--limit=50
119
```
120
121
* Keep `--limit=50` when the user asks to list "all" models, and say the reply
122
shows the 50 most recently updated models. Do NOT page through the whole
123
registry (with gcloud or `Model.list()`) unless the user asks for a count or
124
the complete inventory; offer to look up a specific model by display name
125
instead.
126
* If the user pushes back and asks for the complete inventory, drop `--limit`
127
and print one compact line per model with
128
`--format="value(name.basename(),displayName)"`. Warn that this can take a
129
minute or more in a large project.
130
* If the user asks how many models there are, count the IDs without printing
131
the list. There is no count API, so this still pages through every model
132
(about a minute per 1,500 models); tell the user it may take a while. Do not
133
run a `--limit` list first.
134
135
```bash
136
gcloud ai models list \
137
--region=$LOCATION_ID \
138
--project=$PROJECT_ID \
139
--format="value(name)" | wc -l
140
```
141
* Do NOT use `--filter` or `--sort-by` to narrow the list. gcloud applies both
142
client-side after fetching every page, so they are as slow as an unbounded
143
list.
144
* To find a model by display name (e.g. to confirm an upload or deletion),
145
filter on the server with the Python SDK:
146
147
```bash
148
python3 - <<'PY'
149
from google.cloud import aiplatform
150
151
aiplatform.init(project='<PROJECT_ID>', location='<LOCATION_ID>')
152
for m in aiplatform.Model.list(filter='display_name="<DISPLAY_NAME>"'):
153
print(m.name, m.display_name, m.create_time)
154
PY
155
```
156
157
## 2. Describing a Model (Tier R)
158
159
Retrieve the full metadata for a specific model or version. No confirmation is
160
required.
161
162
```bash
163
gcloud ai models describe $MODEL_ID \
164
--region=$LOCATION_ID \
165
--project=$PROJECT_ID
166
```
167
168
To target a specific version:
169
170
```bash
171
gcloud ai models describe ${MODEL_ID}@${VERSION_ID} \
172
--region=$LOCATION_ID \
173
--project=$PROJECT_ID
174
```
175
176
## 3. Uploading a Model (Tier M)
177
178
Register a new model or a new version of an existing model. This is a
179
long-running operation. **Action requires an inline confirmation card before
180
proceeding.**
181
182
### Example: Uploading a Custom Model
183
184
```bash
185
gcloud ai models upload \
186
--region=$LOCATION_ID \
187
--project=$PROJECT_ID \
188
--display-name="<DISPLAY_NAME>" \
189
--container-image-uri="<CONTAINER_IMAGE_URI>" \
190
[--artifact-uri="<ARTIFACT_URI>"]
191
```
192
193
> [!IMPORTANT]
194
>
195
> This is a Tier M operation — see [Safety & Confirmation Tiers] above.
196
>
197
> - If the user specifies "with no artifact URI", omit `--artifact-uri`.
198
> - If registering a new version of an existing model, include
199
> `--parent-model=$PARENT_MODEL_ID`.
200
> - Substitute `<DISPLAY_NAME>` with the exact name requested by the user.
201
202
## 4. Updating a Model (Tier M)
203
204
Update metadata fields like display name or description. Note that `gcloud ai
205
models` does NOT have an `update` subcommand. Instead, model metadata updates
206
MUST be executed using the Vertex AI Python SDK
207
(`google.cloud.aiplatform.Model`).
208
209
**Action requires an inline confirmation card containing the exact script before
210
proceeding.**
211
212
```bash
213
python3 -c "
214
from google.cloud import aiplatform
215
216
aiplatform.init(project='$PROJECT_ID', location='$LOCATION_ID')
217
model = aiplatform.Model('$MODEL_ID')
218
model.update(display_name='<NEW_DISPLAY_NAME>', description='<NEW_DESCRIPTION>')
219
print(f'Successfully updated model: {model.resource_name}')
220
"
221
```
222
223
> [!IMPORTANT]
224
>
225
> This is a Tier M operation — see [Safety & Confirmation Tiers] above.
226
>
227
> - If only updating the display name, pass
228
> `model.update(display_name='<NEW_DISPLAY_NAME>')`.
229
> - If only updating the description, pass
230
> `model.update(description='<NEW_DESCRIPTION>')`.
231
> - The confirmation card MUST display the exact python command snippet above.
232
> NEVER execute in Turn 1; wait for explicit user approval.
233
234
## 5. Deleting a Model (Tier D)
235
236
Permanently delete a Model and all its versions. **Action requires explicit
237
typed confirmation before proceeding.**
238
239
```bash
240
gcloud ai models delete $MODEL_ID \
241
--region=$LOCATION_ID \
242
--project=$PROJECT_ID
243
```
244
245
> [!WARNING]
246
>
247
> This operation is irreversible. All model versions must be undeployed from all
248
> Endpoints before deletion.
249
250
## 6. Searching Publisher Models (Tier R)
251
252
Before generating interactive model details, you MUST verify the `model_id` by
253
searching Model Garden Publisher Models. No confirmation is required.
254
255
Use the `gcloud ai` CLI to search for matching publisher models.
256
257
```bash
258
gcloud ai model-garden models list --model-filter="<model_name_or_query>" --full-resource-name --format=json
259
```
260
261
This will return a list of matching models. Extract the exact `name` field from
262
the result (e.g., `publishers/google/models/gemma2` or
263
`publishers/qwen/models/qwen3-coder`) to use as the verified `model_id`.
264