agent-platform-inference
它能做什么
它会说明如何在 Agent Platform 上进行身份验证,并向 Gemini 以及 Llama、DeepSeek 等第三方开源模型发送请求。适合测试或基于这些模型开发的开发者。
适用场景
- ✓当你想向 Google Cloud 上的 Gemini 模型发送测试提示词时。
- ✓当你想通过 Agent Platform 调用 Llama 或 DeepSeek 等开源模型时。
- ✓当你需要使用 GenAI 或 OpenAI SDK 编写对话或补全调用的代码时。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/agent-platform-inference/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请编写代码,向 Agent Platform 上的 Gemini 模型提出一个问题,并打印出答案。”
每周 5 个新技能,1 分钟读完。
工作原理
它会为合适的 SDK 设置身份验证,确定模型和项目,并在你确认后运行请求,因为每次请求都可能产生费用并占用配额。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Agent Platform GenAI Inference Skill
This skill provides instructions for authenticating and connecting to Google Cloud Agent Platform to use Generative AI models. It covers:
- First-Party publisher models (Gemini) — section 2.
- Third-Party publisher models (OpenMaaS: Llama, DeepSeek, Qwen, etc.) — section 3.
- Custom endpoints (any model on a numeric
projects/.../endpoints/<id>resource — tuned Gemini models, OSS LLMs self-deployed from Model Garden via theagent-platform-deployskill, and legacy custom models) — section 4.
Safety & Confirmation Tiers (CRITICAL)
Before executing any commands or scripts on behalf of the user, you must adhere to the following safety tiers based on the action requested. (The skill is read-only; other safety tiers are omitted):
- Tier R: Read-only / Inference (
client.models.generate_content,client.chat.completions.create,client.completions.create,client.embeddings.create)- Requires interactive confirmation with 'Yes'/ 'No' options before executing model inference on behalf of the user, to prevent unexpected cost or quota consumption.
- Required Fields in Confirmation Card: The confirmation prompt must
clearly explain the proposed inference execution and explicitly list all
of the following parameters:
- Project ID: The Google Cloud project ID or number (e.g.
123456789012,my-project). - Region / Location: The target region (e.g.
us-central1,global). - Model ID: The exact model ID (e.g.
gemini-2.5-flash,deepseek-ai/deepseek-v3.2-maas). - SDK: The SDK choice (e.g.
Google GenAI SDK (google-genai),OpenAI SDK). - Input Prompt (or Input Image / Input Media): The prompt text or media URI.
- Any additional generation parameters (e.g.
max_output_tokens,response_schema) if specified. Natural-language paraphrases without explicitly listing these parameters are NOT sufficient.
- Project ID: The Google Cloud project ID or number (e.g.
- Same-turn restriction: Do not execute the inference scripts or commands in the same turn as presenting the confirmation prompt. Stop and wait for the user's reply; only execute after explicit 'Yes' / approval.
- Gold Standard Example:
I will perform model inference with the following parameters. Please confirm this information before I proceed:
- Project ID:
my-project - Region:
us-central1 - Model ID:
gemini-2.5-pro - SDK: Google GenAI SDK (
google-genai) - Input Prompt: "Summarize the plot of Hamlet in 3 sentences"
Do you confirm? [Yes/No]
- Project ID:
- Post-Execution Response Grounding (CRITICAL):
After receiving explicit user approval and executing the inference call
via the SDK, the response returning the generated text MUST
explicitly confirm the execution parameters alongside the model's
output. Never return a bare model response alone. Always include:
- Model ID: The exact model ID used (e.g.
gemini-2.5-proor<MODEL_ID>). - SDK: The SDK used (e.g.
Google GenAI SDK (google-genai)orOpenAI SDK). - Project ID: The Google Cloud project ID/number used.
- Region: The region or endpoint location used (e.g.
globalorus-central1). - Generated Output: The model's complete generated answer.
- Model ID: The exact model ID used (e.g.
Phase 0: Environment Setup
CRITICAL: Before running any of the Python sample scripts in the scripts/
directory (e.g., scripts/openmaas_openai_sdk.py), you MUST ensure the
environment is correctly initialized by following these steps:
Google Cloud Authentication: Authenticate with your Google Cloud credentials and configure active Application Default Credentials (ADC) for Agent Platform access:
gcloud auth login gcloud auth application-default loginEnable API (if not already enabled):
gcloud services enable aiplatform.googleapis.comPython Dependencies: The scripts import
vertexai(fromgoogle-cloud-aiplatform),google-genai, andopenai. Do not create a virtual environment — it starts empty
常见问题
它会不经询问就运行请求吗?
不会。推理前它会请你确认,因为请求可能产生费用并占用配额。
它涵盖自定义模型吗?
涵盖。它支持自定义端点,例如经过微调或自行部署的模型。
它支持哪些 SDK?
GenAI SDK、OpenAI SDK 和旧版 Agent Platform SDK。
详情
作者的原始描述
Connects to and performs inference with Google Cloud Agent Platform GenAI models, including First-Party Gemini models and Third-Party OpenMaaS models (Llama, DeepSeek, Qwen, etc.). Use when asked to perform inference, ask a model a question, run a test prompt, execute chat completions, or generate code for calling Gemini or OpenMaaS models, authenticate with GenAI SDK, OpenAI SDK, or legacy Agent Platform SDK, configure base URLs and global/regional endpoints, or troubleshoot 429 Resource Exhausted (DSQ), 400 User Validation, or 404 Not Found errors. Don't use for deploying models to endpoints
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10203
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。