במדריך הזה מוסבר איך ליצור, לאחזר, להציג, לעדכן ולמחוק משאבי סוכנים מותאמים אישית שמשתמשים ב-Managed Agents API בפלטפורמת הסוכנים, ואיך להגדיר את סביבת הסוכן, את הכלים של שרת Model Context Protocol (MCP) ואת הכישורים.
לפני שמתחילים
לפני שמגדירים את הסוכנים, צריך להגדיר את הסביבה:
- נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Platform API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Agent Platform User (
roles/aiplatform.user) or Agent Platform Administrator (roles/aiplatform.admin)Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Platform API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Agent Platform User (
roles/aiplatform.user) or Agent Platform Administrator (roles/aiplatform.admin)Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
אם אתם מתכננים להשתמש Google Cloud בכלים של Model Context Protocol (MCP) עם הסוכן שלכם, אתם צריכים להקצות את התפקיד 'משתמש בכלי MCP' (
roles/mcp.toolUser) גם לחשבון המשתמש וגם לחשבון השירות המשויך.
יצירת סוכן
כדי ליצור סוכן חדש בהתאמה אישית, משתמשים בשיטה CreateAgent. זו פעולה ממושכת.
הסוכן הבסיסי
base_agent הוא כלי התזמור המרכזי שמספק לסוכן יכולות חשיבה רציונלית וגישה לסביבת ההרצה.
הוא יכול להוסיף מיומנויות וספריות לסביבה, ויש לו גישה לכלים בצד השרת לביצוע קוד, לפעולות במערכת הקבצים ולחיפוש עם ביסוס.
כשיוצרים סוכן, אפשר להזין רק ערך אחד במאפיין base_agent:
antigravity-preview-05-2026.
יצירת סוכן בסיסי
כדי ליצור סוכן בסיסי עם כלי ברירת מחדל ויעד להרכבת Google Cloud Storage, שולחים בקשת POST:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global. AGENT_ID: המזהה הייחודי המותאם אישית של הסוכן החדש. מזהי סוכן מותאמים אישית צריכים לעמוד במגבלות הבאות:
- האורך צריך להיות בין 1 ל-63 תווים.
- השם חייב להכיל רק אותיות קטנות, מספרים ומקפים.
- השם חייב להתחיל באות ולהסתיים באות או במספר.
BASE_AGENT: השם של סוכן הבסיס שרוצים להרחיב. שימוש ב-
antigravity-preview-05-2026.AGENT_DESCRIPTION: סיכום קצר של היקף הסוכן.
INSTRUCTIONS: הוראות מערכת או פרסונה להגדרה בסוכן.
GCS_BUCKET: קטע נתיב התיקייה של קטגוריית Google Cloud Storage המותקנת (לדוגמה,
gs://cymbal-bucket-name). הערה: כדי להתקין קטגוריה מפרויקט אחר, צריך להעניק לחשבון השירות של הפרויקטreadו-writeגישה לקטגוריה.network: מטעמי אבטחה, הגישה לרשת בסביבה מושבתת. כדי להפעיל את הגישה, צריך לציין
allowlist. שימוש ב-*כדומיין ב-allowlistמאפשר חיבורים לכל הדומיינים ומספק גישה בלתי מוגבלת לרשת.
שיטת ה-HTTP וכתובת ה-URL
POST https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents
תוכן בקשת JSON
{
"id": "AGENT_ID",
"base_agent": "BASE_AGENT",
"description": "AGENT_DESCRIPTION",
"system_instruction": "INSTRUCTIONS",
"tools": [
{"type": "code_execution"},
{"type": "filesystem"},
{"type": "google_search"},
{"type": "url_context"}
],
"base_environment": {
"type": "remote",
"sources": [
{
"type": "gcs",
"source": "GCS_BUCKET",
"target": "/.agent"
}
],
"network": {
"allowlist": [
{ "domain": "*" }
]
}
}
}
פקודה curl
curl -X POST "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{
"id": "AGENT_ID",
"base_agent": "antigravity-preview-05-2026",
"description": "AGENT_DESCRIPTION",
"system_instruction": "INSTRUCTIONS",
"tools": [
{"type": "code_execution"},
{"type": "filesystem"},
{"type": "google_search"},
{"type": "url_context"}
],
"base_environment": {
"type": "remote",
"sources": [
{
"type": "gcs",
"source": "GCS_BUCKET",
"target": "/.agent"
}
],
"network": {
"allowlist": [
{ "domain": "*" }
]
}
}
}'
דוגמה לתשובה
{
"name": "projects/1234567890/locations/global/agents/my-first-agent/operations/234567890123",
"metadata": {
"@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.CreateAgentOperationMetadata",
"genericMetadata": {
"createTime": "2026-05-12T23:50:16.933752Z",
"updateTime": "2026-05-12T23:50:16.933752Z"
}
}
}
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai
client = genai.Client(
vertexai=True,
project="PROJECT_ID",
location="global",
)
agent = client.agents.create(
id="AGENT_ID",
base_agent="antigravity-preview-05-2026",
description="AGENT_DESCRIPTION",
system_instruction="INSTRUCTIONS",
tools=[
{"type": "code_execution"},
{"type": "google_search"},
{"type": "url_context"},
],
base_environment={
"type": "remote",
"sources": [
{
"type": "gcs",
"source": "GCS_BUCKET",
"target": "/.agent",
}
],
"network": {
"allowlist": [{"domain": "*"}]
},
},
)
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({
vertexai: true,
project: "PROJECT_ID",
location: "global",
});
const agent = await client.agents.create({
id: "AGENT_ID",
base_agent: "antigravity-preview-05-2026",
description: "AGENT_DESCRIPTION",
system_instruction: "INSTRUCTIONS",
tools: [
{ type: "code_execution" },
{ type: "google_search" },
{ type: "url_context" },
],
base_environment: {
type: "remote",
sources: [
{
type: "gcs",
source: "GCS_BUCKET",
target: "/.agent",
},
],
network: {
allowlist: [{ domain: "*" }],
},
},
});
יצירת סוכן באמצעות כלים של Google
כדי ליצור סוכן באמצעות כלים של Google (כמו Grounding עם חיפוש Google והקשר של כתובת URL), מוסיפים את הכלים האלה לרשימה tools בהגדרות הסוכן:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global. AGENT_ID: המזהה הייחודי המותאם אישית של הסוכן החדש. מזהי סוכן מותאמים אישית צריכים לעמוד במגבלות הבאות:
- האורך צריך להיות בין 1 ל-63 תווים.
- השם חייב להכיל רק אותיות קטנות, מספרים ומקפים.
- השם חייב להתחיל באות ולהסתיים באות או במספר.
AGENT_DESCRIPTION: סיכום קצר של היקף הסוכן.
תוכן בקשת JSON
{
"id": "AGENT_ID",
"base_agent": "antigravity-preview-05-2026",
"description": "AGENT_DESCRIPTION",
"tools": [
{
"type": "google_search"
},
{
"type": "url_context"
}
],
"base_environment": {
"type": "remote",
"network": {
"allowlist": [
{ "domain": "*" }
]
}
}
}
פקודה curl
curl -X POST "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{
"id": "AGENT_ID",
"base_agent": "antigravity-preview-05-2026",
"description": "AGENT_DESCRIPTION",
"tools": [
{
"type": "google_search"
},
{
"type": "url_context"
}
],
"base_environment": {
"type": "remote",
"network": {
"allowlist": [
{ "domain": "*" }
]
}
}
}'
יצירת סוכן באמצעות הגדרות MCP
אתם יכולים ליצור סוכן עם כלים מוגדרים מראש של שרת MCP באמצעות Managed Agents API ב-Agent Platform.
לפני שמתחילים
לפני שיוצרים סוכן עם כלים מוגדרים מראש של שרת MCP, צריך לבצע את הפעולות הבאות:
מקצים לחשבון המשתמש ולחשבון השירות המשויך את התפקיד משתמש בכלי MCP (
roles/mcp.toolUser) בניהול זהויות והרשאות גישה (IAM).מוודאים ששרתי ה-MCP בהגדרה שלכם מתקשרים באמצעות
HTTP POSTרגיל לרישום ולהפעלה של כלים. ה-API של סוכנים מנוהלים ב-Agent Platform דורש ששרתי MCP מרוחקים יהיו שרתי HTTP שניתן להזרים מהם נתונים. בשרתי ה-MCP צריך להטמיע את העברת הנתונים ב-HTTP של MCP, כאשרtools/listו-tools/callנשלחים כ-JSON-RPC דרךHTTP POST.אין תמיכה בהעברה של HTTP+SSE עם שתי נקודות קצה שהוצאה משימוש (סטרימינג נפרד של
GET /sseלטווח ארוך).
איך נותנים הרשאה לפלטפורמות MCP שמתארחות ב-Google
אם אתם משתמשים בטוקן מסוג bearer להרשאה של שרתי MCP שמתארחים ב-Google (כמו BigQuery), צריך לבצע את השלבים הבאים:
- הוספת היקפי הרשאות של OAuth: מוסיפים את היקפי ההרשאות הנדרשים של OAuth 2.0 לאסימון האימות. לדוגמה, כדי להשתמש ב-BigQuery MCP, צריך לכלול את היקפי BigQuery הרלוונטיים בבקשה.
- אימות הגישה: כדי לבדוק אם אפשר לגשת לשרת ה-MCP עם ההיקפים החדשים שהגדרתם, בודקים את תהליך ההרשאה ב-OAuth Playground.
- שימוש בכותרות: בפרויקטים של Google MCP כמו BigQuery, צריך לכלול את הכותרת
X-Goog-User-Projectשמוגדרת לשם הפרויקט במפהheaders.
לדוגמה, גוף הבקשה בפורמט JSON שמשמש ליצירת סוכן שמשתמש ב-BigQuery MCP ייראה בערך כך:
{
"name": "projects/<projectname>/locations/global/agents/data-analyst",
"id": "data-analyst",
"system_instruction": "You are a data analyst. Use the provided tools and data to perform analysis.",
"tools": [
{ "type": "code_execution" },
{ "type": "filesystem" },
{ "type": "google_search" },
{ "type": "url_context" },
{
"type": "mcp_server",
"name": "bigquery-mcp",
"url": "https://bigquery.googleapis.com/mcp",
"headers": {
"Authorization": "Bearer ya29.a0AQyyyy",
"X-Goog-User-Project": "project-nameyyyy"
}
}
],
"base_environment": {
"type": "remote",
"sources": [
{
"type": "gcs",
"source": "gs://agents-1",
"target": "/.agent/agents-1"
}
],
"network": {
"allowlist": [ { "domain": "*" } ]
}
},
"base_agent": "antigravity-preview-05-2026",
"object": "agent"
}
יצירת הסוכן
כדי ליצור סוכן עם כלים מוגדרים מראש של שרת MCP, מוסיפים פרטים בקטע tools:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global. AGENT_ID: המזהה הייחודי המותאם אישית של הסוכן החדש. מזהי סוכן מותאמים אישית צריכים לעמוד במגבלות הבאות:
- האורך צריך להיות בין 1 ל-63 תווים.
- השם חייב להכיל רק אותיות קטנות, מספרים ומקפים.
- השם חייב להתחיל באות ולהסתיים באות או במספר.
AGENT_DESCRIPTION: סיכום קצר של היקף הסוכן.
MCP_SERVER_NAME: שם תיאורי לכלי ה-MCP.
MCP_SERVER_URL: כתובת ה-URL של שער ה-HTTP המרוחק של שרת ה-MCP.
MCP_HEADER_KEY: אופציונלי. שם הכותרת לאימות (לדוגמה,
Authorization).MCP_HEADER_VALUE: אופציונלי. טוקן למוכ"ז לאימות (לדוגמה,
Bearer <token>).
תוכן בקשת JSON
{
"id": "AGENT_ID",
"base_agent": "antigravity-preview-05-2026",
"description": "AGENT_DESCRIPTION",
"tools": [
{
"type": "mcp_server",
"name": "MCP_SERVER_NAME",
"url": "MCP_SERVER_URL",
"headers": {
"MCP_HEADER_KEY": "MCP_HEADER_VALUE"
}
}
]
}
פקודה curl
curl -X POST "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{
"id": "AGENT_ID",
"base_agent": "antigravity-preview-05-2026",
"description": "AGENT_DESCRIPTION",
"tools": [
{
"type": "mcp_server",
"name": "MCP_SERVER_NAME",
"url": "MCP_SERVER_URL",
"headers": {
"MCP_HEADER_KEY": "MCP_HEADER_VALUE"
}
}
]
}'
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai
client = genai.Client(
vertexai=True,
project="PROJECT_ID",
location="global",
)
agent = client.agents.create(
id="AGENT_ID",
base_agent="antigravity-preview-05-2026",
description="AGENT_DESCRIPTION",
tools=[
{
"type": "mcp_server",
"name": "MCP_SERVER_NAME",
"url": "MCP_SERVER_URL",
"headers": {
"MCP_HEADER_KEY": "MCP_HEADER_VALUE"
},
}
],
)
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({
vertexai: true,
project: "PROJECT_ID",
location: "global",
});
const agent = await client.agents.create({
id: "AGENT_ID",
base_agent: "antigravity-preview-05-2026",
description: "AGENT_DESCRIPTION",
tools: [
{
type: "mcp_server",
name: "MCP_SERVER_NAME",
url: "MCP_SERVER_URL",
headers: {
"MCP_HEADER_KEY": "MCP_HEADER_VALUE",
},
},
],
});
צירוף מיומנויות לסוכן
כדי לטעון מיומנות לשימוש חוזר ישירות כשיוצרים את הסוכן, צריך להוסיף אותה בתוך base_environment.sources.
אפשר לצרף מיומנויות באחת מהשיטות הבאות:
מאגר המיומנויות: צירוף מיומנות שרשומה בפרויקט במאגר המיומנויות.
Google Cloud Storage: צירוף מיומנויות מותאמות אישית ישירות מקטגוריה של Cloud Storage.
השיטה המומלצת היא להוסיף את הכישורים לתיקייה
/.agent/skillsבסביבה, כדי שהסוכן יוכל למצוא אותם בקלות יותר.
מיומנויות CLI
מפתחים יכולים גם להתקין מיומנויות מיוחדות ב-CLI לפי בחירתם כדי לנהל סוכנים ואינטראקציות באופן פרוגרמטי:
צירוף מיומנות ממאגר המיומנויות
כדי לטעון מיומנות לשימוש חוזר ישירות ממאגר המיומנויות כשיוצרים את הסוכן:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
-
PROJECT_ID: מזהה הפרויקט ב- Google Cloud . -
LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזורglobal. -
AGENT_ID: המזהה הייחודי המותאם אישית של הסוכן החדש. מזהי סוכנים מותאמים אישית צריכים לעמוד במגבלות הבאות:- האורך צריך להיות בין 1 ל-63 תווים.
- השם חייב להכיל רק אותיות קטנות, מספרים ומקפים.
- השם חייב להתחיל באות ולהסתיים באות או במספר.
-
SKILL_RESOURCE_NAME: נתיב המשאב של היכולת או רשימת היכולות שרוצים להפעיל. אפשר לציין אחד מהפורמטים הבאים:-
מיומנות (גרסת ברירת מחדל):
projects/{projectID}/locations/{location}/skills/{skillName} -
גרסה ספציפית:
projects/{projectID}/locations/{location}/skills/{skillName}/skill_versions/{skill_version} -
רשימת מיומנויות:
projects/{projectID}/locations/{location}/skills. הפעולה הזו תעלה עד 100 מיומנויות מהמקור שצויןproject/locationלסביבת ארגז החול.
-
מיומנות (גרסת ברירת מחדל):
תוכן בקשת JSON
{ "id": "AGENT_ID", "base_agent": "antigravity-preview-05-2026", "base_environment": { "type": "remote", "sources": [ { "type": "skill_registry", "source": "SKILL_RESOURCE_NAME", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }
פקודה curl
curl -X POST "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -d '{ "id": "AGENT_ID", "base_agent": "antigravity-preview-05-2026", "base_environment": { "type": "remote", "sources": [ { "type": "skill_registry", "source": "SKILL_RESOURCE_NAME", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }'
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai client = genai.Client( vertexai=True, project="PROJECT_ID", location="global", ) agent = client.agents.create( id="AGENT_ID", base_agent="antigravity-preview-05-2026", base_environment={ "type": "remote", "sources": [ { "type": "skill_registry", "source": "SKILL_RESOURCE_NAME", "target": "./skills", } ], "network": { "allowlist": [{"domain": "*"}] }, }, )
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai"; const client = new GoogleGenAI({ vertexai: true, project: "PROJECT_ID", location: "global", }); const agent = await client.agents.create({ id: "AGENT_ID", base_agent: "antigravity-preview-05-2026", base_environment: { type: "remote", sources: [ { type: "skill_registry", source: "SKILL_RESOURCE_NAME", target: "./skills", }, ], network: { allowlist: [{ domain: "*" }], }, }, });
צירוף מיומנות מ-Google Cloud Storage
אפשר גם לצרף מיומנויות מותאמות אישית ישירות מקטגוריה של Cloud Storage ב-Google Cloud Storage כשיוצרים את הסוכן.
כשמטמיעים מיומנויות מ-Cloud Storage, חשוב לשים לב לדרישות הבאות:
- דרישות להעלאה: צריך להעלות את כל תיקיית המיומנות לקטגוריה.
- אין אימות תוכן: ה-backend לא מאמת את תוכן התיקייה לפני ההרכבה. הוא מתנהג כמו העלאה של תיקייה רגילה.
- מגבלות גודל: כל הקבצים המצורפים כפופים למגבלות הזיכרון של סביבת הארגז (עד 4GB של RAM בסך הכול).
- שיטות מומלצות: כדי להשיג את האיכות הכי גבוהה של מיומנויות, צריך לארגן ולהכין את הקבצים בתיקיית המיומנויות לפי המוסכמות שמתוארות באתר agentskills.io/home.
כדי לצרף מיומנות מ-Google Cloud Storage כשיוצרים את הסוכן:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
-
PROJECT_ID: מזהה הפרויקט ב- Google Cloud . -
LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזורglobal. -
AGENT_ID: המזהה הייחודי המותאם אישית של הסוכן החדש. מזהי סוכנים מותאמים אישית צריכים לעמוד במגבלות הבאות:- האורך צריך להיות בין 1 ל-63 תווים.
- השם חייב להכיל רק אותיות קטנות, מספרים ומקפים.
- השם חייב להתחיל באות ולהסתיים באות או במספר.
-
GCS_SOURCE_PATH: הנתיב לקטגוריה ב-Google Cloud Storage שמכילה את תיקיית המיומנות (לדוגמה,gs://cymbal-bucket-name/my-skill-folder).
תוכן בקשת JSON
{ "id": "AGENT_ID", "base_agent": "antigravity-preview-05-2026", "base_environment": { "type": "remote", "sources": [ { "type": "gcs", "source": "GCS_SOURCE_PATH", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }
פקודה curl
curl -X POST "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -d '{ "id": "AGENT_ID", "base_agent": "antigravity-preview-05-2026", "base_environment": { "type": "remote", "sources": [ { "type": "gcs", "source": "GCS_SOURCE_PATH", "target": "./skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }'
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai client = genai.Client( vertexai=True, project="PROJECT_ID", location="global", ) agent = client.agents.create( id="AGENT_ID", base_agent="antigravity-preview-05-2026", base_environment={ "type": "remote", "sources": [ { "type": "gcs", "source": "GCS_SOURCE_PATH", "target": "./skills", } ], "network": { "allowlist": [{"domain": "*"}] }, }, )
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai"; const client = new GoogleGenAI({ vertexai: true, project: "PROJECT_ID", location: "global", }); const agent = await client.agents.create({ id: "AGENT_ID", base_agent: "antigravity-preview-05-2026", base_environment: { type: "remote", sources: [ { type: "gcs", source: "GCS_SOURCE_PATH", target: "./skills", }, ], network: { allowlist: [{ domain: "*" }], }, }, });
הצגת רשימה של סוכנים
כדי להציג רשימה של כל הסוכנים השמורים בפרויקט, שולחים בקשת GET. אתם יכולים להשתמש באפשרות 'חלוקה לדפים' כדי לקבוע את מספר התוצאות בכל דף.
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של סוכני הנדל"ן. יש תמיכה רק באזור
global. - PAGE_SIZE: אופציונלי. מספר הסוכנים המקסימלי שיוחזר בכל דף. ערך ברירת המחדל הוא 10, והערך המקסימלי הוא 100.
- PAGE_TOKEN: אופציונלי. טוקן של דף שהתקבל מתגובה קודמת של
ListAgents. צריך להזין את הטוקן הזה כדי לאחזר את הדף הבא של התוצאות.
אם מספר הסוכנים שצריך להחזיר גדול מ-PAGE_SIZE, התשובה ListAgents כוללת את השדה nextPageToken. כדי לאחזר את הדף הבא של הסוכנים, מעבירים את הערך של nextPageToken כפרמטר PAGE_TOKEN בבקשת ListAgents הבאה. חוזרים על התהליך הזה עד שהשדה nextPageToken לא מוחזר יותר בתשובה.
שיטת ה-HTTP וכתובת ה-URL
GET https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents?page_size=PAGE_SIZE&page_token=PAGE_TOKEN
פקודה curl
curl -X GET "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents?page_size=PAGE_SIZE&page_token=PAGE_TOKEN" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)"
דוגמה לתשובה
{
"agents": [
{
"name": "projects/1234567890/locations/global/agents/my-first-agent",
"id": "my-first-agent",
"created": "2026-05-12T23:50:16.933Z",
"updated": "2026-05-12T23:50:21.159Z",
"systemInstruction": "You are a helpful assistant to user."
}
],
"nextPageToken": "ABCDEFGHIJKLMNOPQRSTUVWXYZ=="
}
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai
client = genai.Client(
vertexai=True,
project="PROJECT_ID",
location="global",
)
response = client.agents.list()
for agent in response.agents:
print(agent)
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({
vertexai: true,
project: "PROJECT_ID",
location: "global",
});
const response = await client.agents.list();
if (response.agents) {
for (const agent of response.agents) {
console.log(agent);
}
}
קבלת נציג
כדי לאחזר את ההגדרה המלאה של סוכן מסוים, משתמשים בבקשת GET.
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global.AGENT_ID: המזהה הייחודי של הגדרת הסוכן המותאם אישית שאתם מבקשים.
שיטת ה-HTTP וכתובת ה-URL
GET https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID
פקודה curl
curl -X GET "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)"
דוגמה לתשובה
{
"name": "projects/vertex-agent-fishfood/locations/global/agents/my-first-agent",
"id": "my-first-agent",
"created": "2026-05-12T23:50:16.933Z",
"updated": "2026-05-12T23:50:21.159Z",
"systemInstruction": "You are a helpful assistant to user.",
"tools": [
{"type": "code_execution"},
{"type": "filesystem"},
{"type": "google_search"},
{"type": "url_context"}
],
"description": "A demo agent showcasing Environment and Skills use case.",
"baseEnvironment": {
"type": "remote",
"sources": [
{
"type": "gcs",
"source": "gs://agents-api-sample-skills",
"target": "/.agent"
}
],
"network": {
"allowlist": [
{"domain": "*"}
]
}
},
"baseAgent": "antigravity-preview-05-2026",
"object": "agent"
}
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai
client = genai.Client(
vertexai=True,
project="PROJECT_ID",
location="global",
)
agent = client.agents.get(id="AGENT_ID")
print(agent)
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({
vertexai: true,
project: "PROJECT_ID",
location: "global",
});
const agent = await client.agents.get("AGENT_ID");
console.log(agent);
עדכון סוכן
כדי לעדכן את ההגדרה של סוכן קיים, שולחים בקשת PATCH. אי אפשר לשנות את המזהה של הסוכן, אבל אפשר לשנות פרמטרים כמו הוראות, כלים ומשתני סביבה. משתמשים בפרמטר השאילתה update_mask כדי לציין בדיוק אילו שדות לעדכן. כך מוודאים שהשינוי ישפיע רק על השדות שרוצים לשנות, וששאר ההגדרות יישארו ללא שינוי.
עדכון סוכן בסיסי
כדי לעדכן את הוראות המערכת של סוכן, שולחים בקשת PATCH עם
update_mask=system_instruction:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global. - AGENT_ID: תצורת סוכן היעד לעדכון הפאצ'.
- NEW_INSTRUCTIONS: המבנה או התיאור המעודכנים של ההוראות שצריך להחליף.
שיטת ה-HTTP וכתובת ה-URL
PATCH https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID?update_mask=system_instruction
תוכן בקשת JSON
{
"name": "AGENT_ID",
"system_instruction": "NEW_INSTRUCTIONS"
}
פקודה curl
curl -X PATCH "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID?update_mask=system_instruction" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{
"name": "AGENT_ID",
"system_instruction": "NEW_INSTRUCTIONS"
}'
Python
JavaScript
עדכון סוכן באמצעות כלים של Google לניהול נתונים ישירים
כדי לעדכן סוכן כדי להפעיל כלים של Google צד ראשון (1P) (כמו עיגון באמצעות חיפוש Google והקשר של כתובת URL), שולחים PATCH בקשה עם update_mask=tools:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global. - AGENT_ID: מזהה סוכן היעד.
תוכן בקשת JSON
{
"name": "AGENT_ID",
"tools": [
{
"type": "google_search"
},
{
"type": "url_context"
}
]
}
פקודה curl
curl -X PATCH "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID?update_mask=tools" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{
"name": "AGENT_ID",
"tools": [
{
"type": "google_search"
},
{
"type": "url_context"
}
]
}'
עדכון סוכן באמצעות הגדרות MCP
כדי לשנות את כלי ה-MCP שמצורפים לסוכן, שולחים בקשת PATCH עם update_mask=tools:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזור
global. - AGENT_ID: מזהה סוכן היעד.
- NEW_MCP_SERVER_NAME: התווית המעודכנת של כלי ה-MCP.
- NEW_MCP_SERVER_URL: פרמטר חדש של נקודת קצה של כתובת URL של השרת.
- NEW_MCP_HEADER_KEY: אופציונלי. שם הכותרת לאימות (לדוגמה,
Authorization). - NEW_MCP_HEADER_VALUE: אופציונלי. טוקן bearer לאימות (לדוגמה,
Bearer <token>).
תוכן בקשת JSON
{
"name": "AGENT_ID",
"tools": [
{
"type": "mcp_server",
"name": "NEW_MCP_SERVER_NAME",
"url": "NEW_MCP_SERVER_URL",
"headers": {
"NEW_MCP_HEADER_KEY": "NEW_MCP_HEADER_VALUE"
}
}
]
}
פקודה curl
curl -X PATCH "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID?update_mask=tools" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-d '{
"name": "AGENT_ID",
"tools": [
{
"type": "mcp_server",
"name": "NEW_MCP_SERVER_NAME",
"url": "NEW_MCP_SERVER_URL",
"headers": {
"NEW_MCP_HEADER_KEY": "NEW_MCP_HEADER_VALUE"
}
}
]
}'
Python
JavaScript
צירוף מיומנויות לסוכן
כדי לצרף או לשנות מיומנויות ב-base_environment.sources במהלך עדכון של נציג, שולחים בקשת PATCH באמצעות update_mask=base_environment.
אפשר לצרף מיומנויות באחת מהשיטות הבאות:
מאגר המיומנויות: צירוף מיומנות שרשומה בפרויקט במאגר המיומנויות.
Google Cloud Storage: צירוף מיומנויות מותאמות אישית ישירות מקטגוריה של Cloud Storage.
צירוף מיומנות ממאגר המיומנויות
כדי לצרף מיומנות שרשומה במאגר המיומנויות:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
-
PROJECT_ID: מזהה הפרויקט ב- Google Cloud . -
LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזורglobal. -
AGENT_ID: מזהה סוכן היעד. -
NEW_SKILL_RESOURCE_NAME: נתיב המשאב של המיומנות או רשימת המיומנויות שרוצים להפעיל. אפשר לציין אחד מהפורמטים הבאים:- מיומנות (גרסת ברירת מחדל):
projects/{projectID}/locations/{location}/skills/{skillName} - גרסת היכולת (הצמדה לגרסה ספציפית):
projects/{projectID}/locations/{location}/skills/{skillName}/skill_versions/{skill_version} - ListSkills (הצגת כל הכישורים):
projects/{projectID}/locations/{location}/skills. הפעולה הזו מטמיעה עד 100 מיומנויות בפרויקט או במיקום בסביבת ארגז החול.
nameשלNEW_SKILL_RESOURCE_NAMEזמין במאמר רשימת כישורים. - מיומנות (גרסת ברירת מחדל):
תוכן בקשת JSON
{ "name": "AGENT_ID", "base_environment": { "type": "remote", "sources": [ { "type": "skill_registry", "source": "NEW_SKILL_RESOURCE_NAME", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }
פקודה curl
curl -X PATCH "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID?update_mask=base_environment" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -d '{ "name": "AGENT_ID", "base_environment": { "type": "remote", "sources": [ { "type": "skill_registry", "source": "NEW_SKILL_RESOURCE_NAME", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }'
Python
JavaScript
צירוף מיומנות מ-Google Cloud Storage
אפשר גם לצרף מיומנויות מותאמות אישית ישירות מקטגוריה של Cloud Storage ב-Google Cloud Storage כשיוצרים את הסוכן.
כשמטמיעים מיומנויות מ-Cloud Storage, חשוב לשים לב לדרישות הבאות:
- דרישות להעלאה: צריך להעלות את כל תיקיית המיומנות לקטגוריה.
- אין אימות תוכן: ה-backend לא מאמת את תוכן התיקייה לפני ההרכבה. הוא מתנהג כמו העלאה של תיקייה רגילה.
- מגבלות גודל: כל הקבצים המצורפים כפופים למגבלות הזיכרון של סביבת הארגז (עד 4GB של RAM בסך הכול).
- שיטות מומלצות: כדי להשיג את האיכות הכי גבוהה של מיומנויות, צריך לארגן ולהכין את הקבצים בתיקיית המיומנויות לפי המוסכמות שמתוארות באתר agentskills.io/home.
כדי לצרף מיומנות מ-Google Cloud Storage:
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
-
PROJECT_ID: מזהה הפרויקט ב- Google Cloud . -
LOCATION: המיקום האזורי של הסוכן. יש תמיכה רק באזורglobal. -
AGENT_ID: מזהה סוכן היעד. -
NEW_GCS_SOURCE_PATH: הנתיב לקטגוריה ב-Google Cloud Storage שמכילה את תיקיית המיומנות (לדוגמה,gs://cymbal-bucket-name/my-skill-folder).
תוכן בקשת JSON
{ "name": "AGENT_ID", "base_environment": { "type": "remote", "sources": [ { "type": "gcs", "source": "NEW_GCS_SOURCE_PATH", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }
פקודה curl
curl -X PATCH "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID?update_mask=base_environment" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -d '{ "name": "AGENT_ID", "base_environment": { "type": "remote", "sources": [ { "type": "gcs", "source": "NEW_GCS_SOURCE_PATH", "target": "/.agent/skills" } ], "network": { "allowlist": [ { "domain": "*" } ] } } }'
Python
JavaScript
מחיקת נציג
כדי למחוק הגדרה ספציפית של סוכן בהתאמה אישית, שולחים בקשת DELETE. זו פעולה ממושכת שמוחקת את ההגדרה באופן סופי.
כשמוחקים סוכן, צריך לספק את כל המידע הנדרש בכתובת ה-URL ולא לכלול גוף בקשת JSON.
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור של הסוכן. יש תמיכה רק באזור
global. - AGENT_ID: המזהה של הסוכן שרוצים למחוק.
שיטת ה-HTTP וכתובת ה-URL
DELETE https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID
פקודה curl
curl -X DELETE "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/agents/AGENT_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)"
דוגמה לתשובה
{
"name": "projects/1234567890/locations/global/operations/234567890123",
"metadata": {
"@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.DeleteOperationMetadata",
"genericMetadata": {
"createTime": "2026-05-13T02:15:45.936287Z",
"updateTime": "2026-05-13T02:15:45.936287Z"
}
},
"done": true,
"response": {
"@type": "type.googleapis.com/google.protobuf.Empty"
}
}
Python
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
from google import genai
client = genai.Client(
vertexai=True,
project="PROJECT_ID",
location="global",
)
response = client.agents.delete(id="AGENT_ID")
print(response)
JavaScript
לפני שמריצים את הקוד הזה, צריך להגדיר את המשתנים שמתוארים בכרטיסייה REST.
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({
vertexai: true,
project: "PROJECT_ID",
location: "global",
});
const response = await client.agents.delete("AGENT_ID");
console.log(response);
קבלת פרטים על פעולה ממושכת
פעולות כמו CreateAgent, UpdateAgent ו-DeleteAgent הן אסינכרוניות. התגובה הראשונית של ה-API מחזירה את השדה name שמכיל את מזהה הפעולה. אפשר להשתמש ב-GetOperation במזהה הזה כדי לבדוק את ההתקדמות.
REST
בקשת משתנים
לפני שקוראים ל-API, מחליפים את הערכים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: המיקום האזורי של הפעולה. יש תמיכה רק באזור
global. - OPERATION_ID: מזהה הפעולה שחולץ מהשדה
nameבתגובה הראשונית של LRO.
שיטת ה-HTTP וכתובת ה-URL
GET https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/operations/OPERATION_ID
פקודה curl
curl -X GET "https://aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/operations/OPERATION_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)"
Python
JavaScript
הגדרת גישה לרשת
כברירת מחדל, ארגז החול משבית את הגישה לרשת כשיוצרים סוכנים באמצעות Agents API. כדי לאפשר גישה לא מוגבלת, משתמשים ב-*.
לדוגמה, שימוש ב-* ב-allowlist כמו בדוגמה הבאה נותן גישה לכל הדומיינים:
"base_environment": {
"type": "remote",
"sources": [
{
"type": "skill_registry",
"source": "SKILL_RESOURCE_NAME",
"target": "./skills"
}
],
"network": {
"allowlist": [{"domain": "*"}]
}
}
המאמרים הבאים
אינטראקציה עם סוכנים
במאמר הזה מוסבר איך ליצור אינטראקציה עם סוכנים בזמן ריצה, לנהל את מצב הסשן ולשנות הגדרות באופן דינמי.