Agent Platform Inference Skills: Cloud-Native GenAI Integration for Conversational Agents
Agent Platform Inference skills enable conversational agents to authenticate, connect to, and invoke generative AI models hosted on Google Cloud Agent Platform through cloud-native, read-only operations.
These skills provide a structured gateway for agents to interact with Gemini first-party models, third-party OpenMaaS models (Llama, DeepSeek, Qwen), and custom endpoints without requiring manual SDK configuration. According to the google/skills repository source code, the skillset automates environment setup, dependency management, and safety confirmations while generating ready-to-run inference code.
What Are Agent Platform Inference Skills?
Agent Platform Inference skills are specialized capabilities defined in skills/cloud/agent-platform-inference/SKILL.md that allow an agent to produce executable Python scripts for calling generative AI models. The skills are read-only by design—they generate and validate code but never execute inference calls autonomously.
The skill organization follows three model families as documented in lines 20-26 of the SKILL.md file:
- First-Party publisher models (Gemini) — Google's native Gemini model family
- Third-Party publisher models (OpenMaaS) — Open model-as-a-service offerings from partners
- Custom endpoints — Self-deployed open-source LLMs or fine-tuned Gemini variants
Supported Model Families and SDKs
First-Party Gemini Models
Gemini models represent Google's flagship multimodal generative AI. The Agent Platform Inference skill generates code using either the GenAI SDK (preferred for new development) or the Vertex AI SDK (for legacy compatibility).
Key implementation details from the source:
- Region-specific availability checks are mandatory—Gemini models are not globally replicated
- The skill probes the target region using a minimal
generateContentrequest before generating code - LoRA-tuned Gemini variants follow identical probe patterns
Third-Party OpenMaaS Models
OpenMaaS (Open Model-as-a-Service) enables access to popular open-weight models without self-hosting. Supported publishers include Meta (Llama), DeepSeek, and Alibaba (Qwen).
The skill generates OpenAI SDK compatible code for these models, using the global OpenMaaS endpoint structure. Unlike Gemini models, OpenMaaS endpoints do not require region pre-checks.
Custom Endpoints
For self-deployed models or fine-tuned variants, the skill accepts a numeric endpoint ID and generates Vertex AI SDK code targeting that specific resource. This supports:
- Self-hosted open-source LLMs (Mistral, Falcon, etc.)
- Domain-specific fine-tuned Gemini models
- Private model endpoints within a GCP project
Architecture and Safety Design
Environment Prerequisites
The skill enforces four environment checks before generating code, as specified in SKILL.md lines 59-71:
- GCP authentication —
gcloud auth loginplusgcloud auth application-default login - AI Platform API enabled —
aiplatform.googleapis.commust be active on the project - Python dependencies —
vertexai,google-genai, oropenaipackages installed viascripts/requirements.txt - Region validation — For Gemini models, a probe request confirms model availability
Tier R Confirmation System
All inference-related actions trigger Tier R (interactive confirmation) per lines 34-42 of SKILL.md. Before generating any client.models.generate_content or equivalent call, the skill:
- Displays the exact code to be generated
- Lists required permissions and potential costs
- Requires explicit user approval
This read-only, confirmation-gated design prevents accidental API calls or quota consumption.
Dependency Injection Pattern
The skill inspects the local environment before installing packages. From lines 74-83 of SKILL.md:
- Existing installations are preserved
- Missing packages are installed via
scripts/requirements.txt - Version conflicts trigger explicit warnings rather than automatic upgrades
Code Generation Examples
Gemini with GenAI SDK
The skill generates this pattern when the user requests Gemini inference with modern SDK preferences:
import google.genai as genai
import vertexai
genai.configure(api_key="YOUR_ADC_TOKEN")
model = genai.GenerativeModel("gemini-1.5-flash")
response = model.generate_content("Explain quantum computing")
print(response.text)
The YOUR_ADC_TOKEN placeholder is replaced with the active Application Default Credentials token during skill execution.
OpenMaaS with OpenAI SDK
For Llama or similar third-party models:
import openai
client = openai.OpenAI(
base_url="https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/openai",
api_key="YOUR_ADC_TOKEN",
)
resp = client.chat.completions.create(
model="openai/llama-2-70b-chat",
messages=[{"role": "user", "content": "Explain quantum computing"}],
)
print(resp.choices[0].message.content)
Custom Vertex AI Endpoint
For user-provided endpoint IDs:
import vertexai
from vertexai.preview import language_models
vertexai.init(project="PROJECT_ID", location="europe-west1")
endpoint = language_models.TextGenerationModel.from_pretrained(
"projects/PROJECT_ID/locations/europe-west1/endpoints/1234567890"
)
print(endpoint.predict("Explain quantum computing"))
Region Availability Probe
The skill executes this verification for Gemini models before code generation:
curl -sS -o /dev/null -w "%{http_code}\n" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/gemini-1.5-flash:generateContent" \
-d '{"contents":[{"role":"user","parts":[{"text":"hi"}]}]}'
A 200 response confirms availability; 404 triggers region selection guidance.
Key Source Files
The Agent Platform Inference skill implementation resides in these repository locations:
| File | Purpose |
|---|---|
skills/cloud/agent-platform-inference/SKILL.md |
Complete skill definition, workflow decision tree, safety tiers, and troubleshooting guidance |
skills/cloud/agent-platform-inference/scripts/gemini_genai_sdk.py |
Reference implementation for Gemini + GenAI SDK |
skills/cloud/agent-platform-inference/scripts/openmaas_openai_sdk.py |
Reference implementation for OpenMaaS + OpenAI SDK |
skills/cloud/agent-platform-inference/scripts/requirements.txt |
Minimal dependency specification |
skills/cloud/agent-platform-inference/scripts/verify_all.sh |
End-to-end environment verification |
Workflow Decision Tree
As implemented in SKILL.md lines 14-38, the skill guides users through:
- Model family identification — First-party, third-party, or custom
- SDK selection — GenAI SDK, Vertex AI SDK, or OpenAI SDK
- Region specification — With automatic availability probe for Gemini
- Error code troubleshooting — Built-in guidance for 429 (rate limit), 400 (invalid request), and 404 (model unavailable)
Summary
- Agent Platform Inference skills provide cloud-native, read-only code generation for Google Cloud Agent Platform inference
- Support spans Gemini first-party, OpenMaaS third-party, and custom endpoint model families
- Tier R confirmation ensures no unintended API execution
- Region probing prevents errors for Gemini's region-specific deployment model
- Source files in
google/skillsrepository provide complete reference implementations
Frequently Asked Questions
What SDKs does Agent Platform Inference support?
The skill supports three primary SDKs: Google's GenAI SDK (preferred for new Gemini development), the Vertex AI SDK (for legacy compatibility and custom endpoints), and the OpenAI SDK (for OpenMaaS third-party models). The skill automatically selects and configures the appropriate SDK based on the target model family and user preference.
Why is the skill read-only with Tier R confirmation?
All inference actions require interactive confirmation because they can incur costs and consume quota. The skill generates and validates code but never executes generate_content or similar calls without explicit user approval. This design prevents accidental model invocation while still providing immediately runnable output.
How does region availability checking work for Gemini?
For Gemini models, the skill performs a minimal probe request using curl to the target region's generateContent endpoint before generating code. If the probe returns HTTP 200, the skill proceeds with code generation; if 404, it guides the user to select an available region. This check is unnecessary for OpenMaaS models, which use global endpoints.
What dependencies are required to use the generated code?
Generated scripts require google-genai, google-cloud-aiplatform, or openai packages depending on the SDK selection. The skill checks for existing installations via scripts/requirements.txt and installs only missing packages. All scripts also require Application Default Credentials active via gcloud auth application-default login.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →