Agjentët e menaxhuar në Gemini API ju lejojnë të zgjeroni agjentin Antigravity me udhëzimet, aftësitë dhe të dhënat tuaja. Mund ta personalizoni agjentin brenda linjës në kohën e ndërveprimit ose ta ruani konfigurimin si një agjent të menaxhuar që e thirrni me anë të ID-së.
Personalizo agjentin antigravitacional
Mënyra më e shpejtë për të ndërtuar një agjent të personalizuar është të kaloni konfigurimin tuaj brenda linjës, ndërkohë që krijoni një ndërveprim të ri pa pasur nevojë për hapa regjistrimi. Mund ta zgjeroni agjentin në tre mënyra:
- Udhëzime të sistemit : Kaloni tekstin brenda rreshtit nëpërmjet
system_instructionpër të formësuar sjelljen. - Mjetet : Anuloni mjetet e parazgjedhura (Ekzekutimi i Kodit, Kërkimi, Konteksti i URL-së).
- Skedarët dhe aftësitë : Montoni skedarë si
AGENTS.mddheSKILL.mdnë mjedis.
Ja një shembull i kalimit të të trejave brenda rreshtit:
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);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Analyze the Q1 revenue data and create a slide deck.",
"system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",
"environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report."
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results."
}
]
}
}'
Çdo gjë përcaktohet në kohën e ndërveprimit. Nuk ka nevojë të regjistroni asgjë më parë. Pajisjet e agjentit Antigravity ofrojnë kohën e ekzekutimit (ekzekutimin e kodit, menaxhimin e skedarëve, aksesin në internet) dhe shtresat e konfigurimit tuaj në krye.
Mjetet dhe udhëzimet e sistemit
Ju mund të personalizoni sjelljen dhe aftësitë e agjentit për një bashkëveprim specifik duke përdorur parametrat system_instruction dhe tools .
- Udhëzimet e sistemit : Përdorni parametrin
system_instructionpër të kaluar tekstin brenda rreshtit që formëson sjelljen e agjentit. Kjo është ideale për ndryshime të shpejta që dëshironi të ndryshoni për çdo thirrje.system_instructiondheAGENTS.mdjanë shtesë; të dyja zbatohen kur janë të pranishme. - Mjetet : Si parazgjedhje, agjenti Antigravity ka qasje në
code_execution,google_searchdheurl_context. Mund ta anashkaloni këtë listë duke kaluar parametrintoolsnë kohën e ndërveprimit. Për detaje të plota mbi mjetet e disponueshme dhe si t'i përdorni ato, shihni Agjenti Antigravity: Mjetet e mbështetura .
Personalizim i bazuar në skedarë
Struktura e drejtorisë së agjentëve
Ndërkohë që mund ta kaloni konfigurimin brenda linjës, ne rekomandojmë organizimin e skedarëve të agjentit tuaj në një drejtori të strukturuar. Kjo e bën më të lehtë menaxhimin, kontrollin e versioneve dhe montimin në mjedisin e agjentit.
Një drejtori tipike e projektit të agjentit duket kështu:
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
Koha e ekzekutimit të Antigravity skanon .agents/ (dhe rrënjën e mjedisit) për këto skedarë.
AGENTS.md
Agjenti ngarkon automatikisht skedarët .agents/AGENTS.md (ose /.agents/AGENTS.md ) nga mjedisi si udhëzime të sistemit gjatë nisjes. Përdorni AGENTS.md për përkufizime të gjata të personazheve, udhëzime të hollësishme dhe udhëzime të versionit që dëshironi të kontrolloni së bashku me kodin tuaj.
Montoni një AGENTS.md duke përdorur një burim të brendshëm:
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);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Analyze the Q1 revenue data and create a report.",
"system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",
"environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report."
}
]
}
}'
Aftësi: SKILL.md
Aftësitë janë skedarë që zgjerojnë aftësitë e agjentit. Vendosini ato nën .agents/skills/<skill-name>/SKILL.md dhe harness-i i zbulon dhe i regjistron automatikisht ato.
.agents/
├── AGENTS.md
└── skills/
└── slide-maker/
└── SKILL.md
Montoni një aftësi duke përdorur një burim burimor brenda linjës:
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);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Create a presentation about our Q1 results.",
"system_instruction": "You create presentations from data.",
"environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\ndescription: Create HTML slide decks\n---\n# Slide Maker\n\nWhen asked to create a presentation:\n1. Analyze the input data\n2. Create an HTML slide deck with reveal.js\n3. Save to /workspace/output/slides.html"
}
]
}
}'
Aftësitë e ngarkuara nga .agents/skills/ dhe /.agents/skills/ zbulohen automatikisht.
Krijo një agjent të menaxhuar
Pasi ta keni përsëritur konfigurimin tuaj, mund ta krijoni atë si një agjent të menaxhuar me agents.create . Kjo ju lejon të thirrni agjentin sipas ID-së pa e përsëritur konfigurimin çdo herë.
Nga burimet
Specifikoni base_agent , id , system_instruction dhe base_environment me burimet. Platforma ofron një sandbox të ri me skedarët tuaj në çdo thirrje. Shihni Mjediset për llojet e burimeve të disponueshme (Git, GCS, inline).
Python
from google import genai
client = genai.Client()
agent = client.agents.create(
id="data-analyst",
base_agent="antigravity-preview-05-2026",
system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",
base_environment={
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report.",
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results.",
},
{
"type": "repository",
"source": "https://github.com/my-org/analysis-templates",
"target": "/workspace/templates",
},
],
},
)
print(f"Created agent: {agent.id}")
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const agent = await client.agents.create({
id: "data-analyst",
base_agent: "antigravity-preview-05-2026",
system_instruction: "You are a data analyst. Always include visualizations and export results as PDF.",
base_environment: {
type: "remote",
sources: [
{
type: "inline",
target: ".agents/AGENTS.md",
content: "Always use matplotlib for charts. Include a summary table in every report.",
},
{
type: "inline",
target: ".agents/skills/slide-maker/SKILL.md",
content: "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results.",
},
{
type: "repository",
source: "https://github.com/my-org/analysis-templates",
target: "/workspace/templates",
},
],
},
});
console.log(`Created agent: ${agent.id}`);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/agents" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"id": "data-analyst",
"base_agent": "antigravity-preview-05-2026",
"system_instruction": "You are a data analyst. Always include visualizations and export results as PDF.",
"base_environment": {
"type": "remote",
"sources": [
{
"type": "inline",
"target": ".agents/AGENTS.md",
"content": "Always use matplotlib for charts. Include a summary table in every report."
},
{
"type": "inline",
"target": ".agents/skills/slide-maker/SKILL.md",
"content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks from data analysis results."
},
{
"type": "repository",
"source": "https://github.com/my-org/analysis-templates",
"target": "/workspace/templates"
}
]
}
}'
Nga një mjedis ekzistues (fork)
Përsëriteni me agjentin bazë Antigravity derisa mjedisi të jetë i duhuri (paketat e instaluara, skedarët në vend), pastaj transferojeni atë në një agjent të menaxhuar.
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}`);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Install pandas, matplotlib, and seaborn. Create an analysis template at /workspace/template.py.",
"environment": "remote"
}'
Me rregullat e rrjetit
Mund të bllokoni aksesin dalës ose të injektoni kredenciale kur ruani një agjent të menaxhuar. Për skemën e plotë të listës së lejimeve, modelet e kredencialeve dhe shenjat dalluese, shihni Mjediset: Konfigurimi i rrjetit .
Shembulli i mëposhtëm krijon një agjent issue-resolver që mund të hyjë vetëm në GitHub dhe PyPI, me kredencialet e injektuara për 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}`);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/agents" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"id": "issue-resolver",
"base_agent": "antigravity-preview-05-2026",
"system_instruction": "You resolve GitHub issues. Clone the repo, find the bug, write the fix, run the tests, and open a PR.",
"base_environment": {
"type": "remote",
"sources": [
{
"type": "repository",
"source": "https://github.com/my-org/backend",
"target": "/workspace/repo"
}
],
"network": {
"allowlist": [
{
"domain": "api.github.com",
"transform": {
"Authorization": "Basic YOUR_BASE64_TOKEN"
}
},
{"domain": "pypi.org"}
]
}
}
}'
Thirrni agjentin
Thirrni agjentin tuaj të menaxhuar me ID-në e agjentit tuaj duke krijuar një bashkëveprim të ri. Çdo thirrje e ndan mjedisin bazë, kështu që çdo ekzekutim fillon i pastër.
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);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "data-analyst",
"input": "Analyze Q1 revenue data from /workspace/templates/sample.csv and create a slide deck.",
"environment": "remote"
}'
Për biseda dhe transmetime me shumë kthesa, shihni Fillimin e Shpejtë . Të njëjtat modele previous_interaction_id dhe environment zbatohen edhe për agjentët e menaxhuar.
Konfigurimi mbivendoset gjatë thirrjes
Mund të anashkaloni system_instruction dhe tools e parazgjedhura të agjentit kur krijoni një bashkëveprim. Kjo ju lejon të modifikoni sjelljen ose aftësitë e agjentit për një ekzekutim specifik pa ndryshuar përkufizimin e ruajtur të agjentit.
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);
PUSHTIM
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
"agent": "data-analyst",
"input": "Analyze Q1 revenue data, but do not create a slide deck. Just output a summary table.",
"system_instruction": "You are a data analyst. Focus ONLY on summary tables. Ignore default instructions about slides.",
"tools": [{"type": "code_execution"}],
"environment": "remote"
}'
Menaxho agjentët
Ju mund të listoni, merrni dhe fshini agjentë.
Agjentët e listës
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}`);
}
}
PUSHTIM
curl -X GET "https://generativelanguage.googleapis.com/v1beta/agents" \
-H "x-goog-api-key: $GEMINI_API_KEY"
Merrni një agjent
Python
agent = client.agents.get(id="data-analyst")
print(agent)
JavaScript
const agent = await client.agents.get("data-analyst");
console.log(agent);
PUSHTIM
curl -X GET "https://generativelanguage.googleapis.com/v1beta/agents/data-analyst" \
-H "x-goog-api-key: $GEMINI_API_KEY"
Fshi një agjent
Fshirja e heq konfigurimin. Mjediset ekzistuese dhe ndërveprimet e krijuara nga agjenti nuk preken.
Python
client.agents.delete(id="data-analyst")
JavaScript
await client.agents.delete("data-analyst");
PUSHTIM
curl -X DELETE "https://generativelanguage.googleapis.com/v1beta/agents/data-analyst" \
-H "x-goog-api-key: $GEMINI_API_KEY"
Referenca e përkufizimit të agjentit
| Fushë | Lloji | E detyrueshme | Përshkrimi |
|---|---|---|---|
id | varg | Po | Identifikues unik i agjentit. Përdoret për të thirrur agjentin. |
description | varg | Jo | Përshkrim i agjentit i lexueshëm nga njeriu. |
base_agent | varg | Po | ID e agjentit bazë (p.sh., antigravity-preview-05-2026 ). |
system_instruction | varg | Jo | Kërkesa e sistemit që përcakton sjelljen dhe personalitetin. |
tools | varg ose objekt | Jo | Mjetet që agjenti mund të përdorë, të lëna jashtë, do të kenë qasje në code_execution , google_search dhe url_context . |
base_environment | varg ose objekt | Jo | "remote" , një environment_id ose një objekt konfigurimi me sources dhe network . Shihni Mjediset. |
Fluksi i punës iteracionale
- Prototip me agjentin bazë të Antigravitetit. Kaloni udhëzimet e sistemit dhe burimet e mjedisit në linjë. Testoni udhëzimet, aftësitë dhe konfigurimin e mjedisit në mënyrë interaktive.
- Stabilizoni mjedisin. Instaloni paketa, montoni burimet, verifikoni që gjithçka funksionon.
- Vazhdoni si një agjent i menaxhuar duke krijuar një agjent të ri, ose nga burimet ose duke ndarë mjedisin.
- Përditësoni përkufizimin e agjentit. Ndryshoni udhëzimet e sistemit, ndërroni aftësitë ose shtoni burimet. Thirrja tjetër merr konfigurimin e ri.
Kufizime
- Statusi i pamjes paraprake : Agjentët e menaxhuar janë në pamje paraprake. Karakteristikat dhe skemat mund të ndryshojnë.
- Agjent bazë : Vetëm
antigravity-preview-05-2026mbështetet sibase_agent. - Pa versionim : Versionimi dhe rikthimi i agjentit nuk janë ende të disponueshme.
- Pa folezim të subagjentëve : Delegimi i subagjentëve nuk mbështetet ende.
- Mund të keni deri në 1000 agjentë të menaxhuar.
Çfarë vjen më pas
- Përmbledhje e Agjentëve : Mësoni rreth koncepteve kryesore të agjentëve të menaxhuar.
- Fillim i shpejtë : Filloni ndërtimin me biseda dhe transmetime me shumë kthesa.
- Agjent Antigravitacional : Eksploroni aftësitë, mjetet dhe çmimet për agjentin parazgjedhur.
- Mjediset e Agjentëve : Konfiguroni sandbox-et, burimet dhe rrjetëzimin.