Skip to content

Commit 70c343b

Browse files
cloud-ix-copybaracopybara-github
authored andcommitted
Update the Agent Platform skills.
- Remove the internal sandbox endpoint override from the deploy skill's gcloud setup script, so it configures the default Vertex AI endpoint. - Stop each skill from building its own virtual environment; install only what is missing. Each skill used to create a virtualenv and install its own SDKs before running anything. Because a virtualenv is isolated from the surrounding interpreter, that discarded SDKs which were already present and made every skill pay for a redundant install. The skills now check whether their imports resolve and install only what is actually missing, so the common case does no work at all. requirements.txt is unchanged in purpose: it remains the manifest for anyone who downloads a single skill on its own. It should not be applied on top of a working environment, where its pins would downgrade SDKs that other skills share. Its numpy, pandas and pyarrow pins are dropped, as no script in the skill imports them. calculate_cost.py no longer depends on smart_open. It reads local paths with the builtin open() and gs:// paths with google-cloud-storage, which the skill already has. This removes the one dependency that could not be satisfied by an ordinary unpinned install, because no single smart_open release exposed the API used here across the supported range. Also fixes two latent bugs in the setup instructions: a pip version specifier was unquoted, so the shell parsed ">=1.154.0" as a redirect and wrote an empty file instead of constraining the install; and one skill installed the separate, deprecated vertexai distribution, which already ships inside google-cloud-aiplatform. - Pin google-genai >=1.74.0 in the tuning skill so enterprise=True works. The tuning skill pinned google-genai==1.73.1, but tune_open_model.py and monitor_tuning_job.py call genai.Client(enterprise=True, ...), which requires google-genai 1.74.0 or later, so those scripts raised a TypeError. Bump the pin to 1.75.0, the highest release that still satisfies the google-genai<2.0.0 constraint declared by google-cloud-aiplatform 1.138.0, and add a test that keeps the pin in range. - Add Qwen 3.5 9B to the open model tuning catalog, and tell the agent to offer the closest supported model when a user asks for one that is not supported for tuning. - Remove stray internal lint-suppression comments from the published skills, and fix a malformed code block in the tuning skill. The disableFinding and enableFinding HTML comments were being copied verbatim into the published files instead of being stripped, and are now removed. The upload snippet in Phase 1.2 of the tuning skill rendered as a broken inline code span and is now a proper bash code block. - Internal change - Recommend the `global` location for open model tuning. The skill previously applied one five-region whitelist to every tuning job and rejected `global` outright, which refused valid open model requests and forced a region choice before any other setup. It now recommends `global` for open models and confirms it with the user, documents when an explicit region is still required (CMEK and data residency), and notes that sub-resources resolve to a real region that must be read before monitoring or deployment. For Gemini, supported regions vary per model, so the skill directs a per-model documentation lookup instead of reusing the open model list. - [agent_platform] Narrow the `agent-platform-deploy` skill trigger description so that pure listing/discovery questions ("is X deployed?", "list my endpoints", "which regions have models running?") route to `agent-platform-endpoint-management` instead of speculatively loading the deploy skill. Also clarify that "list available Model Garden models" refers to the model CATALOG (not the user's endpoints), and replace "check deployment status, verify serving endpoints" with the more specific "check the status of an in-progress deployment operation". PiperOrigin-RevId: 957218689
1 parent 05679aa commit 70c343b

19 files changed

Lines changed: 302 additions & 157 deletions

File tree

