Antigravity エージェント

Antigravity エージェントは、Gemini API の汎用マネージド エージェントです。1 回の API 呼び出しで、Google がホストする独自の安全な Linux サンドボックス内で推論、コードの実行、ファイルの管理、ウェブの閲覧を行うエージェントを取得できます。

Gemini 3.5 Flash を搭載し、Antigravity IDE と同じハーネスを使用します。Interactions APIGoogle AI Studio を介して使用できます。

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
    environment="remote",
)

print(interaction.output_text)

JavaScript

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

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
    environment: "remote",
}, { timeout: 300000 });

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
    "agent": "antigravity-preview-05-2026",
    "input": "Read Hacker News, summarize the top 10 stories, and save the results as a PDF.",
    "environment": "remote"
}'

機能

呼び出しごとに Linux サンドボックスがプロビジョニングされ、ツール使用ループが開始されます。エージェントは、タスクが完了するまで、計画、行動、結果の観察を繰り返します。

  • コード実行: Bash、Python、Node.js コマンドを実行します。パッケージのインストール、テストの実行、アプリのビルドを行います。
  • ファイル管理: サンドボックス内のファイルの読み取り、書き込み、編集、検索、一覧表示を行います。ファイルはインタラクション全体で保持されます。
  • ウェブアクセス: Google 検索と URL フェッチによるデータ取得を行います。
  • コンテキストの圧縮: 自動コンテキスト圧縮(約 135, 000 トークンでトリガー)により、コンテキストを失ったりトークン上限に達したりすることなく、長時間実行される複数ターンのセッションをサポートします。

複数ターンの使用とストリーミングについては、クイックスタートをご覧ください。

サポートされているツール

デフォルトでは、エージェントは code_executiongoogle_searchurl_context にアクセスできます。environment パラメータを指定すると、ファイルシステム ツールが自動的に有効になります。デフォルト セットをカスタマイズまたは制限する場合は、tools パラメータを指定する必要があります。

ツール Type 値 説明
コードを実行する code_execution stdout/stderr キャプチャを使用してシェル コマンド(bash、Python、Node)を実行します。
Google 検索 google_search 公開ウェブを検索します。
URL コンテキスト url_context ウェブページをフェッチして読み取ります。
ファイルシステム environment で有効) サンドボックス内のファイルの読み取り、書き込み、編集、検索、一覧表示を行います。個別のツールタイプはありません。environment が設定されると自動的に有効になります。

エージェントを特定のツールに制限するには、必要なツールのみを渡します。

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Search for the latest AI research papers on reasoning and summarize them.",
    environment="remote",
    tools=[
        {"type": "google_search"},
        {"type": "url_context"},
    ],
)

print(interaction.output_text)

JavaScript

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

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: "Search for the latest AI research papers on reasoning and summarize them.",
    environment: "remote",
    tools: [
        { type: "google_search" },
        { type: "url_context" },
    ],
}, { timeout: 300000 });

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
    "agent": "antigravity-preview-05-2026",
    "input": "Search for the latest AI research papers on reasoning and summarize them.",
    "environment": "remote",
    "tools": [
        {"type": "google_search"},
        {"type": "url_context"}
    ]
}'

マルチモーダル入力

Antigravity エージェントはマルチモーダル入力をサポートしています。現在サポートされている入力は textimage のみです。画像はインラインの base64 エンコード文字列(data)として指定する必要があります。

Python

import base64
from google import genai

client = genai.Client()

with open("path/to/chart.png", "rb") as f:
    image_bytes = f.read()

interaction_inline = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input=[
        {"type": "text", "text": "Analyze this chart and summarize the trends."},
        {
            "type": "image",
            "data": base64.b64encode(image_bytes).decode("utf-8"),
            "mime_type": "image/png",
        },
    ],
    environment="remote",
)

JavaScript


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

import * as fs from "node:fs";

const client = new GoogleGenAI({});
const base64Image = fs.readFileSync("path/to/chart.png", { encoding: "base64" });

const interactionInline = await client.interactions.create({
    agent: "antigravity-preview-05-2026",
    input: [
        { type: "text", text: "Analyze this chart and summarize the trends." },
        {
            type: "image",
            data: base64Image,
            mime_type: "image/png",
        },
    ],
    environment: "remote",
}, { timeout: 300000 });

REST

BASE64_IMAGE=$(base64 -w0 /path/to/chart.png)

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d "{
    \"agent\": \"antigravity-preview-05-2026\",
    \"input\": [
        {\"type\": \"text\", \"text\": \"Analyze this chart and summarize the trends.\"},
        {
            \"type\": \"image\",
            \"mime_type\": \"image/png\",
            \"data\": \"$BASE64_IMAGE\"
        }
    ],
    \"environment\": \"remote\"
}"

システム指示

