Gemini API पर मैनेज किए गए एजेंट की मदद से, Antigravity एजेंट को अपनी पसंद के निर्देश, स्किल, और डेटा देकर बेहतर बनाया जा सकता है. इंटरैक्शन के समय, एजेंट को इनलाइन के तौर पर पसंद के मुताबिक बनाया जा सकता है. इसके अलावा, कॉन्फ़िगरेशन को मैनेज किए गए एजेंट के तौर पर सेव किया जा सकता है. इसे आईडी की मदद से शुरू किया जा सकता है.
Antigravity एजेंट को पसंद के मुताबिक बनाना
कस्टम एजेंट बनाने का सबसे आसान तरीका यह है कि नया इंटरैक्शन बनाते समय, अपने कॉन्फ़िगरेशन को इनलाइन के तौर पर पास किया जाए. इसके लिए, रजिस्ट्रेशन करने की ज़रूरत नहीं होती. एजेंट को इन मुख्य तरीकों से बेहतर बनाया जा सकता है:
- मॉडल चुनना:
agent_configके ज़रिए, Gemini के मॉडल को चुना जा सकता है. डिफ़ॉल्ट तौर पर, Gemini 3.8 Flash मॉडल चुना जाता है. - सिस्टम के निर्देश: व्यवहार को आकार देने के लिए,
system_instructionके ज़रिए इनलाइन टेक्स्ट पास करें. - टूल: डिफ़ॉल्ट टूल (कोड एक्ज़ीक्यूशन, खोज, यूआरएल कॉन्टेक्स्ट) को बदलें, रिमोट एमसीपी सर्वर रजिस्टर करें या कस्टम फ़ंक्शन (फ़ंक्शन कॉलिंग) तय करें.
- फ़ाइलें और स्किल: एनवायरमेंट में
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);
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 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 एजेंट हार्नेस, रनटाइम (कोड एक्ज़ीक्यूशन, फ़ाइल मैनेजमेंट, वेब ऐक्सेस) और आपके कॉन्फ़िगरेशन लेयर उपलब्ध कराता है.
टूल और सिस्टम के निर्देश
system_instruction और tools पैरामीटर का इस्तेमाल करके, किसी खास इंटरैक्शन के लिए एजेंट के व्यवहार और क्षमताओं को पसंद के मुताबिक बनाया जा सकता है.
- सिस्टम के निर्देश: इनलाइन टेक्स्ट पास करने के लिए
system_instructionपैरामीटर का इस्तेमाल करें. इससे एजेंट के व्यवहार को आकार दिया जा सकता है. यह उन बदलावों के लिए सबसे सही है जो हर कॉल के हिसाब से किए जाने चाहिए.system_instructionऔरAGENTS.mdदोनों को जोड़ा जा सकता है. अगर दोनों मौजूद हैं, तो दोनों लागू होते हैं. - टूल: डिफ़ॉल्ट तौर पर, Antigravity एजेंट के पास
code_execution,google_search, औरurl_contextका ऐक्सेस होता है. इंटरैक्शन के समय,toolsपैरामीटर पास करके इस सूची को बदला जा सकता है. रिमोट एमसीपी सर्वर रजिस्टर करके या कस्टम फ़ंक्शन (फ़ंक्शन कॉलिंग) तय करके, एजेंट को अपने एपीआई और डेटाबेस से भी कनेक्ट किया जा सकता है. उपलब्ध टूल के बारे में पूरी जानकारी पाने के लिए, Antigravity एजेंट: इस्तेमाल किए जा सकने वाले टूल देखें.
फ़ाइल के आधार पर पसंद के मुताबिक बनाना
एजेंट डायरेक्ट्री स्ट्रक्चर
कॉन्फ़िगरेशन को इनलाइन के तौर पर पास किया जा सकता है. हालांकि, हमारा सुझाव है कि एजेंट की फ़ाइलों को एक स्ट्रक्चर्ड डायरेक्ट्री में व्यवस्थित किया जाए. इससे, एजेंट के एनवायरमेंट में फ़ाइलों को मैनेज करना, वर्शन कंट्रोल करना, और माउंट करना आसान हो जाता है.
एजेंट के प्रोजेक्ट की डायरेक्ट्री आम तौर पर इस तरह दिखती है:
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);
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 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 में रखें. हार्नेस, इन्हें अपने-आप ढूंढकर रजिस्टर कर लेता है.
.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);
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": "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"
}
]
}
}'
.agents/skills/ और /.agents/skills/ से लोड की गई स्किल, दोनों अपने-आप ढूंढ ली जाती हैं.
मैनेज किया गया एजेंट बनाना
अपने कॉन्फ़िगरेशन में ज़रूरी बदलाव करने के बाद, agents.create की मदद से इसे मैनेज किए गए एजेंट के तौर पर बनाया जा सकता है. इससे, हर बार कॉन्फ़िगरेशन को दोहराए बिना, एजेंट को आईडी की मदद से शुरू किया जा सकता है.
मैनेज किया गया एजेंट बनाते समय, आपके प्रोजेक्ट के लिए तय किया गया id यूनीक होना चाहिए. साथ ही, यह रिज़र्व किए गए प्रीफ़िक्स (जैसे, google-, gemini-) से शुरू नहीं होना चाहिए. रिज़र्व किए गए प्रीफ़िक्स की पूरी सूची के लिए, एजेंट आईडी पर पाबंदियां देखें.
सोर्स से
सोर्स के साथ base_agent, id, agent_config, system_instruction, और base_environment तय करें. हर बार शुरू करने पर, प्लैटफ़ॉर्म आपके फ़ाइल के साथ एक नया सैंडबॉक्स उपलब्ध कराता है. उपलब्ध सोर्स टाइप (Git, GCS, इनलाइन) के लिए, एनवायरमेंट देखें.
Python
from google import genai
client = genai.Client()
agent = client.agents.create(
id="data-analyst",
base_agent="antigravity-preview-05-2026",
agent_config={
"type": "antigravity",
"model": "gemini-3.8-flash",
},
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",
agent_config: {
type: "antigravity",
model: "gemini-3.8-flash",
},
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}`);
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/agents" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"id": "data-analyst",
"base_agent": "antigravity-preview-05-2026",
"agent_config": {
"type": "antigravity",
"model": "gemini-3.8-flash"
},
"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"
}
]
}
}'
किसी मौजूदा एनवायरमेंट से (फ़ोर्क करना)
जब तक एनवायरमेंट सही न हो जाए (पैकेज इंस्टॉल किए गए हों, फ़ाइलें मौजूद हों), तब तक Antigravity के बेस एजेंट के साथ काम करें. इसके बाद, इसे मैनेज किए गए एजेंट में फ़ोर्क करें.
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}`);
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": "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}`);
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/agents" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-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);
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": "data-analyst",
"input": "Analyze Q1 revenue data from /workspace/templates/sample.csv and create a slide deck.",
"environment": "remote"
}'
सिलसिलेवार बातचीत और स्ट्रीमिंग के लिए, क्विकस्टार्ट देखें. मैनेज किए गए एजेंट पर भी previous_interaction_id और environment के वही पैटर्न लागू होते हैं.
मैनेज किए गए एजेंट, बैकग्राउंड में एक्ज़ीक्यूशन और रद्द करने की सुविधा भी देते हैं. ज़्यादा जानकारी और कोड के उदाहरण के लिए, Antigravity एजेंट: बैकग्राउंड में एक्ज़ीक्यूशन देखें.
शुरू करने के दौरान, कॉन्फ़िगरेशन को बदलना
इंटरैक्शन बनाते समय, एजेंट के डिफ़ॉल्ट system_instruction, tools, और environment नेटवर्क कॉन्फ़िगरेशन को बदला जा सकता है. इससे, सेव की गई एजेंट की परिभाषा में बदलाव किए बिना, किसी खास रन के लिए एजेंट के व्यवहार, क्षमताओं या क्रेडेंशियल में बदलाव किया जा सकता है.
सिस्टम के निर्देश और टूल बदलना
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);
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": "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"
}'
नेटवर्क कॉन्फ़िगरेशन बदलना (क्रेडेंशियल रीफ़्रेश करना)
अगर मैनेज किए गए एजेंट के base_environment में नेटवर्क क्रेडेंशियल शामिल हैं, तो उन्हें शुरू करने के दौरान बदला जा सकता है. इससे, खत्म हो चुके टोकन रीफ़्रेश किए जा सकते हैं या एपीआई कुंजियां रोटेट की जा सकती हैं. नया network कॉन्फ़िगरेशन वाला environment ऑब्जेक्ट पास करें. नए नेटवर्क के नियम, उस इंटरैक्शन के लिए पहले के नियमों की जगह पूरी तरह से ले लेते हैं. बेस एनवायरमेंट के सोर्स (फ़ाइलें, रिपॉज़िटरी) सुरक्षित रहते हैं.
Python
# Invoke the agent with a fresh token, overriding the base_environment credentials
result = client.interactions.create(
agent="issue-resolver",
input="Fix issue #42 and open a PR.",
environment={
"type": "remote",
"network": {
"allowlist": [
{
"domain": "api.github.com",
"transform": {
"Authorization": "Bearer ghp_REFRESHED_TOKEN"
},
},
{"domain": "pypi.org"},
]
},
},
)
print(result.output_text)
JavaScript
// Invoke the agent with a fresh token, overriding the base_environment credentials
const result = await client.interactions.create({
agent: "issue-resolver",
input: "Fix issue #42 and open a PR.",
environment: {
type: "remote",
network: {
allowlist: [
{
domain: "api.github.com",
transform: {
"Authorization": "Bearer ghp_REFRESHED_TOKEN"
},
},
{ domain: "pypi.org" },
]
},
},
}, { timeout: 300000 });
console.log(result.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": "issue-resolver",
"input": "Fix issue #42 and open a PR.",
"environment": {
"type": "remote",
"network": {
"allowlist": [
{
"domain": "api.github.com",
"transform": {
"Authorization": "Bearer ghp_REFRESHED_TOKEN"
}
},
{"domain": "pypi.org"}
]
}
}
}'
एजेंट मैनेज करना
एजेंट की सूची देखी जा सकती है, उन्हें पाया जा सकता है, और मिटाया जा सकता है.
एजेंट की सूची देखना
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}`);
}
}
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/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);
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/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");
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/agents/data-analyst" \
-H "x-goog-api-key: $GEMINI_API_KEY"
एजेंट की परिभाषा का रेफ़रंस
| फ़ील्ड | टाइप | ज़रूरी है | ब्यौरा |
|---|---|---|---|
id |
स्ट्रिंग | हां | Google Cloud प्रोजेक्ट में एजेंट का यूनीक आइडेंटिफ़ायर. इसका इस्तेमाल, एजेंट को शुरू करने के लिए किया जाता है. इसमें रिज़र्व किए गए प्रीफ़िक्स का इस्तेमाल नहीं किया जा सकता. एजेंट आईडी पर पाबंदियां देखें. |
description |
स्ट्रिंग | नहीं | एजेंट के बारे में ऐसी जानकारी जिसे कोई भी व्यक्ति आसानी से पढ़ सकता है. |
base_agent |
स्ट्रिंग | हां | बेस एजेंट का आईडी (जैसे, antigravity-preview-05-2026). |
agent_config |
ऑब्जेक्ट | नहीं | बेस एजेंट का कॉन्फ़िगरेशन. इसमें मॉडल चुनना ({"type": "antigravity", "model": "gemini-3.8-flash"}) शामिल है. अगर इसे छोड़ दिया जाता है, तो डिफ़ॉल्ट तौर पर gemini-3.8-flash मॉडल चुना जाता है. नाम वाले एजेंट के लिए, इंटरैक्शन के समय इसे बदला नहीं जा सकता. |
system_instruction |
स्ट्रिंग | नहीं | सिस्टम प्रॉम्प्ट, जो व्यवहार और पर्सोना तय करता है. |
tools |
अरे | नहीं | वे टूल जिनका इस्तेमाल एजेंट कर सकता है. अगर इसे छोड़ दिया जाता है, तो डिफ़ॉल्ट तौर पर code_execution, google_search, और url_context टूल चुने जाते हैं. इस्तेमाल किए जा सकने वाले टूल में code_execution, google_search, url_context, mcp_server, और कस्टम function की परिभाषाएं शामिल हैं. |
base_environment |
स्ट्रिंग या ऑब्जेक्ट | नहीं | "remote", environment_id, या sources और network वाला कॉन्फ़िगरेशन ऑब्जेक्ट. एनवायरमेंट देखें. |
एजेंट आईडी पर पाबंदियां
मैनेज किया गया एजेंट बनाते समय, आपके तय किए गए id पर ये नियम लागू होने चाहिए:
- यह आपके Google Cloud प्रोजेक्ट के लिए यूनीक होना चाहिए.
- यह रिज़र्व किए गए इन प्रीफ़िक्स (केस-इनसेंसिटिव) से शुरू नहीं होना चाहिए. ऐसा न करने पर, एजेंट नहीं बनाया जा सकेगा:
antigravity-veo-omni-lyria-imagen-gemma-gemini-google-youtube-android-chrome-pixel-waze-fitbit-nest-kaggle-
एक ही तरह के वीडियो दोहराने की रणनीति से जुड़ा वर्कफ़्लो
- Antigravity के बेस एजेंट के साथ प्रोटोटाइप बनाएं. सिस्टम के निर्देश और एनवायरमेंट सोर्स को इनलाइन के तौर पर पास करें. निर्देशों, स्किल, और एनवायरमेंट सेटअप को इंटरैक्टिव तरीके से टेस्ट करें.
- एनवायरमेंट को स्थिर करें. पैकेज इंस्टॉल करें, सोर्स माउंट करें, और पुष्टि करें कि सब कुछ काम कर रहा है.
- नया एजेंट बनाकर, इसे मैनेज किए गए एजेंट के तौर पर बनाए रखें. इसके लिए, सोर्स का इस्तेमाल करें या एनवायरमेंट को फ़ोर्क करें.
- एजेंट की परिभाषा को अपडेट करें. सिस्टम के निर्देश बदलें, स्किल बदलें या सोर्स जोड़ें. अगली बार शुरू करने पर, नया कॉन्फ़िगरेशन लागू हो जाएगा.
सीमाएं
- प्रीव्यू स्टेटस: मैनेज किए गए एजेंट, प्रीव्यू में हैं. इनकी सुविधाओं और स्कीमा में बदलाव हो सकता है.
- बेस एजेंट और मॉडल:
antigravity-preview-05-2026का इस्तेमाल सिर्फ़base_agentके तौर पर किया जा सकता है.agent_configमें,gemini-3.8-flash(डिफ़ॉल्ट),gemini-3.7-flash,gemini-3.6-flash,gemini-3.5-flash, औरgemini-3.5-flash-liteमॉडल के विकल्प इस्तेमाल किए जा सकते हैं. नाम वाले एजेंट के लिए, इंटरैक्शन के समय मॉडल को बदला नहीं जा सकता. - वर्शनिंग की सुविधा उपलब्ध नहीं है: एजेंट की वर्शनिंग और रोलबैक की सुविधा फ़िलहाल उपलब्ध नहीं है.
- सब-एजेंट नेस्टिंग की सुविधा उपलब्ध नहीं है: सब-एजेंट को डेलिगेट करने की सुविधा फ़िलहाल उपलब्ध नहीं है.
- ज़्यादा से ज़्यादा 1,000 मैनेज किए गए एजेंट बनाए जा सकते हैं.
आगे क्या करना है
- एजेंट की खास जानकारी: मैनेज किए गए एजेंट के मुख्य कॉन्सेप्ट के बारे में जानें.
- क्विकस्टार्ट: सिलसिलेवार बातचीत और स्ट्रीमिंग की सुविधा के साथ एजेंट बनाना शुरू करें.
- Antigravity एजेंट: डिफ़ॉल्ट एजेंट की क्षमताओं, टूल, और कीमत के बारे में जानें.
- एजेंट एनवायरमेंट: सैंडबॉक्स, सोर्स, और नेटवर्किंग कॉन्फ़िगर करें.
- एजेंट प्लैटफ़ॉर्म पर एजेंट बनाने और मैनेज करने की सुविधा का एपीआई: संगठन के लिए, पहले से मौजूद गवर्नेंस वाले एजेंट बनाने के लिए.