סוכנים מנוהלים ב-Gemini API מאפשרים להרחיב את סוכן Antigravity עם הוראות, מיומנויות ונתונים משלכם. אתם יכולים להתאים אישית את הסוכן בתוך השיחה במועד האינטראקציה, או לשמור את ההגדרה כסוכן מנוהל שמופעל באמצעות מזהה.
התאמה אישית של סוכן Antigravity
הדרך הכי מהירה ליצור סוכן בהתאמה אישית היא להעביר את ההגדרה שלכם בשורה בזמן יצירת אינטראקציה חדשה, בלי שנדרש שלב הרשמה. יש שלוש דרכים להרחיב את יכולות הסוכן:
- הוראות למערכת: העברת טקסט מוטבע באמצעות
system_instructionלהתנהגות הצורה. - כלים: אפשר לבטל את ברירת המחדל של הכלים (הפעלת קוד, חיפוש, הקשר של כתובת URL).
- קבצים ומיומנויות: טעינת קבצים כמו
AGENTS.mdו-SKILL.mdבסביבה.
דוגמה להעברת כל שלושת הפרמטרים בתוך התג:
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="Analyze the Q1 revenue data and create a slide deck.",
system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",
environment={
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report.",
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results.",
},
],
},
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Analyze the Q1 revenue data and create a slide deck.",
system_instruction: "You are a data analyst. Always include visualizations and export results as PDF.",
environment: {
type: "remote",
sources: [
{
type: "inline",
target: ".agents/AGENTS.md",
content: "Always use matplotlib for charts. Include a summary table in every report.",
},
{
type: "inline",
target: ".agents/skills/slide-maker/SKILL.md",
content: "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results.",
},
],
},
}, { timeout: 300000 });
console.log(interaction.output_text);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Analyze the Q1 revenue data and create a slide deck.",
"system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",
"environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report."
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results."
}
]
}
}'
הכול מוגדר במועד האינטראקציה. אין צורך לרשום שום דבר קודם. ה-Antigravity agent harness מספק את זמן הריצה (הרצת קוד, ניהול קבצים, גישה לאינטרנט) ושכבות ההגדרה שלכם מעל.
כלים והוראות למערכת
אפשר להתאים אישית את ההתנהגות והיכולות של הסוכן לאינטראקציה ספציפית באמצעות הפרמטרים system_instruction ו-tools.
- הוראות למערכת: משתמשים בפרמטר
system_instructionכדי להעביר טקסט מוטבע שמשפיע על התנהגות הסוכן. האפשרות הזו מתאימה לשינויים קלים שרוצים לבצע בכל שיחה. המאפייניםsystem_instructionו-AGENTS.mdמצטברים, כלומר שניהם חלים אם הם קיימים. - כלים: כברירת מחדל, לסוכן Antigravity יש גישה אל
code_execution,google_searchו-url_context. אפשר לשנות את הרשימה הזו על ידי העברת הפרמטרtoolsבמועד האינטראקציה. פרטים מלאים על הכלים הזמינים ועל אופן השימוש בהם מופיעים במאמר Antigravity Agent: Supported tools.
התאמה אישית מבוססת-קובץ
מבנה ספריית הסוכנים
אפשר להעביר את ההגדרה בשורה, אבל מומלץ לארגן את הקבצים של הסוכן בספרייה מובנית. כך קל יותר לנהל את הקבצים, לשלוט בגרסאות שלהם ולטעון אותם בסביבת הסוכן.
ספריית פרויקט טיפוסית של סוכן נראית כך:
my-agent/
├── AGENTS.md # Instructions on how the agent should operate
├── skills/ # Custom skills (subfolders and SKILL.md files)
│ └── slide-maker/
│ └── SKILL.md
└── workspace/ # Initial data files and knowledge
זמן הריצה של Antigravity סורק את .agents/ (ואת שורש הסביבה) כדי למצוא את הקבצים האלה.
AGENTS.md
הסוכן טוען באופן אוטומטי את .agents/AGENTS.md (או /.agents/AGENTS.md) מהסביבה כהוראות מערכת בזמן ההפעלה. מומלץ להשתמש ב-AGENTS.md להגדרות ארוכות של פרסונות, להנחיות מפורטות ולהוראות שרוצים לשמור בבקרת גרסאות לצד הקוד.
הוספת AGENTS.md באמצעות מקור מוטבע:
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="Analyze the Q1 revenue data and create a report.",
system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",
environment={
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report.",
},
],
},
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Analyze the Q1 revenue data and create a report.",
system_instruction: "You are a data analyst. Always include visualizations and export results as PDF.",
environment: {
type: "remote",
sources: [
{
type: "inline",
target: ".agents/AGENTS.md",
content: "Always use matplotlib for charts. Include a summary table in every report.",
},
],
},
}, { timeout: 300000 });
console.log(interaction.output_text);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Analyze the Q1 revenue data and create a report.",
"system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",
"environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report."
}
]
}
}'
מיומנויות: SKILL.md
מיומנויות הן קבצים שמרחיבים את היכולות של הסוכן. ממקמים אותם מתחת ל-.agents/skills/<skill-name>/SKILL.md והמערכת של Harness מזהה אותם באופן אוטומטי ורושמת אותם.
.agents/
├── AGENTS.md
└── skills/
└── slide-maker/
└── SKILL.md
הוספת מיומנות באמצעות מקור מוטבע:
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="Create a presentation about our Q1 results.",
system_instruction="You create presentations from data.",
environment={
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\ndescription: Create HTML slide decks\n---\n# Slide Maker\n\nWhen asked to create a presentation:\n1. Analyze the input data\n2. Create an HTML slide deck with reveal.js\n3. Save to /workspace/output/slides.html",
},
],
},
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Create a presentation about our Q1 results.",
system_instruction: "You create presentations from data.",
environment: {
type: "remote",
sources: [
{
type: "inline",
target: ".agents/skills/slide-maker/SKILL.md",
content: "---\nname: slide-maker\ndescription: Create HTML slide decks\n---\n# Slide Maker\n\nWhen asked to create a presentation:\n1. Analyze the input data\n2. Create an HTML slide deck with reveal.js\n3. Save to /workspace/output/slides.html",
},
],
},
}, { timeout: 300000 });
console.log(interaction.output_text);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Create a presentation about our Q1 results.",
"system_instruction": "You create presentations from data.",
"environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\ndescription: Create HTML slide decks\n---\n# Slide Maker\n\nWhen asked to create a presentation:\n1. Analyze the input data\n2. Create an HTML slide deck with reveal.js\n3. Save to /workspace/output/slides.html"
}
]
}
}'
ה-Skills שנטענו מ-.agents/skills/ ומ-/.agents/skills/ מתגלים באופן אוטומטי.
יצירת סוכן מנוהל
אחרי שמשפרים את ההגדרה, אפשר ליצור אותה כסוכן מנוהל באמצעות agents.create. כך אפשר להפעיל את הסוכן לפי מזהה בלי לחזור על ההגדרה בכל פעם.
מהמקורות
מציינים את base_agent, id, system_instruction ו-base_environment עם מקורות. הפלטפורמה מספקת ארגז חול חדש עם הקבצים שלכם בכל הפעלה. במאמר סביבות מפורטים סוגי המקורות שזמינים (Git, GCS, inline).
Python
from google import genai
client = genai.Client()
agent = client.agents.create(
id="data-analyst",
base_agent="antigravity-preview-05-2026",
system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",
base_environment={
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report.",
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results.",
},
{
"type": "repository",
"source": "https://github.com/my-org/analysis-templates",
"target": "/workspace/templates",
},
],
},
)
print(f"Created agent: {agent.id}")
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const agent = await client.agents.create({
id: "data-analyst",
base_agent: "antigravity-preview-05-2026",
system_instruction: "You are a data analyst. Always include visualizations and export results as PDF.",
base_environment: {
type: "remote",
sources: [
{
type: "inline",
target: ".agents/AGENTS.md",
content: "Always use matplotlib for charts. Include a summary table in every report.",
},
{
type: "inline",
target: ".agents/skills/slide-maker/SKILL.md",
content: "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results.",
},
{
type: "repository",
source: "https://github.com/my-org/analysis-templates",
target: "/workspace/templates",
},
],
},
});
console.log(`Created agent: ${agent.id}`);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/agents" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"id": "data-analyst",
"base_agent": "antigravity-preview-05-2026",
"system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",
"base_environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report."
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results."
},
{
"type": "repository",
"source": "https://github.com/my-org/analysis-templates",
"target": "/workspace/templates"
}
]
}
}'
מסביבה קיימת (fork)
מבצעים איטרציה עם סוכן הבסיס של Antigravity עד שהסביבה מתאימה (החבילות מותקנות, הקבצים במקום), ואז יוצרים ממנו עותק (fork) לסוכן מנוהל.
Python
from google import genai
client = genai.Client()
# Step 1: set up the environment interactively
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="Install pandas, matplotlib, and seaborn. Create an analysis template at /workspace/template.py.",
environment="remote",
)
# Step 2: fork that environment into a managed agent
agent = client.agents.create(
id="my-data-analyst",
base_agent="antigravity-preview-05-2026",
system_instruction="You are a data analyst. Use the template at /workspace/template.py for all reports.",
base_environment=interaction.environment_id,
)
print(f"Forked agent successfully: {agent.id}")
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Install pandas, matplotlib, and seaborn. Create an analysis template at /workspace/template.py.",
environment: "remote",
}, { timeout: 300000 });
const agent = await client.agents.create({
id: "my-data-analyst",
base_agent: "antigravity-preview-05-2026",
system_instruction: "You are a data analyst. Use the template at /workspace/template.py for all reports.",
base_environment: interaction.environment_id,
});
console.log(`Forked agent successfully: ${agent.id}`);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Install pandas, matplotlib, and seaborn. Create an analysis template at /workspace/template.py.",
"environment": "remote"
}'
עם כללי רשת
כששומרים נציג מנוהל, אפשר לנעול את הגישה היוצאת או להוסיף פרטי כניסה. למידע על הסכימה המלאה של רשימת ההיתרים, על תבניות של פרטי כניסה ועל תווים כלליים, אפשר לעיין במאמר סביבות: הגדרת רשת.
בדוגמה הבאה נוצר סוכן issue-resolver שיכול לגשת רק ל-GitHub ול-PyPI, עם פרטי כניסה שמוזרקים ל-GitHub:
Python
from google import genai
client = genai.Client()
agent = client.agents.create(
id="issue-resolver",
base_agent="antigravity-preview-05-2026",
system_instruction="You resolve GitHub issues. Clone the repo, find the bug, write the fix, run the tests, and open a PR.",
base_environment={
"type": "remote",
"sources": [
{
"type": "repository",
"source": "https://github.com/my-org/backend",
"target": "/workspace/repo",
}
],
"network": {
"allowlist": [
{
"domain": "api.github.com",
"transform": {
"Authorization": "Basic YOUR_BASE64_TOKEN"
},
},
{"domain": "pypi.org"},
]
},
},
)
print(f"Created issue-resolver agent successfully: {agent.id}")
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const agent = await client.agents.create({
id: "issue-resolver",
base_agent: "antigravity-preview-05-2026",
system_instruction: "You resolve GitHub issues. Clone the repo, find the bug, write the fix, run the tests, and open a PR.",
base_environment: {
type: "remote",
sources: [
{
type: "repository",
source: "https://github.com/my-org/backend",
target: "/workspace/repo",
}
],
network: {
allowlist: [
{
domain: "api.github.com",
transform: {
"Authorization": "Basic YOUR_BASE64_TOKEN"
},
},
{ domain: "pypi.org" },
]
}
},
});
console.log(`Created issue-resolver agent successfully: ${agent.id}`);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/agents" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"id": "issue-resolver",
"base_agent": "antigravity-preview-05-2026",
"system_instruction": "You resolve GitHub issues. Clone the repo, find the bug, write the fix, run the tests, and open a PR.",
"base_environment": {
"type": "remote",
"sources": [
{
"type": "repository",
"source": "https://github.com/my-org/backend",
"target": "/workspace/repo"
}
],
"network": {
"allowlist": [
{
"domain": "api.github.com",
"transform": {
"Authorization": "Basic YOUR_BASE64_TOKEN"
}
},
{"domain": "pypi.org"}
]
}
}
}'
הפעלת הסוכן
כדי להתקשר לסוכן המנוהל באמצעות מזהה הסוכן, צריך ליצור אינטראקציה חדשה. כל הפעלה יוצרת עותק של סביבת הבסיס, כך שכל הרצה מתחילה בצורה נקייה.
Python
result = client.interactions.create(
agent="data-analyst",
input="Analyze Q1 revenue data from /workspace/templates/sample.csv and create a slide deck.",
environment="remote",
)
print(result.output_text)
JavaScript
const result = await client.interactions.create({
agent: "data-analyst",
input: "Analyze Q1 revenue data from /workspace/templates/sample.csv and create a slide deck.",
environment: "remote",
}, { timeout: 300000 });
console.log(result.output_text);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "data-analyst",
"input": "Analyze Q1 revenue data from /workspace/templates/sample.csv and create a slide deck.",
"environment": "remote"
}'
למידע על שיחות מרובות תגובות וסטרימינג, אפשר לעיין במדריך למתחילים. אותם דפוסי previous_interaction_id ו-environment חלים על סוכנים מנוהלים.
שינוי ההגדרה בזמן ההפעלה
כשיוצרים אינטראקציה, אפשר לשנות את ברירת המחדל של הסוכן system_instruction וtools. כך תוכלו לשנות את ההתנהגות או היכולות של הסוכן בהרצה ספציפית בלי לשנות את הגדרת הסוכן ששמורה.
Python
result = client.interactions.create(
agent="data-analyst",
input="Analyze Q1 revenue data, but do not create a slide deck. Just output a summary table.",
system_instruction="You are a data analyst. Focus ONLY on summary tables. Ignore default instructions about slides.",
tools=[{"type": "code_execution"}], # Override to only use code execution
environment="remote",
)
print(result.output_text)
JavaScript
const result = await client.interactions.create({
agent: "data-analyst",
input: "Analyze Q1 revenue data, but do not create a slide deck. Just output a summary table.",
system_instruction: "You are a data analyst. Focus ONLY on summary tables. Ignore default instructions about slides.",
tools: [{ type: "code_execution" }], // Override to only use code execution
environment: "remote",
}, { timeout: 300000 });
console.log(result.output_text);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "data-analyst",
"input": "Analyze Q1 revenue data, but do not create a slide deck. Just output a summary table.",
"system_instruction": "You are a data analyst. Focus ONLY on summary tables. Ignore default instructions about slides.",
"tools": [{"type": "code_execution"}],
"environment": "remote"
}'
ניהול הסוכנים
אפשר להציג רשימה של סוכנים, לקבל מידע עליהם ולמחוק אותם.
הצגת רשימה של סוכנים
Python
agents = client.agents.list()
for a in agents.agents:
print(f"{a.id}: {a.description}")
JavaScript
const agents = await client.agents.list();
if (agents.agents) {
for (const a of agents.agents) {
console.log(`${a.id}: ${a.description}`);
}
}
REST
curl -X GET "https://generativelanguage.googleapis.com/v1beta/agents" \
-H "x-goog-api-key: $GEMINI_API_KEY"
קבלת סוכן
Python
agent = client.agents.get(id="data-analyst")
print(agent)
JavaScript
const agent = await client.agents.get("data-analyst");
console.log(agent);
REST
curl -X GET "https://generativelanguage.googleapis.com/v1beta/agents/data-analyst" \
-H "x-goog-api-key: $GEMINI_API_KEY"
מחיקת סוכן
המחיקה מסירה את ההגדרה. הסביבות הקיימות והאינטראקציות שנוצרו על ידי הסוכן לא יושפעו.
Python
client.agents.delete(id="data-analyst")
JavaScript
await client.agents.delete("data-analyst");
REST
curl -X DELETE "https://generativelanguage.googleapis.com/v1beta/agents/data-analyst" \
-H "x-goog-api-key: $GEMINI_API_KEY"
הסבר על הגדרת הסוכן
| שדה | סוג | נדרש | תיאור |
|---|---|---|---|
id |
מחרוזת | כן | מזהה סוכן ייחודי. משמש להפעלת הסוכן. |
description |
מחרוזת | לא | תיאור של הסוכן שכתוב בצורה שקריאה לאנשים. |
base_agent |
מחרוזת | כן | מזהה סוכן בסיסי (לדוגמה, antigravity-preview-05-2026). |
system_instruction |
מחרוזת | לא | הנחיה למערכת שמגדירה את ההתנהגות והאישיות. |
tools |
מחרוזת או אובייקט | לא | הכלים שהסוכן יכול להשתמש בהם. אם לא מציינים כלים, הסוכן יוכל לגשת ל-code_execution, google_search ו-url_context. |
base_environment |
מחרוזת או אובייקט | לא | "remote", environment_id או אובייקט הגדרה עם sources ו-network. ראו סביבות. |
תהליך עבודה של איטרציה
- אב טיפוס עם סוכן הבסיס של Antigravity. העברת הוראות למערכת ומקורות סביבה מוטבעים. בדיקה אינטראקטיבית של הוראות, מיומנויות והגדרת הסביבה.
- מייצבים את הסביבה. מתקינים חבילות, מטמיעים מקורות ומוודאים שהכול פועל.
- שומרים את הסוכן כסוכן מנוהל על ידי יצירת סוכן חדש, ממקורות או על ידי פיצול של הסביבה.
- מעדכנים את הגדרת הסוכן. לשנות את ההוראה למערכת, להחליף מיומנויות או להוסיף מקורות. ההפעלה הבאה תתבצע עם ההגדרה החדשה.
מגבלות
- סטטוס התצוגה המקדימה: נציגים מנוהלים נמצאים בתצוגה מקדימה. יכול להיות שיהיו שינויים בתכונות ובסכימות.
- סוכן בסיסי: רק
antigravity-preview-05-2026נתמך כ-base_agent. - אין ניהול גרסאות: עדיין אין אפשרות לנהל גרסאות של סוכנים ולחזור לגרסה קודמת.
- אין קינון של סוכני משנה: עדיין אין תמיכה בהעברת הרשאות לסוכני משנה.
- אפשר להוסיף עד 1,000 סוכנים מנוהלים.
המאמרים הבאים
- סקירה כללית על סוכנים: מידע על מושגי הליבה של סוכנים מנוהלים.
- מדריך למתחילים: איך מתחילים ליצור שיחות מרובות תפניות ושידור.
- Antigravity Agent: מידע על היכולות, הכלים והתמחור של הסוכן שמוגדר כברירת מחדל.
- סביבות של סוכנים: הגדרה של ארגזי חול, מקורות ורשתות.