סוכן Antigravity הוא סוכן מנוהל לשימוש כללי ב-Gemini API. קריאה אחת ל-API מספקת לכם סוכן שמבצע ניתוח, מריץ קוד, מנהל קבצים ומחפש באינטרנט בתוך ארגז חול מאובטח של Linux, שמתארח ב-Google.
הוא מבוסס על Gemini 3.5 Flash ומשתמש באותו מנגנון כמו Antigravity IDE. זמין דרך Interactions API ו-Google AI Studio.
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
environment="remote",
)
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: "Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
environment: "remote",
}, { 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": "Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
"environment": "remote"
}'
יכולות
כל שיחה יכולה להקצות ארגז חול של Linux ולהתחיל לולאה של שימוש בכלי. הסוכן מתכנן, פועל, בודק את התוצאות וחוזר על הפעולות עד שהמשימה מסתיימת.
- הרצת קוד: הרצת פקודות Bash, Python ו-Node.js. להתקין חבילות, להריץ בדיקות ולפתח אפליקציות.
- ניהול קבצים: קריאה, כתיבה, עריכה, חיפוש ורישום של קבצים בארגז החול. הקבצים נשמרים בין אינטראקציות.
- גישה לאינטרנט: חיפוש ב-Google ואחזור כתובות URL של נתונים.
- דחיסת הקשר: דחיסת הקשר אוטומטית (מופעלת בערך ב-135,000 טוקנים) כדי לתמוך בהפעלות ארוכות עם כמה תפניות בשיחה, בלי לאבד את ההקשר או להגיע למגבלות הטוקנים.
במאמר מדריך למתחילים מוסבר איך להשתמש בסטרימינג ובשימוש רב-שלבי.
כלים נתמכים
כברירת מחדל, לסוכן יש גישה אל code_execution, google_search ו-url_context. הכלים של מערכת הקבצים מופעלים באופן אוטומטי כשמציינים את הפרמטר environment. אפשר גם להגדיר פונקציות בהתאמה אישית כדי לחבר את הסוכן לממשקי API ולכלים שלכם. צריך לציין את הפרמטר tools רק כשמבצעים התאמה אישית של קבוצת ברירת המחדל או כשמוסיפים פונקציות מותאמות אישית.
| כלי | הקלדת ערך | תיאור |
|---|---|---|
| הרצת קוד | code_execution |
הרצת פקודות של מעטפת (bash, Python, Node) עם לכידה של stdout/stderr. |
| חיפוש Google | google_search |
חיפוש באינטרנט הציבורי. |
| ההקשר של כתובת ה-URL | url_context |
אחזור וקריאה של דפי אינטרנט. |
| מערכת קבצים | (מופעל באמצעות environment) |
קריאה, כתיבה, עריכה, חיפוש ורישום של קבצים בארגז החול. אין סוג נפרד של כלי. הוא מופעל באופן אוטומטי כשמגדירים את environment. |
| פונקציות מותאמות אישית | function |
הגדרת פונקציות בהתאמה אישית שהסוכן יכול לבקש להפעיל. ראו בקשה להפעלת פונקציה. |
כדי להגביל את הסוכן לכלים ספציפיים, מעבירים רק את הכלים שצריך:
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="Search for the latest AI research papers on reasoning and summarize them.",
environment="remote",
tools=[
{"type": "google_search"},
{"type": "url_context"},
],
)
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: "Search for the latest AI research papers on reasoning and summarize them.",
environment: "remote",
tools: [
{ type: "google_search" },
{ type: "url_context" },
],
}, { 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": "Search for the latest AI research papers on reasoning and summarize them.",
"environment": "remote",
"tools": [
{"type": "google_search"},
{"type": "url_context"}
]
}'
קלט מולטי-מודאלי
הסוכן Antigravity תומך בקלט מרובה מצבים. בשלב הזה יש תמיכה רק בקלט בשפות text וimage. צריך לספק את התמונות כמחרוזות מוטבעות בקידוד Base64 (data).
Python
import base64
from google import genai
client = genai.Client()
with open("path/to/chart.png", "rb") as f:
image_bytes = f.read()
interaction_inline = client.interactions.create(
agent="antigravity-preview-05-2026",
input=[
{"type": "text", "text": "Analyze this chart and summarize the trends."},
{
"type": "image",
"data": base64.b64encode(image_bytes).decode("utf-8"),
"mime_type": "image/png",
},
],
environment="remote",
)
JavaScript
import { GoogleGenAI } from "@google/genai";
import * as fs from "node:fs";
const client = new GoogleGenAI({});
const base64Image = fs.readFileSync("path/to/chart.png", { encoding: "base64" });
const interactionInline = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: [
{ type: "text", text: "Analyze this chart and summarize the trends." },
{
type: "image",
data: base64Image,
mime_type: "image/png",
},
],
environment: "remote",
}, { timeout: 300000 });
REST
BASE64_IMAGE=$(base64 -w0 /path/to/chart.png)
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\": [
{\"type\": \"text\", \"text\": \"Analyze this chart and summarize the trends.\"},
{
\"type\": \"image\",
\"mime_type\": \"image/png\",
\"data\": \"$BASE64_IMAGE\"
}
],
\"environment\": \"remote\"
}"
בקשה להפעלת פונקציה
התכונה 'הפעלת פונקציות' מאפשרת לכם לחבר את סוכן Antigravity לממשקי API ולמסדי נתונים חיצוניים על ידי הגדרת כלים מותאמים אישית שהסוכן יכול להפעיל. למידע על מושגים כלליים, אפשר לעיין במאמר בקשות להפעלת פונקציות באמצעות Gemini API.
בדוגמה הבאה מוצגת אינטראקציה של 2 תורות. הסוכן מבקש קודם get_weather קריאה לפונקציה בהתאמה אישית, והלקוח מבצע אותה ומחזיר את התוצאה בתור השני.
Python
from google import genai
client = genai.Client()
# 1. Define the custom function
get_weather_tool = {
"type": "function",
"name": "get_weather",
"description": "Gets the current weather for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and country, e.g. San Francisco, USA",
}
},
"required": ["location"],
},
}
# 2. Call the agent with the custom tool (Turn 1)
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input="What is the weather in Tokyo?",
environment="remote",
tools=[
{"type": "code_execution"}, # Enable default code execution
get_weather_tool, # Add custom function
],
)
# Check if the agent requested a function call
if interaction.status == "requires_action":
# Find function calls that do not have a matching function result.
# Filesystem tools (like write_file) are also represented as function calls
# but are executed automatically by the environment.
executed_calls = {step.call_id for step in interaction.steps if step.type == "function_result"}
pending_calls = [step for step in interaction.steps if step.type == "function_call" and step.id not in executed_calls]
if pending_calls:
fc_step = pending_calls[0]
print(f"Function to call: {fc_step.name} (ID: {fc_step.id})")
print(f"Arguments: {fc_step.arguments}")
# 3. Execute the function locally (simulated get_weather()) and send the result back (Turn 2)
function_result = {
"temperature": 23,
"unit": "celsius"
}
final_interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
previous_interaction_id=interaction.id, # Reference the interaction ID
environment=interaction.environment_id,
input=[
{
"type": "function_result",
"name": fc_step.name,
"call_id": fc_step.id,
"result": function_result,
}
],
)
print(final_interaction.output_text)
# Output: The current weather in Tokyo, Japan is 23°C (Celsius).
else:
print("No pending function calls.")
else:
print(f"Interaction completed with status: {interaction.status}")
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
// 1. Define the custom function
const get_weather_tool = {
type: "function",
name: "get_weather",
description: "Gets the current weather for a given location.",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "The city and country, e.g. San Francisco, USA",
},
},
required: ["location"],
},
};
// 2. Call the agent with the custom tool (Turn 1)
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "What is the weather in Tokyo?",
environment: "remote",
tools: [
{ type: "code_execution" },
get_weather_tool,
],
}, { timeout: 300000 });
if (interaction.status === "requires_action") {
// Find function calls that do not have a matching function result.
// Filesystem tools (like write_file) are also represented as function calls
// but are executed automatically by the environment.
const executedCalls = new Set(
interaction.steps
.filter(s => s.type === "function_result")
.map(s => s.call_id)
);
const pendingCalls = interaction.steps.filter(
s => s.type === "function_call" && !executedCalls.has(s.id)
);
if (pendingCalls.length > 0) {
const fcStep = pendingCalls[0];
console.log(`Function to call: ${fcStep.name} (ID: ${fcStep.id})`);
// 3. Execute the function locally (simulated get_weather()) and send the result back (Turn 2)
const functionResult = {
temperature: 23,
unit: "celsius"
};
const finalInteraction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
previous_interaction_id: interaction.id, // Reference the interaction ID
environment: interaction.environment_id,
input: [
{
type: "function_result",
name: fcStep.name,
call_id: fcStep.id,
result: functionResult,
}
],
}, { timeout: 300000 });
console.log(finalInteraction.output_text);
} else {
console.log("No pending function calls.");
}
} else {
console.log(`Interaction completed with status: ${interaction.status}`);
}
REST
# 1. Turn 1: Request function call
RESPONSE=$(curl -s -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": "What is the weather in Tokyo?",
"environment": "remote",
"tools": [
{"type": "code_execution"},
{
"type": "function",
"name": "get_weather",
"description": "Gets the current weather for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
]
}')
# Extract interaction ID, environment ID, and call ID (requires jq)
INTERACTION_ID=$(echo $RESPONSE | jq -r '.id')
ENVIRONMENT_ID=$(echo $RESPONSE | jq -r '.environment_id')
CALL_ID=$(echo $RESPONSE | jq -r '.steps[] | select(.type=="function_call") | .id')
# 2. Turn 2: Send function result back using variables
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\",
\"previous_interaction_id\": \"$INTERACTION_ID\",
\"environment\": \"$ENVIRONMENT_ID\",
\"input\": [
{
\"type\": \"function_result\",
\"name\": \"get_weather\",
\"call_id\": \"$CALL_ID\",
\"result\": {
\"temperature\": 23,
\"unit\": \"celsius\"
}
}
]
}"
התאמה אישית של הסוכן
אפשר להרחיב את סוכן Antigravity על ידי התאמה אישית של ההוראות, הכלים והסביבה שלו. הסוכן תומך בגישה מקורית למערכת הקבצים להתאמה אישית: אפשר לטעון קבצים כמו AGENTS.md להוראות ולמיומנויות בתיקייה .agents/skills/ ישירות לארגז החול, או להעביר את ההגדרות בתוך השורה במועד האינטראקציה. אפשר לבצע איטרציות על ההגדרה ישירות בתוך הקוד ואז לשמור אותה כסוכן מנוהל כשמוכנים.
לפרטים מלאים על בניית סוכנים בהתאמה אישית, אפשר לעיין במאמר בניית סוכנים מנוהלים.
סביבה
כל קריאה יוצרת ארגז חול של Linux או משתמשת בארגז חול קיים. הפרמטר environment מופיע בשלוש צורות:
| טופס | תיאור |
|---|---|
"remote" |
הקצאת ארגז חול חדש עם הגדרות ברירת מחדל. |
"env_abc123" |
אפשר לעשות שימוש חוזר בסביבה קיימת לפי מזהה, ולשמור את כל הקבצים והמצב. |
{...} |
מלא EnvironmentConfig עם מקורות מותאמים אישית וכללי רשת. |
פרטים על מקורות (Git, GCS, inline), רשתות, מחזור חיים ומגבלות משאבים זמינים במאמר סביבות.
זמינות ומחירים
סוכן Antigravity זמין בגרסת טרום-השקה דרך Interactions API ב-Google AI Studio וב-Gemini API.
התמחור מבוסס על מודל של תשלום לפי שימוש, על סמך הטוקנים של מודל Gemini הבסיסי והכלים שבהם הסוכן משתמש. בניגוד לבקשה רגילה לצ'אט שמניבה פלט יחיד, אינטראקציה עם Antigravity היא תהליך עבודה מבוסס-סוכן. בקשה אחת מפעילה לולאה אוטונומית של חשיבה רציונלית, הרצת כלים, הרצת קוד וניהול קבצים.
עלויות משוערות
העלויות משתנות בהתאם למורכבות המשימה. הסוכן קובע באופן אוטונומי כמה קריאות לכלים, הפעלות קוד ופעולות על קבצים נדרשות. האומדנים הבאים מבוססים על הרצות.
| קטגוריית משימה | טוקנים של קלט | טוקנים של פלט | עלות רגילה |
|---|---|---|---|
| מחקר וסינתזת מידע | 100,000–500,000 | 10,000 עד 40,000 | 0.30$ – 1.00$ |
| יצירת מסמכים ותוכן | 100,000–500,000 | 15,000–50,000 | 0.30$ – 1.30$ |
| עיצוב תהליכים ומערכות | 100,000–400,000 | 10,000 עד 30,000 | 0.25$-0.80$ |
| עיבוד וניתוח נתונים | 300,000 עד 3 מיליון | 30,000–150,000 | 0.70$-3.25$ |
בדרך כלל, 50-70% מאסימוני הקלט נשמרים במטמון. בתהליכי עבודה מורכבים של סוכנים עם הרבה קריאות לכלים, יכולים להצטבר 3-5 מיליון טוקנים באינטראקציה אחת, עם עלויות של עד 5$.
השימוש במחשוב בסביבה (CPU, זיכרון, הרצה בארגז חול) לא מחויב במהלך תקופת התצוגה המקדימה.
מגבלות
- סטטוס גרסת הבטא: סוכן Antigravity ו-Interactions API נמצאים בגרסת בטא. יכול להיות שיהיו שינויים בתכונות ובסכימות.
- הגדרת יצירה לא נתמכת: הפרמטרים הבאים לא נתמכים ומחזירים שגיאה 400:
temperature, top_p, top_k, stop_sequences, max_output_tokens. - פלט מובנה: סוכן Antigravity לא תומך בפלט מובנה.
- כלים שלא זמינים: עדיין אין תמיכה ב-
file_search,computer_use,google_mapsו-mcp. - כלי למערכת הקבצים: אין כלי למערכת הקבצים בשלב הזה. הוא חלק מ
environment. - רקע: הסוכן לא תומך בשימוש ב-
background=Trueונדרשstore=True. - הפעלת פונקציות רק במצב stateful: הפעלת פונקציות נתמכת רק במצב stateful. כדי להמשיך את התור, צריך להשתמש ב-
previous_interaction_id. אי אפשר לשחזר את ההיסטוריה באופן ידני (מצב חסר מצב). - סוגים לא נתמכים של נתונים מרובי-אופנים. בשלב הזה אין תמיכה בקלט של אודיו, וידאו ומסמכים. מותר להשתמש רק בטקסט ובתמונה.
המאמרים הבאים
- מדריך למתחילים: שיחות רב-שלביות וסטרימינג.
- יצירת סוכנים בהתאמה אישית: הוראות מותאמות אישית, מיומנויות ושמירת סוכנים.
- סביבות: הגדרת ארגז חול, מקורות, רשת.
- Deep Research Agent: משימות מחקר ארוכות.
- Interactions API: ממשק ה-API הבסיסי.