
Security News
PHP Foundation Says Chainguard Broke Security Embargo Ahead of Emergency Patches
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.
@google-cloud/agentplatform
Advanced tools
The Agent Platform SDK for Node.js lets you use the Gemini API to build AI-powered features and applications. Both TypeScript and JavaScript are supported.
For the latest list of available Gemini models on Agent Platform, see the Model information page in Agent Platform documentation.
Make sure your node.js version is 22 or above.
Create local authentication credentials for your user account:
gcloud auth application-default login
A list of accepted authentication options are listed in GoogleAuthOptions interface of google-auth-library-node.js GitHub repo.
Install the Agent Platform SDK for Node.js by running the following command:
npm install @google-cloud/agentplatform
First, import the Client class:
import { Client } from '@google-cloud/agentplatform';
Then instantiate a client:
const client: Client = new Client({
project: 'my-cloud-project',
location: 'my-cloud-location',
});
First define your prompt as a JS object or Prompt object. Then call createVersion.
const prompt = {
promptData: {
contents: [{ parts: [{ text: 'Hello, {name}! How are you?' }] }],
systemInstruction: { parts: [{ text: 'Please answer in a short sentence.' }] },
variables: [
{ name: { text: 'Alice' } },
],
model: 'gemini-2.5-flash',
},
};
const promptResource = await client.prompts.createVersion({
prompt: prompt,
});
Note that you can also use typed objects to define your prompt. Some of the types used to do this (Content, Part) are from the Gen AI SDK (@google/genai).
import { Prompt } from '@google-cloud/agentplatform';
import { Part, Content } from '@google/genai';
const prompt: Prompt = {
promptData: {
contents: [{ parts: [{ text: 'Hello, {name}! How are you?' } as Part] } as Content],
systemInstruction: { parts: [{ text: 'Please answer in a short sentence.' } as Part] } as Content,
variables: [
{ name: { text: 'Alice' } as Part },
],
model: 'gemini-2.5-flash',
},
};
const promptResource = await client.prompts.createVersion({
prompt: prompt,
});
Retrieve a prompt by calling get() with the promptId.
const dataset = (promptResource as any)._dataset;
const promptId = dataset?.name?.split('/').pop() || 'YOUR_PROMPT_ID';
const retrievedPrompt = await client.prompts.get({
promptId: promptId,
});
After creating or retrieving a prompt, you can call models.generateContent() with that prompt using the Gen AI SDK (@google/genai).
import { GoogleGenAI } from '@google/genai';
// Create a Client in the Gen AI SDK
const genaiClient = new GoogleGenAI({ vertexai: true, project: 'your-project', location: 'your-location' });
// Call generateContent() with the prompt
if (retrievedPrompt.promptData?.contents) {
const response = await genaiClient.models.generateContent({
model: retrievedPrompt.promptData.model || 'gemini-2.5-flash',
contents: retrievedPrompt.promptData.contents,
config: {
systemInstruction: retrievedPrompt.promptData.systemInstruction,
...(retrievedPrompt.promptData.generationConfig || {}),
},
});
console.log(response.text);
}
The contents of this repository are licensed under the Apache License, version 2.0.
FAQs
Vertex Generative AI client for Node.js
The npm package @google-cloud/agentplatform receives a total of 214 weekly downloads. As such, @google-cloud/agentplatform popularity was classified as not popular.
We found that @google-cloud/agentplatform demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.

Security News
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.

Security News
PHP releases emergency patches for two critical RCE vulnerabilities as agencies urge organizations to take unpatched sites offline.

Threat Research
/Security News
A supply chain attack compromised LiteLLM 1.107.0 on PyPI and Docker, spreading malware that steals cloud credentials, developer secrets, and AI provider keys.