skills/cloud/agent-platform-deploy/SKILL.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ metadata:
44
category: AiAndMachineLearning
55
description: >-
66
Deploy open models or custom weights from Model Garden to Agent Platform
7-
endpoints, check deployment status, verify serving endpoints, or clean up
8-
resources by undeploying models and deleting endpoints. Use when asked to
9-
deploy models on Agent Platform, list available Model Garden models, check if
10-
a model is deployable, query deployment cost, troubleshoot deployment errors
11-
(like quota limits), or undeploy/clean up endpoints. Also use when copying
12-
and deploying a 1P Tuned Model. Don't use for public Vertex AI deployments
13-
(use the `vertex-deploy` skill) or for running model evaluations (use the
14-
`agent-platform-eval-flywheel` skill).
7+
endpoints, check the status of an in-progress deployment operation, or clean
8+
up resources by undeploying models and deleting endpoints. Use when asked to
9+
actively deploy a model, list the Model Garden CATALOG of available models,
10+
check if a specific model is deployable
11+
(`gcloud ai model-garden models list-deployment-config`), query deployment
12+
cost, troubleshoot deployment errors (like quota limits), or undeploy/clean
13+
up endpoints. Also use when copying and deploying a 1P Tuned Model. Don't
14+
use for pure listing/discovery questions of the form "is X deployed?",
15+
"list my endpoints", or "which regions have models running?" — for those
16+
use `agent-platform-endpoint-management`. Don't use for public Vertex AI
17+
deployments (use the `vertex-deploy`
18+
skill) or for running model evaluations (use the `agent-platform-eval-flywheel`
19+
skill).
1520
---
1621

1722
# Agent Platform Model Garden Deploy Skill
@@ -188,6 +193,7 @@ Interpret the probe result and act:
188193
to this project's Vertex AI API — enable it in the console or switch
189194
projects") and the concrete next action.
190195

196+
191197
## 3. Deploying a Model
192198

193199
> [!WARNING] Deploying models, especially large ones, consumes significant

skills/cloud/agent-platform-deploy/references/copy_deploy_guide.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,22 @@ If user is copying model in different region, skip the P4SA setup section.
4646
- Verify `gcloud auth list`. If not authenticated, run `gcloud auth login`.
4747
- Execute the following command to set the global variable.
4848
`export PROJECT_ID=${PROJECT_ID} REGION=${REGION}`
49-
- Check if ${USER} have value, or ask user to set one.
49+
- Check if ${USER_EMAIL} have value (the full account email), or ask user to
50+
set one.
5051

5152
### 0.2 GCloud CLI setup
5253

53-
- use `scripts/config_gcloud_cli.sh ${ENV} ${PROJECT_ID} ${REGION} ${USER}`
54+
- use `scripts/config_gcloud_cli.sh ${ENV} ${PROJECT_ID} ${REGION} ${USER_EMAIL}`
5455

5556
### 0.3 P4SA Setup
5657

5758
#### 0.3.0 Goal
5859

5960
To copy a model from source project ${SOURCE_PROJECT} to the destination project
6061
${PROJECT_ID}, and ${REGION}, follow
61-
<!-- disableFinding(LINE_OVER_80) -->
62+
6263
https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/model-registry/copy-model, add the
63-
<!-- enableFinding(LINE_OVER_80) -->
64+
6465
P4SA of the destination project as a new principal to the source project and
6566
assign the Vertex AI Service Agent role to it.
6667

skills/cloud/agent-platform-deploy/scripts/config_gcloud_cli.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
ENV=${1:-$ENV}
44
PROJECT_ID=${2:-$PROJECT_ID}
55
REGION=${3:-$REGION}
6-
USER=${4:-$USER}
6+
USER_EMAIL=${4:-$USER_EMAIL}
77

88
if [[ -z "${PROJECT_ID}" ]]; then
99
echo "Error: PROJECT_ID is not set (neither as an argument nor as an environment variable)."
1010
exit 1
1111
fi
1212

13-
if [[ -z "${USER}" ]]; then
14-
echo "Error: USER is not set (neither as an argument nor as an environment variable)."
13+
if [[ -z "${USER_EMAIL}" ]]; then
14+
echo "Error: USER_EMAIL is not set (neither as an argument nor as an environment variable)."
1515
exit 1
1616
fi
1717

@@ -24,20 +24,17 @@ if [[ -z "${REGION}" ]]; then
2424
exit 1
2525
fi
2626

27-
ENDPOINT="https://${REGION}-${ENV}-aiplatform.sandbox.googleapis.com"
2827

2928
echo "PROJECT_ID: ${PROJECT_ID}"
30-
echo "USER: ${USER}"
29+
echo "Account: ${USER_EMAIL}"
3130
echo "Env: ${ENV}"
3231
echo "Region: ${REGION}"
33-
echo "Endpoint: ${ENDPOINT}"
3432

3533
if ! gcloud config configurations describe "${ENV}-cdmodel" > /dev/null 2>&1; then
3634
gcloud config configurations create "${ENV}-cdmodel"
3735
gcloud config set core/project "${PROJECT_ID}"
3836
gcloud config set compute/region "${REGION}"
39-
gcloud config set account "${USER}"@google.com
40-
gcloud config set api_endpoint_overrides/aiplatform "${ENDPOINT}"
37+
gcloud config set account "${USER_EMAIL}"
4138
fi
4239

4340
gcloud config configurations activate ${ENV}-cdmodel

skills/cloud/agent-platform-endpoint-management/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ gcloud ai endpoints list \
7474
--region=$LOCATION_ID
7575
```
7676

77+
*(Optional)* For pagination, you MUST use `--limit=$LIMIT` to restrict the total
78+
number of returned endpoints. You can also append `--page-size=$PAGE_SIZE` to
79+
control API chunking, or `--page-token=$PAGE_TOKEN` for next pages.
80+
7781
> [!IMPORTANT]
7882
>
7983
> Always specify the `--region`. Do NOT use 'global'. Ask the user to specify if

skills/cloud/agent-platform-eval-flywheel/SKILL.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,19 @@ to the following safety tiers based on the action requested:
5353

5454
## Setup
5555

56-
Install the SDK:
56+
The scripts need `vertexai` (from `google-cloud-aiplatform[evaluation]`),
57+
`google-genai`, `pandas`, and `requests`. Do **not** create a virtual
58+
environment — it starts empty and hides packages the environment already
59+
provides, forcing a redundant install. Probe, and install only what is missing:
5760

5861
```bash
59-
pip install google-cloud-aiplatform[evaluation]>=1.154.0 google-genai>=1.0.0
62+
python3 -c "import vertexai, google.genai, pandas, requests" \
63+
|| pip install 'google-cloud-aiplatform[evaluation]>=1.154.0' 'google-genai>=1.0.0'
6064
```
6165

66+
The version specifiers must stay quoted: unquoted, bash reads `>=1.154.0` as a
67+
redirect and silently writes an empty file instead of constraining the install.
68+
6269
Need `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`. Check env vars first;
6370
if missing, ask the user. Newer Gemini models often need `location="global"`.
6471

skills/cloud/agent-platform-eval-flywheel/references/deployment.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@ only covers the deployment + endpoint-inference subset.
3131

3232
## Setup
3333

34-
Install the deployment-eval dependencies (in addition to the base SDK install in
35-
the main SKILL.md):
34+
The deployment-eval dependencies are the same set the main SKILL.md relies on.
35+
Do **not** create a virtual environment — it starts empty and hides packages the
36+
environment already provides, forcing a redundant install. Probe, and install
37+
only what is missing:
3638

3739
```bash
38-
python3 -m venv .model-eval
39-
source .model-eval/bin/activate
40-
pip install google-cloud-aiplatform[evaluation]>=1.154.0 google-genai>=1.0.0 requests
40+
python3 -c "import vertexai, google.genai, requests" \
41+
|| pip install 'google-cloud-aiplatform[evaluation]>=1.154.0' 'google-genai>=1.0.0' requests
4142
```
4243

44+
Keep the version specifiers quoted: unquoted, bash reads `>=1.154.0` as a
45+
redirect and silently writes an empty file instead of constraining the install.
46+
4347
The scripts also shell out to `gcloud` and `gsutil`, so the user must have the
4448
Google Cloud SDK installed and `gcloud auth application-default login`
4549
completed.

skills/cloud/agent-platform-inference/SKILL.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,32 @@ environment is correctly initialized by following these steps:
7171
gcloud services enable aiplatform.googleapis.com
7272
```
7373