インライン プロンプトの system_instruction を使用するか、指示ファイルを環境にマウントして、エージェントの動作をカスタマイズします。

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    agent="antigravity-preview-05-2026",
    input="Analyze the uploaded CSV and create a report.",
    environment="remote",
    system_instruction="You are a data analyst. Always include visualizations and export results as PDF.",
)

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 uploaded CSV and create a report.",
    environment: "remote",
    system_instruction: "You are a data analyst. Always include visualizations and export results as PDF.",
}, { timeout: 300000 });

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Api-Revision: 2026-05-20" \
-d '{
    "agent": "antigravity-preview-05-2026",
    "input": "Analyze the uploaded CSV and create a report.",
    "environment": "remote",
    "system_instruction": "You are a data analyst. Always include visualizations and export results as PDF."
}'

エージェントは、環境から指示ファイルを自動的に読み込みます。

  • AGENTS.md: .agents/ またはワークスペースのルートにある場合、システム指示として追加されます。
  • SKILL.md: .agents/skills/ から読み込まれ、エージェントが呼び出すことができる機能として登録されます。

次に例を示します。

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.",
    environment={
        "type": "remote",
        "sources": [
            {
                "type": "inline",
                "target": ".agents/AGENTS.md",
                "content": "You are a data analyst. Always use matplotlib for charts.",
            },
            {
                "type": "inline",
                "target": ".agents/skills/slide-maker/SKILL.md",
                "content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks...",
            },
        ],
    },
)

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.",
    environment: {
        type: "remote",
        sources: [
            {
                type: "inline",
                target: ".agents/AGENTS.md",
                content: "You are a data analyst. Always use matplotlib for charts.",
            },
            {
                type: "inline",
                target: ".agents/skills/slide-maker/SKILL.md",
                content: "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks...",
            },
        ],
    },
}, { timeout: 300000 });

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $API_KEY" \
-d '{
    "agent": "antigravity-preview-05-2026",
    "input": "Analyze the Q1 revenue data and create a slide deck.",
    "environment": {
        "type": "remote",
        "sources": [
            {
                "type": "inline",
                "target": ".agents/AGENTS.md",
                "content": "You are a data analyst. Always use matplotlib for charts."
            },
            {
                "type": "inline",
                "target": ".agents/skills/slide-maker/SKILL.md",
                "content": "---\nname: slide-maker\n---\n# Slide Maker\nCreate HTML slide decks..."
            }
        ]
    }
}'

エージェント定義の完全な形式と再利用可能な名前付きエージェントについては、カスタム エージェントの構築をご覧ください。

環境

呼び出しごとに Linux サンドボックスが作成または再利用されます。environment パラメータには次の 3 つの形式があります。

フォーム 説明
"remote" デフォルト設定で新しいサンドボックスをプロビジョニングします。
"env_abc123" ID で既存の環境を再利用し、すべてのファイルと状態を保持します。
{...} カスタムソースとネットワーク ルールを含む完全な EnvironmentConfig

ソース(Git、GCS、インライン)、ネットワーキング、ライフサイクル、リソース上限の詳細については、環境をご覧ください。

リリース情報と料金

Antigravity エージェントは、Google AI Studio の Interactions API と Gemini API を介してプレビュー版で提供されています。

料金は、基盤となる Gemini モデルのトークンとエージェントが使用するツールに基づく従量課金制モデルです。単一の出力を生成する標準のチャット リクエストとは異なり、Antigravity インタラクションはエージェント ワークフローです。1 回のリクエストで、推論、ツールの実行、コードの実行、ファイル管理の自律ループがトリガーされます。

推定費用

費用はタスクの複雑さによって異なります。エージェントは、必要なツール呼び出し、コード実行、ファイル操作の数を自律的に決定します。次の見積もりは、実行に基づいています。

タスクのカテゴリ 入力トークン 出力トークン 一般的な費用
調査と情報の合成 10 万~ 50 万 1 万~ 4 万 $0.30 ~$1.00
ドキュメントとコンテンツの生成 10 万~ 50 万 1 万 5 千~ 5 万 $0.30 ~$1.30
プロセスとシステムの設計 10 万~ 40 万 1 万~ 3 万 $0.25 ~$0.80
データ処理と分析 30 万~ 300 万 3 万~ 15 万 $0.70 ~$3.25

通常、入力トークンの 50 ~ 70% がキャッシュに保存されます。多くのツール呼び出しを含む複雑なエージェント ワークフローでは、1 回のインタラクションで 300 万~ 500 万トークンが蓄積され、費用は最大$5 になる可能性があります。

プレビュー期間中は、環境コンピューティング (CPU、メモリ、サンドボックス実行)は課金されません

制限事項

  • プレビュー ステータス: Antigravity エージェントと Interactions API はプレビュー版です。機能とスキーマは変更される可能性があります。
  • サポートされていない生成構成: 次のパラメータはサポートされておらず、400 エラーが返されます: temperaturetop_ptop_kstop_sequencesmax_output_tokens
  • 構造化出力: Antigravity エージェントは構造化出力をサポートしていません。
  • 利用できないツール: file_searchcomputer_usegoogle_mapsfunction_callingmcp はまだサポートされていません。
  • ファイルシステム ツール: 現在、ファイルシステム ツールはありません。これは environment の一部です。
  • バックグラウンド: エージェントは background=True の使用をサポートしておらず、store=True が必要です。
  • サポートされていないマルチモーダル タイプ。現時点では、音声、動画、ドキュメントの入力はサポートされていません。テキストと画像のみが許可されます。

次のステップ