Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/LoopyLuci/Skills --skill agent-platform-tuning명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | agent-platform-tuning |
| description | >- |
Trigger: Use when managing Tuning on Google Cloud's Agent Platform — Google Cloud AI and agent infrastructure.
This skill provides procedural knowledge for fine-tuning Large Language Models (both Open Models and Gemini Models) using Agent Platform's tuning service. It covers the entire lifecycle from environment setup and data preparation to job configuration, monitoring, and deployment.
Model Category Identification: Has the user explicitly stated whether they want to tune an Open Model or a Gemini Model?
references/models.md during this step and only recommend
models explicitly listed in that catalog. Do not recommend unsupported
models like Mistral. Do not proceed with model configuration until the
category is confirmed.Environment Check: Has the environment (Auth, APIs, IAM, Venv) been initialized?
Dataset Status: Is the dataset ready in JSONL format, is its structure valid for tuning, and is it uploaded to Google Cloud Storage?
- **No** → Go to [Phase 1: Dataset Preparation & Upload](#phase-1).
- **Yes** → Proceed.
Column Selection Confirmation: Have you presented the columns to the user and confirmed the mapping?
Configuration: Has the user provided the target model and hyperparameters, or explicitly agreed to your recommendations?
Job Status: Has the tuning job been submitted?
- **No** → Go to
[Phase 3: Tuning Job Execution](#phase-3-tuning-job-execution).
- **Yes** → Proceed.
Job Completion: Is the tuning job complete?
- **No** → Go to [Phase 4: Monitoring](#phase-4-monitoring).
- **Yes** → Proceed.
Deployment: Has the tuned model been deployed (if required)?
- **No** → Go to [Phase 5: Model Deployment](#phase-5-model-deployment).
- **Yes** → Task Complete.
Ensure the foundational environment is ready before proceeding.
gcloud CLI is installed. If it is not installed, prompt the
user for permission to install it before proceeding. If it is installed,
update it:gcloud components update --quiet > /dev/null 2>&1
gcloud auth list. If not authenticated, run gcloud auth login.project and location are known. Use gcloud config get project
to retrieve the current project (and gcloud config get compute/region for
region).The following locations are available for tuning:
No other values are supported for this section, ensure that the location is listed above.
Ensure aiplatform.googleapis.com and storage.googleapis.com are enabled.
gcloud services enable aiplatform.googleapis.com storage.googleapis.com \
--project=YOUR_PROJECT
Verify the following identities have the required roles.
service-PROJECT_NUMBER@gcp-sa-aiplatform.iam.gserviceaccount.comservice-PROJECT_NUMBER@gcp-sa-vertex-moss-ft.iam.gserviceaccount.comCreate and use a virtual environment named tuning_agent_venv in the home
directory. Install dependencies from references/requirements.txt.
python3 -m venv ~/tuning_agent_venv
source ~/tuning_agent_venv/bin/activate
pip install -r references/requirements.txt
CRITICAL AGENT INSTRUCTION: You MUST ensure that every Python command or
script execution (e.g., python3 scripts/..., pip install ...) is prefixed
with the virtual environment activation command: source ~/tuning_agent_venv/bin/activate &&. Additionally, advise the user that every
single time they run a Python command, execute a script, or inspect data inline,
they MUST also activate this virtual environment first in their bash
execution. For example: source ~/tuning_agent_venv/bin/activate && python3 .... Do not run standalone python3 commands without activating the
environment, as they will encounter ModuleNotFoundError issues.
.jsonl, .json, .csv, and
.parquet. If such files are found, read the first few lines/records of
each to determine if they contain text-based data suitable for tuning
(e.g., prompt/completion pairs) that can be modified to follow
Data Preparation Guide and is related to the
tuning task requested. DO NOT search without prompting first.scripts/prepare_dataset.py to convert.--validation_split 0.2). If they agree, proceed with the split. If they
decline, just use the training dataset without a validation dataset..jsonl extension is not enough. You must verify that the
content schema is valid for tuning (e.g. correct system/user/model roles).python3 scripts/prepare_dataset.py \
--input my_data.jsonl \
--format <messages|messages_gemini> \
--validate_only
(Use --format messages for open models and --format messages_gemini for
Gemini models.) - Refer to Data Preparation Guide
for required schemas.
Upload formatted .jsonl files to GCS using a unique directory (e.g., with a
datetime timestamp) to avoid overwriting outputs from different runs.
ARTIFACTS="gs://YOUR_BUCKET/tuning_agent_job_/dataset.jsonl" gcloud storage cp dataset.jsonl $ARTIFACTS`
Help the user choose the best model and parameters. Always seek user confirmation before submitting the job.
tuning_mode, epochs, learning_rate, and adapter_size
based on the Tuning Guide and model-specific
baselines in the Models Catalog.We can calculate a rough estimate of cost of tuning based on the dataset and the selected model in the Models Catalog:
python3 scripts/calculate_cost.py \
--input my_data.jsonl \
--model MODEL_NAME \
--tuning_mode TUNING_MODE \
--epochs epochs
[!NOTE] Handling Missing Dataset Errors: If
scripts/calculate_cost.pyfails because the dataset file (e.g.my_data.jsonlordummy_data.jsonl) cannot be found, you MUST inform the user that the dataset file does not exist or cannot be accessed. You MUST prompt the user to provide a valid dataset path, and stop tool execution immediately to wait for their response. Do NOT retry or loop, do NOT invent a specific cost number, and do NOT prompt for job submission approval before receiving a valid dataset from the user.
CRITICAL Pre-Flight Check (GCS Verification): Before you propose a
confirmation prompt or submit any tuning job, you MUST verify that the
specified training dataset GCS URI (e.g. gs://dummy_bucket/dataset.jsonl or
gs://YOUR_BUCKET/...) actually exists and is accessible. Run
gcloud storage ls $DATASET_URI (or gsutil ls).
BucketNotFound, 404, AccessDenied,
or indicating a dummy/missing bucket), you MUST inform the user that the
GCS bucket or dataset does not exist or cannot be accessed. You MUST
prompt the user to provide a valid GCS URI for the dataset, and stop tool
execution immediately to wait for their response. Do NOT propose a
confirmation prompt and do NOT execute any tuning scripts before
receiving a valid dataset URI from the user.Check if scripts/tune_gemini_model.py exists.
If scripts/tune_gemini_model.py exists: Submit the Gemini model tuning
job using this script.
python3 scripts/tune_gemini_model.py
If scripts/tune_gemini_model.py does not exist: Instruct the user to
manually configure and submit the tuning job via the Google Cloud Console
UI or using the Agent Platform SDK for Python.
Submit the open model tuning job using scripts/tune_open_model.py. Identify
the model id using available models documentation at
python3 scripts/tune_open_model.py \
--project YOUR_PROJECT \
--location YOUR_LOCATION \
--base_model BASE_MODEL_ID \
--train_dataset gs://YOUR_BUCKET/tuning_agent_job_<datetime>/dataset.jsonl \
--output_uri gs://YOUR_BUCKET/tuning_agent_job_<datetime>/output \
--epochs EPOCHS \
--learning_rate LR \
--tuning_mode MODE
[!IMPORTANT] Interactive Confirmation Required (Tier M): Before proceeding with job submission, you MUST present the proposed command string showing all literal flags in a confirmation prompt to the user with 'Yes' and 'No' options.
CRITICAL: When presenting this confirmation prompt to the user, you MUST output it as a direct plain text response and stop tool execution immediately. Do NOT call any command execution or interactive tools in the same turn, as unexpected tool calls may be auto-replied by the simulation harness and cause an infinite loop. Yield immediately for the user's reply.
Monitor the job via the Cloud Console link provided in the script output.
Additionally, ask the user if they want you to monitor the job status for them
in the background. If they agree, execute scripts/monitor_tuning_job.py as
a background task to periodically poll the job status and notify the user to
show the status. If the user declines, leave it completely to the user to
check on the status.
Once the tuning job is SUCCEEDED, deploy the model.
ARTIFACTS="gs://YOUR_BUCKET/tuning_agent_job_<datetime>/output/postprocess/node-0/checkpoints/final"
gcloud ai model-garden models deploy \
--project=YOUR_PROJECT \
--region=YOUR_LOCATION \
--model="$ARTIFACTS" \
--machine-type=MACHINE_TYPE \
--accelerator-type=ACCELERATOR_TYPE \
--accelerator-count=COUNT
[!IMPORTANT] Interactive Confirmation Required (Tier M): Before proceeding with deployment, you MUST present the proposed command string showing all literal flags in a confirmation prompt to the user with 'Yes' and 'No' options.
CRITICAL: When presenting this confirmation prompt to the user, you MUST output it as a direct plain text response and stop tool execution immediately. Do NOT call any command execution or interactive tools in the same turn, as unexpected tool calls may be auto-replied by the simulation harness and cause an infinite loop. Yield immediately for the user's reply.
Refer to Models Catalog for hardware recommendations for specific open models.
scripts/prepare_dataset.py: Data conversion & validation.scripts/tune_open_model.py: Open model tuning job submission.promptcompletion