74-
3. **Virtual Environment**: Create and activate a dedicated local virtual
75-
environment:
74+
3. **Python Dependencies**: The scripts import `vertexai` (from
75+
`google-cloud-aiplatform`), `google-genai`, and `openai`. Do **not** create
76+
a virtual environment — it starts empty and hides packages the environment
77+
already provides, forcing a redundant install. Probe, and install only what
78+
is missing:
7679

7780
```bash
78-
python3 -m venv .venv
79-
source .venv/bin/activate
81+
python3 -c "import vertexai, google.genai, openai" \
82+
|| pip install -r scripts/requirements.txt
8083
```
8184

82-
4. **Install Dependencies**: Install the required SDKs:
85+
The pins in `scripts/requirements.txt` are a fallback for an environment
86+
that does not already provide these SDKs; do not apply them on top of a
87+
working environment.
8388

84-
```bash
85-
pip install -r scripts/requirements.txt
86-
```
87-
88-
5. **Verify Setup (Optional)**: Run all sample scripts at once to verify the
89+
4. **Verify Setup (Optional)**: Run all sample scripts at once to verify the
8990
environment is working end-to-end:
9091

9192
```bash
9293
./scripts/verify_all.sh
9394
```
9495

95-
6. **Execution**: Advise the user that every time they execute a Python snippet
96-
from this skill, they must ensure this virtual environment is activated
97-
first.
96+
5. **Execution**: Run the scripts with a plain `python3 scripts/...`. There is
97+
no environment to activate first.
98+
9899

99-
<!-- disableFinding(LINE_OVER_80) -->
100100

101101
> [!IMPORTANT] **CRITICAL: Model IDs & Availability** * **Gemini Models**: See
102102
> [Gemini Models][gemini-models-docs] for valid Model IDs and Regions. *
@@ -109,7 +109,7 @@ environment is correctly initialized by following these steps:
109109
>
110110
> \[gemini-models-docs]:
111111
> https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/migrate
112-
> <!-- enableFinding(LINE_OVER_80) -->
112+
>
113113
>
114114
> ## Workflow Decision Tree
115115

@@ -288,21 +288,21 @@ def get_gcp_access_token():
288288

