Antigravity एजेंट

Antigravity एजेंट, Gemini API पर अलग-अलग कामों के लिए इस्तेमाल किया जाने वाला मैनेज किया गया एजेंट है. एक एपीआई कॉल से आपको एक ऐसा एजेंट मिलता है जो तर्क देता है, कोड को लागू करता है, फ़ाइलों को मैनेज करता है, और Google की ओर से होस्ट किए गए आपके सुरक्षित Linux सैंडबॉक्स में वेब ब्राउज़ करता है.

इसे Gemini 3.8 Flash की मदद से बनाया गया है. साथ ही, यह Antigravity IDE के जैसे ही हार्नेस का इस्तेमाल करता है. agent_config का इस्तेमाल करके, Gemini मॉडल को कॉन्फ़िगर किया जा सकता है. यह सुविधा, 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);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-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 Search और डेटा के लिए यूआरएल फ़ेच करना.
  • कॉन्टेक्स्ट को छोटा करना: लंबे समय तक चलने वाले और सिलसिलेवार बातचीत वाले सेशन के लिए, कॉन्टेक्स्ट को अपने-आप छोटा करने की सुविधा (यह सुविधा ~1,35,000 टोकन पर ट्रिगर होती है). इससे कॉन्टेक्स्ट नहीं बदलता और टोकन की सीमाएं भी नहीं टूटती हैं.

सिलसिलेवार बातचीत और स्ट्रीमिंग के लिए, क्विकस्टार्ट देखें.

इन टूल के साथ काम करता है

डिफ़ॉल्ट रूप से, एजेंट के पास code_execution, google_search, और url_context का ऐक्सेस होता है. environment पैरामीटर तय करने पर, फ़ाइल सिस्टम टूल अपने-आप चालू हो जाते हैं. अपने एपीआई और टूल से एजेंट को कनेक्ट करने के लिए, कस्टम फ़ंक्शन भी तय किए जा सकते हैं. डिफ़ॉल्ट सेट को पसंद के मुताबिक बनाने या उसे सीमित करने पर ही, tools पैरामीटर तय करना होता है. इसके अलावा, कस्टम फ़ंक्शन जोड़ते समय भी ऐसा करना होता है.

टूल वैल्यू टाइप करें ब्यौरा
कोड एक्ज़ीक्यूट करना code_execution stdout/stderr कैप्चर करने की सुविधा के साथ, शेल कमांड (bash, Python, Node) चलाएं.
Google Search google_search सार्वजनिक वेब पर खोजें.
यूआरएल कॉन्टेक्स्ट url_context वेब पेजों को फ़ेच और पढ़ सकता है.
फ़ाइल सिस्टम (environment के ज़रिए चालू किया गया) सैंडबॉक्स में फ़ाइलें पढ़ने, लिखने, उनमें बदलाव करने, उन्हें खोजने, और उनकी सूची बनाने की अनुमति. environment सेट करने पर, सिस्टम इन टूल को अपने-आप चालू कर देता है.
कस्टम फ़ंक्शन function ऐसे कस्टम फ़ंक्शन तय करें जिन्हें एजेंट लागू करने का अनुरोध कर सकता है. फ़ंक्शन कॉलिंग देखें.
रिमोट एमसीपी सर्वर mcp_server बाहरी मॉडल कॉन्टेक्स्ट प्रोटोकॉल (एमसीपी) सर्वर को टूल के तौर पर रजिस्टर करें. एमसीपी सर्वर देखें.

सिंक्रोनस हुक का इस्तेमाल करके, रिमोट सैंडबॉक्स में code_execution और filesystem टूल के एक्ज़ीक्यूशन को इंटरसेप्ट और पुष्टि की जा सकती है.

अगर आपको एजेंट को सिर्फ़ कुछ टूल का ऐक्सेस देना है, तो सिर्फ़ उन टूल के नाम पास करें जिनकी आपको ज़रूरत है:

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);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-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 });

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

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" \
-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 एजेंट को बाहरी एपीआई और डेटाबेस से कनेक्ट किया जा सकता है. इसके लिए, आपको कस्टम टूल तय करने होंगे, जिन्हें एजेंट इस्तेमाल कर सकता है. सामान्य कॉन्सेप्ट के लिए, Gemini API के साथ फ़ंक्शन कॉलिंग देखें.

