شروع سریع عامل‌های مدیریت‌شده

این راهنما شما را در ایجاد و استفاده از Managed Agents در Gemini API با استفاده از Antigravity agent راهنمایی می‌کند. شما اولین تماس خود با Agent را برقرار می‌کنید، یک مکالمه چند مرحله‌ای را ادامه می‌دهید، پاسخ را پخش می‌کنید، فایل‌ها را از sandbox دانلود می‌کنید و با Antigravity agent کار می‌کنید.

اولین تعامل با کارشناس خود را اجرا کنید

یک فراخوانی واحد به API تعاملات، یک جعبه شنی لینوکس را فراهم می‌کند، حلقه عامل را اجرا می‌کند و نتیجه را برمی‌گرداند. شما سه پارامتر تعریف خواهید کرد:

  • agent را با عنوان "antigravity-preview-05-2026", که نسخه فعلی عامل از پیش تعریف شده و همه منظوره مدیریت شده ماست.
  • برای ایجاد یک محیط سندباکس جدید و تازه، environment="remote" را تعریف کنید.
  • یک ورودی ایجاد کنید و مشخص کنید که می‌خواهید عامل چه کاری انجام دهد.

پایتون

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Write a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt. Then read the file and print its contents.",
    environment="remote",
)

# Print the agent's final output
print(f"Interaction ID: {interaction.id}")
print(f"Environment ID: {interaction.environment_id}")
print(f"Output: {interaction.output_text}")

جاوا اسکریپت

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

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Write a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt. Then read the file and print its contents.",
    environment: "remote",
});

console.log(`Interaction ID: ${interaction.id}`);
console.log(`Environment ID: ${interaction.environment_id}`);

console.