289289
> [!NOTE] Google Cloud access tokens typically expire after 1 hour. The
290290
> `get_gcp_access_token()` function above retrieves a *fresh* token at the time
291-
> it is called. <!-- disableFinding(LINE_OVER_80) --> For long-running
291+
> it is called. For long-running
292292
> applications, you implement a refresh mechanism. See
293293
> [Refresh the access token](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/migrate/openai/auth-and-credentials?hl=en#refresh_your_credentials)
294-
> for details. <!-- enableFinding(LINE_OVER_80) -->
294+
> for details.
295295
296296
### Configuration (Base URL)
297297
298-
<!-- disableFinding(LINE_OVER_80) -->
298+
299299
300300
- **Global Endpoint** (Recommended for most models requiring global
301301
availability):
302302
`https://aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/global/endpoints/openapi`
303303
- **Regional Endpoint**:
304304
`https://{REGION}-aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/{REGION}/endpoints/openapi`
305-
<!-- enableFinding(LINE_OVER_80) -->
305+
306306
307307
### Python Example (OpenMaaS - Chat Completions)
308308
@@ -708,10 +708,10 @@ print(response.text)
708708
1. **Check Location Availability**:
709709
* **OpenMaaS**: Verify the model is available in your region. See
710710
[Model Availability by Location](https://docs.cloud.google.com/gemini-enterprise-agent-platform/resources/locations#genai-open-models).
711-
* **Gemini**: <!-- disableFinding(LINE_OVER_80) -->
711+
* **Gemini**:
712712
* **Source of Truth**: Always check
713713
[Gemini Model Locations](https://docs.cloud.google.com/gemini-enterprise-agent-platform/resources/locations#google-models)
714-
for the authoritative list. <!-- enableFinding(LINE_OVER_80) -->
714+
for the authoritative list.
715715
* **Preview Models**: All Preview models (e.g., Gemini 3.1,
716716
experimental versions) are often **ONLY** available in the
717717
`us-central1` or `global` regions.

skills/cloud/agent-platform-inference/scripts/verify_all.sh

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
#!/bin/bash
22
set -e
33

4-
# Create a temporary directory for the virtual environment
5-
VENV_DIR=$(mktemp -d -t venv_verify.XXXXXX)
6-
python3 -m venv "$VENV_DIR"
7-
source "$VENV_DIR/bin/activate"
8-
9-
# Trap to ensure cleanup happens on exit
10-
cleanup() {
11-
echo "Cleaning up virtual environment..."
12-
deactivate 2>/dev/null || true
13-
rm -rf "$VENV_DIR"
14-
}
15-
trap cleanup EXIT
16-
17-
echo "Installing requirements..."
18-
pip install -q -r scripts/requirements.txt
4+
# Verify against the ambient interpreter, which is the one the skill's scripts
5+
# actually run under. A throwaway venv would verify an environment no real
6+
# invocation ever uses, so it could pass while the real one is broken.
7+
echo "Checking dependencies..."
8+
python3 -c "import vertexai, google.genai, openai" \
9+
|| pip install -q -r scripts/requirements.txt
1910

2011
echo "Running verification tests..."
2112
FAILED=0

skills/cloud/agent-platform-prompt-management/SKILL.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,18 @@ these steps:
8383
gcloud auth application-default login
8484
```
8585

86-
2. **Virtual Environment**: Create and activate a dedicated virtual
87-
environment:
86+
2. **Python Dependencies**: This skill needs `google-cloud-aiplatform` and
87+
`google-genai`. Do **not** create a virtual environment — it starts empty
88+
and hides packages the environment already provides, forcing a redundant
89+
install. Probe, and install only what is missing:
8890

8991
```bash
90-
python3 -m venv ~/prompt_agent_venv
91-
source ~/prompt_agent_venv/bin/activate
92+
python3 -c "import vertexai, google.genai" \
93+
|| pip install google-cloud-aiplatform google-genai
9294
```
9395

94-
3. **Install Dependencies**: Install the required Agent Platform SDKs:
95-
96-
```bash
97-
pip install google-cloud-aiplatform google-genai
98-
```
99-
100-
4. **Execution**: Advise the user that every time they execute a Python
101-
snippet, they must ensure this virtual environment is activated first.
96+
3. **Execution**: Run Python snippets with a plain `python3`. There is no
97+
environment to activate first.
10298

10399
> [!TIP]
104100
>

skills/cloud/agent-platform-tuning-management/SKILL.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ following safety tiers based on the action requested:
3737
**CRITICAL**: Before running any of the Python snippets below, you MUST ensure
3838
the environment is correctly initialized by following these steps:
3939

40-
1. **Virtual Environment**: Create and activate a virtual environment:
41-
42-
```bash
43-
python3 -m venv ~/tuning_mgr_venv
44-
source ~/tuning_mgr_venv/bin/activate
45-
```
46-
47-
2. **Google Cloud Authentication**: Authenticate with your Google Cloud account
40+
1. **Google Cloud Authentication**: Authenticate with your Google Cloud account
4841
and configure active Application Default Credentials (ADC) for Agent
4942
Platform access:
5043

@@ -53,14 +46,17 @@ the environment is correctly initialized by following these steps:
5346
gcloud auth application-default login
5447
```
5548

56-
3. **Install Dependencies**: Install the required Agent Platform SDK:
49+
2. **Python Dependencies**: This skill needs `google-cloud-aiplatform`. Do
50+
**not** create a virtual environment — it starts empty and hides packages
51+
the environment already provides, forcing a redundant install. Probe, and
52+
install only what is missing:
5753

5854
```bash
59-
pip install google-cloud-aiplatform
55+
python3 -c "import vertexai" || pip install google-cloud-aiplatform
6056
```
6157

62-
4. **Execution**: Advise the user that every time they execute a Python
63-
snippet, they must ensure this virtual environment is activated first.
58+
3. **Execution**: Run Python snippets with a plain `python3`. There is no
59+
environment to activate first.
6460

6561
## Workflow Decision Tree
6662

0 commit comments

Comments
 (0)