यहां दिए गए उदाहरण में, दो बार की बातचीत दिखाई गई है. एजेंट पहले कस्टम 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}`);
}

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

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" \
  -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" \
  -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 एजेंट को बाहरी टूल से कनेक्ट किया जा सकता है. यह एजेंट, स्ट्रीम किए जा सकने वाले एचटीटीपी पर रिमोट एमसीपी सर्वर के साथ काम करता है.

एमसीपी सर्वर रजिस्टर करते समय, आपको tools ऐरे में यहां दिए गए फ़ील्ड की जानकारी देनी होगी:

फ़ील्ड प्रकार ज़रूरी है ब्यौरा
type स्ट्रिंग हां "mcp_server" होना चाहिए.
name स्ट्रिंग हां सर्वर के लिए यूनीक आइडेंटिफ़ायर. यह पूरी तरह से छोटे अक्षरों में होना चाहिए. साथ ही, इसमें अक्षर और अंक (^[a-z0-9_-]+$ से मेल खाने वाले) होने चाहिए.
url स्ट्रिंग हां रिमोट एमसीपी सर्वर का एंडपॉइंट यूआरएल.
headers ऑब्जेक्ट नहीं अनुरोधों के साथ भेजे गए कस्टम हेडर (जैसे, पुष्टि करने के लिए).
allowed_tools ऐरे नहीं उन टूल के नामों की सूची जिन्हें लागू करने की अनुमति है. अगर इसे शामिल नहीं किया जाता है, तो सभी टूल इस्तेमाल किए जा सकते हैं.

Python

from google import genai

client = genai.Client()

# Register a remote HTTP MCP server
interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="What is the weather in Tokyo?",
    environment="remote",
    tools=[{
        "type": "mcp_server",
        "name": "weather", # Must be lowercase
        "url": "https://gemini-api-demos.uc.r.appspot.com/mcp"
    }]
)

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: "What is the weather in Tokyo?",
    environment: "remote",
    tools: [{
        type: "mcp_server",
        name: "weather", // Must be lowercase
        url: "https://gemini-api-demos.uc.r.appspot.com/mcp"
    }]
}, { timeout: 300000 });

console.log(interaction.output_text);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{
      "agent": "antigravity-preview-05-2026",
      "input": "What is the weather in Tokyo?",
      "environment": "remote",
      "tools": [{
          "type": "mcp_server",
          "name": "weather",
          "url": "https://gemini-api-demos.uc.r.appspot.com/mcp"
      }]
  }'

मॉडल चुनने की सेटिंग

antigravity-preview-05-2026 के लिए, डिफ़ॉल्ट मॉडल Gemini 3.8 Flash (gemini-3.8-flash) है. अगर agent_config को शामिल नहीं किया जाता है, तो एजेंट डिफ़ॉल्ट रूप से gemini-3.8-flash पर सेट हो जाता है.

agent_config का इस्तेमाल करके, Gemini के बुनियादी मॉडल को कॉन्फ़िगर किया जा सकता है. इससे, मॉडल की स्पीड, लागत या तर्क करने की क्षमता को ऑप्टिमाइज़ किया जा सकता है.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Summarize the key differences between functional and object-oriented programming.",
    environment="remote",
    agent_config={
        "type": "antigravity",
        "model": "gemini-3.5-flash-lite",
    },
)

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: "Summarize the key differences between functional and object-oriented programming.",
    environment: "remote",
    agent_config: {
        type: "antigravity",
        model: "gemini-3.5-flash-lite",
    },
}, { timeout: 300000 });

console.log(interaction.output_text);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{
      "agent": "antigravity-preview-05-2026",
      "input": "Summarize the key differences between functional and object-oriented programming.",
      "environment": "remote",
      "agent_config": {
          "type": "antigravity",
          "model": "gemini-3.5-flash-lite"
      }
  }'

agent_config.model के लिए, इन वैल्यू का इस्तेमाल किया जा सकता है:

मॉडल agent_config.model एट्रिब्यूट की वैल्यू ब्यौरा
Gemini 3.8 Flash (डिफ़ॉल्ट) gemini-3.8-flash यह तर्क देने, कोडिंग करने, और टूल इस्तेमाल करने के लिए डिफ़ॉल्ट बैलेंस मॉडल है.
Gemini 3.7 Flash gemini-3.7-flash तर्क करने, कोडिंग करने, और एजेंटिक वर्कफ़्लो के लिए, Flash मॉडल की पिछली जनरेशन.
Gemini 3.6 Flash gemini-3.6-flash सामान्य एजेंटिक वर्कफ़्लो के लिए, Flash मॉडल का बैलेंस वर्शन.
Gemini 3.5 Flash gemini-3.5-flash सामान्य वर्कफ़्लो के लिए हल्का मॉडल.
Gemini 3.5 Flash-Lite gemini-3.5-flash-lite यह कम मेमोरी वाला मॉडल है. इसे कम समय में जवाब देने और कम खर्च वाले कामों के लिए ऑप्टिमाइज़ किया गया है.

agents.create की मदद से मैनेज किया गया एजेंट बनाते समय, मॉडल को ठीक उसी तरह कॉन्फ़िगर किया जाता है. इसके लिए, base_agent और agent_config पास करें. ध्यान दें कि agents.create का इस्तेमाल करके बनाए गए मैनेज किए जा रहे एजेंट के लिए, इंटरैक्शन के समय मॉडल को बदला नहीं जा सकता. मॉडल को उस सेटिंग के हिसाब से लॉक किया जाता है जो एजेंट बनाते समय सेट की गई थी. इससे टूल कॉलिंग के अनुमानित व्यवहार, लगातार डीबग करने, और सुरक्षा से जुड़ी सीमाओं का पालन करने की सुविधा मिलती है.

एजेंट को पसंद के मुताबिक बनाना

Antigravity एजेंट को बेहतर बनाया जा सकता है. इसके लिए, इसके निर्देशों, टूल, और एनवायरमेंट में बदलाव करें. एजेंट, फ़ाइल सिस्टम के हिसाब से काम करता है. इसलिए, इसे अपनी पसंद के मुताबिक बनाया जा सकता है. .agents/skills/ में मौजूद निर्देशों और स्किल के लिए, AGENTS.md जैसी फ़ाइलें सीधे सैंडबॉक्स में माउंट की जा सकती हैं. इसके अलावा, इंटरैक्शन के समय कॉन्फ़िगरेशन को इनलाइन पास किया जा सकता है. कॉन्फ़िगरेशन में बदलाव करने के लिए, इनलाइन तरीके का इस्तेमाल किया जा सकता है. इसके बाद, जब आप तैयार हों, तो इसे मैनेज किए जा सकने वाले एजेंट के तौर पर सेव करें.

कस्टम एजेंट बनाने के बारे में पूरी जानकारी के लिए, मैनेज किए गए एजेंट बनाना लेख पढ़ें.

बैकग्राउंड में कोड एक्ज़ीक्यूट होने की सुविधा

एजेंट के ऐसे टास्क पूरे होने में कुछ मिनट लग सकते हैं जिनमें कई चरणों में तर्क करना, कोड एक्ज़ीक्यूट करना या फ़ाइल से जुड़ी कार्रवाइयां शामिल होती हैं. इंटरैक्शन को एसिंक्रोनस तरीके से चलाने के लिए, background=True का इस्तेमाल करें. एपीआई, इंटरैक्शन आईडी के साथ तुरंत जवाब देता है. इस आईडी को तब तक पोल किया जाता है, जब तक स्थिति completed या failed न हो जाए.

Python

import time
from google import genai

client = genai.Client()

# 1. Start the interaction in the background
interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Run a complex analysis on the repository.",
    environment="remote",
    background=True,
)

print(f"Interaction started in background: {interaction.id}")

# 2. Poll for completion
while interaction.status == "in_progress":
    time.sleep(5)
    interaction = client.interactions.get(id=interaction.id)

if interaction.status == "completed":
    print(interaction.output_text)
else:
    print(f"Finished with status: {interaction.status}")

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Run a complex analysis on the repository.",
    environment: "remote",
    background: true,
});

console.log(`Interaction started in background: ${interaction.id}`);

let result = interaction;
while (result.status === "in_progress") {
    await new Promise(resolve => setTimeout(resolve, 5000));
    result = await client.interactions.get(interaction.id);
}

if (result.status === "completed") {
    console.log(result.output_text);
} else {
    console.log(`Finished with status: ${result.status}`);
}

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

# 1. Start the interaction in the background
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": "Run a complex analysis on the repository.",
      "environment": "remote",
      "background": true
  }')

INTERACTION_ID=$(echo $RESPONSE | jq -r '.id')

# 2. Poll for results (repeat until status is "completed")
curl -s -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

बैकग्राउंड में कोड एक्ज़ीक्यूट होने की सुविधा के लिए store=True ज़रूरी है. यह डिफ़ॉल्ट रूप से चालू होती है. बैकग्राउंड में टास्क पूरा होने के दौरान, रीयल-टाइम में प्रोग्रेस अपडेट पाने के लिए, बैकग्राउंड में होने वाले इंटरैक्शन को स्ट्रीम करना लेख पढ़ें.

cancel तरीके का इस्तेमाल करके, बैकग्राउंड में चल रहे इंटरैक्शन को रद्द किया जा सकता है.

Python

client.interactions.cancel(id="INTERACTION_ID")

JavaScript

await client.interactions.cancel("INTERACTION_ID");

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions/INTERACTION_ID:cancel" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

बैकग्राउंड में कोड एक्ज़ीक्यूट होने की सुविधा के साथ सिलसिलेवार बातचीत

जब बैकग्राउंड इंटरैक्शन में स्टेटफ़ुल टूल (जैसे, सैंडबॉक्स में कोड एक्ज़ीक्यूट करना) शामिल हों, तो उसी एनवायरमेंट में जारी रखने के लिए, पूरे किए गए इंटरैक्शन से environment_id का इस्तेमाल करें. इससे यह पक्का होता है कि एजेंट, सभी फ़ाइलों और स्थिति को बरकरार रखते हुए, वहीं से काम शुरू करे जहां उसने छोड़ा था.

Python

import time
from google import genai

client = genai.Client()

# First turn: run a task in the background
interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Clone https://github.com/google/generative-ai-python and run its tests.",
    environment="remote",
    background=True,
)

while interaction.status == "in_progress":
    time.sleep(5)
    interaction = client.interactions.get(id=interaction.id)

# Second turn: continue in the same environment
followup = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Fix any failing tests and re-run them.",
    previous_interaction_id=interaction.id,
    environment=interaction.environment_id,
    background=True,
)

while followup.status == "in_progress":
    time.sleep(5)
    followup = client.interactions.get(id=followup.id)

print(followup.output_text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

// First turn: run a task in the background
let interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Clone https://github.com/google/generative-ai-python and run its tests.",
    environment: "remote",
    background: true,
});

while (interaction.status === "in_progress") {
    await new Promise(resolve => setTimeout(resolve, 5000));
    interaction = await client.interactions.get(interaction.id);
}

// Second turn: continue in the same environment
let followup = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Fix any failing tests and re-run them.",
    previous_interaction_id: interaction.id,
    environment: interaction.environment_id,
    background: true,
});

while (followup.status === "in_progress") {
    await new Promise(resolve => setTimeout(resolve, 5000));
    followup = await client.interactions.get(followup.id);
}

console.log(followup.output_text);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

# 1. Start first interaction in the background
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": "Clone https://github.com/google/generative-ai-python and run its tests.",
      "environment": "remote",
      "background": true
  }')

INTERACTION_ID=$(echo $RESPONSE | jq -r '.id')

# 2. Poll until completed (repeat until status is "completed")
RESULT=$(curl -s -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/$INTERACTION_ID" \
  -H "x-goog-api-key: $GEMINI_API_KEY")

ENVIRONMENT_ID=$(echo $RESULT | jq -r '.environment_id')

# 3. Continue in the same environment
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\": \"Fix any failing tests and re-run them.\",
      \"previous_interaction_id\": \"$INTERACTION_ID\",
      \"environment\": \"$ENVIRONMENT_ID\",
      \"background\": true
  }"

एनवायरमेंट

हर कॉल, Linux सैंडबॉक्स बनाता है या उसका फिर से इस्तेमाल करता है. environment पैरामीटर तीन तरह के होते हैं:

फ़ॉर्म ब्यौरा
"remote" डिफ़ॉल्ट सेटिंग के साथ नया सैंडबॉक्स उपलब्ध कराएं.
"env_abc123" आईडी के हिसाब से किसी मौजूदा एनवायरमेंट का फिर से इस्तेमाल करें. इससे सभी फ़ाइलें और उनकी स्थिति बनी रहती है.
{...} कस्टम सोर्स और नेटवर्क के नियमों के साथ पूरी EnvironmentConfig.

सोर्स (Git, GCS, इनलाइन), नेटवर्किंग, लाइफ़साइकल, और संसाधन की सीमाओं के बारे में जानकारी के लिए, एनवायरमेंट देखें.

ट्रिगर

ट्रिगर की मदद से, एजेंट को क्रॉन शेड्यूल के हिसाब से अपने-आप चलने के लिए शेड्यूल किया जा सकता है. ट्रिगर, एजेंट, एनवायरमेंट, प्रॉम्प्ट, और शेड्यूल को एक ऐसे संसाधन से जोड़ता है जो मैन्युअल तरीके से शुरू किए बिना ही काम करता है. हर बार के एक्ज़ीक्यूशन में, एक ही एनवायरमेंट का फिर से इस्तेमाल किया जाता है. इसलिए, एक बार के रन में बनाई गई फ़ाइलें बनी रहती हैं और अगले रन में दिखती हैं.

ट्रिगर बनाएं

क्रॉन शेड्यूल, टाइम ज़ोन, और इंटरैक्शन कॉन्फ़िगरेशन तय करके ट्रिगर बनाएं. ट्रिगर, active स्थिति में शुरू होता है और यह अगले मैचिंग क्रॉन टाइम पर ट्रिगर होगा. ट्रिगर को मैनेज करने के लिए, वापस मिले id को सेव करें.

Python

from google import genai

client = genai.Client()

trigger = client.triggers.create(
    schedule="0 9 * * *",
    time_zone="America/Argentina/Buenos_Aires",
    display_name="issue-solver",
    interaction={
        "agent": "antigravity-preview-05-2026",
        "input": "Review open PRs in my-org/my-app for new comments and address feedback. Close issues whose PRs were merged. Then check for new issues labeled 'accepted', skip any already tracked in /workspace/solved-issues/, fix the rest, and open a PR for each. Save reports to /workspace/solved-issues/.",
        "environment": {
            "type": "remote",
            "network": {
                "allowlist": [
                    {
                        "domain": "api.github.com",
                        "transform": {
                            "Authorization": "Bearer ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                        },
                    },
                    {"domain": "github.com"},
                ]
            },
        },
    },
)

print(f"Trigger created: {trigger.id}")
print(f"Next run: {trigger.next_run_time}")

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const trigger = await client.triggers.create({
    schedule: "0 9 * * *",
    time_zone: "America/Argentina/Buenos_Aires",
    display_name: "issue-solver",
    interaction: {
        agent: "antigravity-preview-05-2026",
        input: [{
            type: "text",
            text: "Review open PRs in my-org/my-app for new comments and address feedback. Close issues whose PRs were merged. Then check for new issues labeled 'accepted', skip any already tracked in /workspace/solved-issues/, fix the rest, and open a PR for each. Save reports to /workspace/solved-issues/.",
        }],
        environment: {
            type: "remote",
            network: {
                allowlist: [
                    {
                        domain: "api.github.com",
                        transform: {
                            "Authorization": "Bearer ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        },
                    },
                    { domain: "github.com" },
                ],
            },
        },
    },
});

console.log(`Trigger created: ${trigger.id}`);
console.log(`Next run: ${trigger.next_run_time}`);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/triggers" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{
      "schedule": "0 9 * * *",
      "time_zone": "America/Argentina/Buenos_Aires",
      "display_name": "issue-solver",
      "interaction": {
          "agent": "antigravity-preview-05-2026",
          "input": [{"type": "text", "text": "Review open PRs in my-org/my-app for new comments and address feedback. Close issues whose PRs were merged. Then check for new issues labeled accepted, skip any already tracked in /workspace/solved-issues/, fix the rest, and open a PR for each. Save reports to /workspace/solved-issues/."}],
          "environment": {
              "type": "remote",
              "network": {
                  "allowlist": [
                      {
                          "domain": "api.github.com",
                          "transform": {
                              "Authorization": "Bearer ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                          }
                      },
                      {"domain": "github.com"}
                  ]
              }
          }
      }
  }'

CreateTrigger अनुरोध में इन फ़ील्ड का इस्तेमाल किया जा सकता है:

फ़ील्ड प्रकार ज़रूरी है ब्यौरा
schedule स्ट्रिंग हां क्रॉन एक्सप्रेशन (जैसे, हर घंटे के लिए 0 * * * * और हफ़्ते के दिनों में सुबह के लिए 0 9 * * 1-5).
time_zone स्ट्रिंग हां आईएएनए टाइम ज़ोन (जैसे, UTC, America/Argentina/Buenos_Aires).
display_name स्ट्रिंग नहीं ट्रिगर का ऐसा नाम जिसे आसानी से पढ़ा जा सकता है.
max_consecutive_failures पूर्णांक नहीं ट्रिगर अपने-आप रुकने से पहले, ज़्यादा से ज़्यादा कितनी बार ट्रिगर हो सकता है. डिफ़ॉल्ट: 5.
execution_timeout_seconds पूर्णांक नहीं हर एक्ज़ीक्यूशन के लिए टाइम आउट (सेकंड में). डिफ़ॉल्ट: 600.
interaction ऑब्जेक्ट हां CreateInteractionRequest, एजेंट, इनपुट, टूल, और एनवायरमेंट के बारे में जानकारी देता है.

जवाब में ये मुख्य फ़ील्ड शामिल होते हैं:

फ़ील्ड टाइप ब्यौरा
id स्ट्रिंग ट्रिगर के लिए यूनीक आइडेंटिफ़ायर. इसके बाद की सभी कार्रवाइयों में इसका इस्तेमाल करें.
status स्ट्रिंग मौजूदा स्थिति: active, paused या disabled.
next_run_time स्ट्रिंग अगली बार शेड्यूल किए गए एक्ज़ीक्यूशन का आईएसओ 8601 टाइमस्टैंप.
consecutive_failure_count पूर्णांक पिछली बार कोड के सही तरीके से चलने के बाद से, लगातार कई बार कोड के सही तरीके से न चलने की संख्या.

ट्रिगर की सूची बनाना

अपने प्रोजेक्ट से जुड़े सभी ट्रिगर वापस पाएं.

Python

triggers = client.triggers.list()
for trigger in triggers.triggers:
    print(f"{trigger.id}: {trigger.display_name} ({trigger.status})")

JavaScript

const triggers = await client.triggers.list();
for (const trigger of triggers.triggers) {
    console.log(`${trigger.id}: ${trigger.display_name} (${trigger.status})`);
}

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X GET "https://generativelanguage.googleapis.com/v1beta/triggers" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

ट्रिगर पाना

किसी एक ट्रिगर का पूरा कॉन्फ़िगरेशन और मौजूदा स्थिति फ़ेच करता है.

Python

trigger = client.triggers.get(id="TRIGGER_ID")
print(f"Schedule: {trigger.schedule}")
print(f"Next run: {trigger.next_run_time}")

JavaScript

const trigger = await client.triggers.get("TRIGGER_ID");
console.log(`Schedule: ${trigger.schedule}`);
console.log(`Next run: ${trigger.next_run_time}`);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X GET "https://generativelanguage.googleapis.com/v1beta/triggers/TRIGGER_ID" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

रोकना और फिर से शुरू करना

शेड्यूल किए गए एक्ज़ीक्यूशन को रोकने के लिए, ट्रिगर को रोका जा सकता है. साथ ही, शेड्यूल को फिर से चालू करने के लिए, ट्रिगर को फिर से शुरू किया जा सकता है. रोकने से, मैन्युअल तरीके से लागू किए जाने वाले नियमों पर कोई असर नहीं पड़ता.

Python

# Pause
client.triggers.update(id="TRIGGER_ID", status="paused")

# Resume
client.triggers.update(id="TRIGGER_ID", status="active")

JavaScript

// Pause
await client.triggers.update("TRIGGER_ID", { status: "paused" });

// Resume
await client.triggers.update("TRIGGER_ID", { status: "active" });

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

# Pause
curl -X PATCH "https://generativelanguage.googleapis.com/v1beta/triggers/TRIGGER_ID" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{"status": "paused"}'

# Resume
curl -X PATCH "https://generativelanguage.googleapis.com/v1beta/triggers/TRIGGER_ID" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{"status": "active"}'

किसी ट्रिगर को मिटाना

किसी ट्रिगर को हमेशा के लिए हटाना. लागू करने की प्रोसेस के इतिहास को नहीं मिटाया जाता.

Python

client.triggers.delete(id="TRIGGER_ID")

JavaScript

await client.triggers.delete("TRIGGER_ID");

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X DELETE "https://generativelanguage.googleapis.com/v1beta/triggers/TRIGGER_ID" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

ट्रिगर को तुरंत चलाना

शेड्यूल किए गए अगले समय का इंतज़ार किए बिना, मांग पर ट्रिगर फ़ायर करें. ट्रिगर के रुकने पर भी यह सुविधा काम करती है.

Python

client.triggers.run(trigger_id="TRIGGER_ID")

JavaScript

await client.triggers.run("TRIGGER_ID");

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/triggers/TRIGGER_ID/executions" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

एक्ज़ीक्यूशन की सूची बनाना

किसी ट्रिगर के लिए, प्रोग्राम चलाने का इतिहास देखें. हर एक्ज़ीक्यूशन में status, टाइमस्टैंप, एक interaction_id शामिल होता है. इसका इस्तेमाल, पूरे इंटरैक्शन का आउटपुट पाने के लिए किया जा सकता है. साथ ही, एक environment_id शामिल होता है. इससे पुष्टि होती है कि सभी रन एक ही सैंडबॉक्स को शेयर करते हैं.

Python

executions = client.triggers.list_executions(trigger_id="TRIGGER_ID")
for ex in executions.trigger_executions:
    print(f"{ex.id}: {ex.status} ({ex.start_time} - {ex.end_time})")

# Fetch the full interaction for an execution
interaction = client.interactions.get(id=ex.interaction_id)
print(interaction.output_text)

JavaScript

const executions = await client.triggers.listExecutions("TRIGGER_ID");
for (const ex of executions.trigger_executions) {
    console.log(`${ex.id}: ${ex.status} (${ex.start_time} - ${ex.end_time})`);
}

// Fetch the full interaction for an execution
const interaction = await client.interactions.get(ex.interaction_id);
console.log(interaction.output_text);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X GET "https://generativelanguage.googleapis.com/v1beta/triggers/TRIGGER_ID/executions" \
  -H "x-goog-api-key: $GEMINI_API_KEY"

उपलब्धता और कीमत

Antigravity एजेंट, Google AI Studio में Interactions API के ज़रिए प्रीव्यू के तौर पर उपलब्ध है. साथ ही, यह Gemini API में बिना शुल्क वाले टियर और पैसे चुकाकर लिए गए टियर वाले प्रोजेक्ट, दोनों के लिए उपलब्ध है.

कीमत, इस्तेमाल के हिसाब से पैसे चुकाएं मॉडल के हिसाब से तय की जाती है. यह Gemini मॉडल के टोकन और एजेंट के इस्तेमाल किए गए टूल पर आधारित होती है. सामान्य चैट के अनुरोध में सिर्फ़ एक आउटपुट मिलता है. हालांकि, Antigravity इंटरैक्शन में एजेंटिक वर्कफ़्लो होता है. एक अनुरोध से, तर्क करने, टूल चलाने, कोड चलाने, और फ़ाइल मैनेज करने का एक ऑटोनॉमस लूप ट्रिगर होता है. मुफ़्त टियर वाले प्रोजेक्ट में, दर की सीमा और इस्तेमाल का कोटा शामिल होता है.

Antigravity इंटरैक्शन, कई बार अपने-आप चलने वाले लूप चलाते हैं. साथ ही, ये काफ़ी टोकन इस्तेमाल कर सकते हैं. टोकन के इस्तेमाल को सीमित करने के लिए, अपने अनुरोध पर बजट कंट्रोल सेट करें. एसएसई स्ट्रीमिंग की मदद से, रीयल टाइम में प्रोग्रेस को मॉनिटर किया जा सकता है. इसके अलावा, चल रहे अनुरोधों को रद्द भी किया जा सकता है.

बजट कंट्रोल

मॉडल चुनने के अलावा, agent_config में max_total_tokens ("type": "antigravity" के साथ) सेट करें, ताकि किसी इंटरैक्शन के लिए इस्तेमाल किए जा सकने वाले टोकन की कुल संख्या (इनपुट + आउटपुट + सोच-विचार) को सीमित किया जा सके. कैश किए गए टोकन को इस सीमा में नहीं गिना जाता. जब एजेंट तय सीमा तक पहुंच जाता है, तो बातचीत बंद हो जाती है और status: "incomplete" के साथ वापस आ जाती है. यह सीमा सबसे सही है: असल इस्तेमाल थोड़ा ज़्यादा हो सकता है. यह इस बात पर निर्भर करता है कि एजेंट, चरणों के बीच बजट की जांच कब करता है.

agent_config, agent, और input के साथ-साथ, इंटरैक्शन के अनुरोध पर बजट सेट करें.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Analyze the dataset in /workspace/data.csv and generate a summary report.",
    agent_config={
        "type": "antigravity",
        "max_total_tokens": 50000
    },
    environment={
        "type": "remote",
        "sources": [
            {
                "type": "inline",
                "target": "/workspace/data.csv",
                "content": "id,name,value\n1,alpha,100\n2,beta,200\n",
            }
        ],
    }
)
print(f"Status: {interaction.status}")  # "incomplete" if budget was hit
print(f"Tokens used: {interaction.usage.total_tokens}")

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Analyze the dataset in /workspace/data.csv and generate a summary report.",
    agent_config: {
        type: "antigravity",
        max_total_tokens: 50000
    },
    environment: {
        type: "remote",
        sources: [
            {
                type: "inline",
                target: "/workspace/data.csv",
                content: "id,name,value\n1,alpha,100\n2,beta,200\n",
            },
        ],
    },
});
console.log(`Status: ${interaction.status}`);
console.log(`Tokens used: ${interaction.usage.total_tokens}`);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{
    "agent": "antigravity-preview-05-2026",
    "input": "Analyze the dataset in /workspace/data.csv and generate a summary report.",
    "agent_config": {
      "type": "antigravity",
      "max_total_tokens": 50000
    },
    "environment": {
      "type": "remote",
      "sources": [
        {
          "type": "inline",
          "target": "/workspace/data.csv",
          "content": "id,name,value\n1,alpha,100\n2,beta,200\n"
        }
      ]
    }
  }'

किसी अधूरी बातचीत को जारी रखना

जब कोई इंटरैक्शन status: "incomplete" पर वापस आता है, तो एजेंट का काम और कॉन्टेक्स्ट सेव रहता है. जहां से बातचीत रुकी थी वहीं से शुरू करने के लिए, ओरिजनल इंटरैक्शन id और environment_id का रेफ़रंस देकर नया इंटरैक्शन भेजें. नए इंटरैक्शन के लिए, max_total_tokens बजट अलग से तय किया जाता है.

Python

# Continue from where the agent stopped
continuation = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="continue",
    previous_interaction_id=interaction.id,
    environment=interaction.environment_id,
    agent_config={
        "type": "antigravity",
        "max_total_tokens": 50000
    }
)
print(f"Status: {continuation.status}")

JavaScript

const continuation = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "continue",
    previous_interaction_id: interaction.id,
    environment: interaction.environment_id,
    agent_config: {
        type: "antigravity",
        max_total_tokens: 50000
    }
});
console.log(`Status: ${continuation.status}`);

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateAgentInteraction params =
    CreateAgentInteraction.builder()
        .agent(AgentOption.of("antigravity-preview-05-2026"))
        .input(InteractionsInput.of("Build a simple REST API server in Node.js."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -d '{
    "agent": "antigravity-preview-05-2026",
    "input": "continue",
    "previous_interaction_id": "INTERACTION_ID",
    "environment": "ENVIRONMENT_ID",
    "agent_config": {
      "type": "antigravity",
      "max_total_tokens": 50000
    }
  }'

अनुमानित लागतें

टास्क की जटिलता के आधार पर लागत अलग-अलग होती है. एजेंट अपने-आप यह तय करता है कि कितने टूल कॉल, कोड एक्ज़ीक्यूशन, और फ़ाइल ऑपरेशन की ज़रूरत है. यहां दिए गए अनुमान, रन पर आधारित हैं.

टास्क की कैटगरी इनपुट टोकन आउटपुट टोकन औसत लागत के बराबर
रिसर्च करना और जानकारी को व्यवस्थित करना 1 लाख से 5 लाख डॉलर 10 हज़ार से 40 हज़ार 0.30 डॉलर से 1.00 डॉलर
दस्तावेज़ और कॉन्टेंट जनरेट करना 1 लाख से 5 लाख डॉलर 15 हज़ार से 50 हज़ार 0.30 डॉलर से 1.30 डॉलर
प्रोसेस और सिस्टम डिज़ाइन 1 लाख से 4 लाख 10 हज़ार से 30 हज़ार 0.25 डॉलर से 0.80 डॉलर
डेटा प्रोसेसिंग और विश्लेषण 3 लाख से 30 लाख 30 हज़ार से 1.5 लाख 0.70 डॉलर से 3.25 डॉलर

आम तौर पर, 50 से 70% इनपुट टोकन कैश मेमोरी में सेव किए जाते हैं. कई टूल कॉल वाले मुश्किल एजेंटिक वर्कफ़्लो में, एक इंटरैक्शन में 30 से 50 लाख टोकन इस्तेमाल हो सकते हैं. इनकी लागत करीब 500 रुपये तक हो सकती है.

प्रीव्यू की अवधि के दौरान, एनवायरमेंट कंप्यूट (सीपीयू, मेमोरी, सैंडबॉक्स एक्ज़ीक्यूशन) के लिए बिल नहीं लिया जाता.

सीमाएं

  • प्रीव्यू की स्थिति: Antigravity एजेंट और Interactions API. सुविधाओं और स्कीमा में बदलाव हो सकता है.
  • जनरेशन कॉन्फ़िगरेशन काम नहीं करता: यहां दिए गए पैरामीटर काम नहीं करते हैं और इनसे 400 गड़बड़ी मिलती है: temperature, top_p, top_k, stop_sequences, max_output_tokens.
  • स्ट्रक्चर्ड आउटपुट: Antigravity एजेंट, स्ट्रक्चर्ड आउटपुट के साथ काम नहीं करता.
  • उपलब्ध न होने वाले टूल: file_search, computer_use, और google_maps की सुविधा अभी उपलब्ध नहीं है.
  • रिमोट एमसीपी की सीमाएं: Server-Sent Events (एसएसई) ट्रांसपोर्ट की सुविधा मौजूद नहीं है. इसके लिए, स्ट्रीम किए जा सकने वाले एचटीटीपी का इस्तेमाल करें. इसके अलावा, सर्वर name पूरी तरह से छोटे अक्षरों में होना चाहिए. साथ ही, इसमें सिर्फ़ अक्षर और संख्याएँ होनी चाहिए. बड़े अक्षरों का इस्तेमाल करने पर, सामान्य 400 Bad Request गड़बड़ी ट्रिगर होती है.
  • फ़ाइल सिस्टम टूल: फ़िलहाल, कोई फ़ाइल सिस्टम टूल उपलब्ध नहीं है. यह environment का हिस्सा है.
  • स्टोर की ज़रूरी शर्तें: background=True का इस्तेमाल करके एजेंट को रन करने के लिए, store=True ज़रूरी है.
  • सिर्फ़ स्टेटफ़ुल मोड में फ़ंक्शन कॉल करने की सुविधा: फ़ंक्शन कॉल करने की सुविधा सिर्फ़ स्टेटफ़ुल मोड में उपलब्ध है. बातचीत जारी रखने के लिए, आपको previous_interaction_id का इस्तेमाल करना होगा. इतिहास को मैन्युअल तरीके से फिर से बनाने की सुविधा (स्टेटलेस मोड) मौजूद नहीं है.
  • मल्टीमॉडल के ऐसे टाइप जिनका इस्तेमाल नहीं किया जा सकता. फ़िलहाल, ऑडियो, वीडियो, और दस्तावेज़ के तौर पर इनपुट नहीं दिया जा सकता. सिर्फ़ टेक्स्ट और इमेज का इस्तेमाल किया जा सकता है.

आगे क्या करना है