Gemini API のマネージド エージェントを使用すると、独自の指示、スキル、データで Antigravity エージェントを拡張できます。エージェントは、インタラクション時にインラインでカスタマイズすることも、ID で呼び出すマネージドエージェントとして構成を保存することもできます。
Antigravity エージェントをカスタマイズする
カスタム エージェントを構築する最も簡単な方法は、登録手順を必要とせずに、新しいインタラクションを作成しながら構成をインラインで渡すことです。エージェントは、次のようないくつかの重要な方法で拡張できます。
- モデルの選択: 基盤となる Gemini モデルを
agent_configで選択します(デフォルトは Gemini 3.7 Flash)。 - システム指示:
system_instructionを介してインライン テキストを渡し、動作を形成します。 - ツール: デフォルトのツール(コード実行、検索、URL コンテキスト)をオーバーライドする、リモート MCP サーバーを登録する、カスタム関数(関数呼び出し)を定義する。
- ファイルとスキル:
AGENTS.mdやSKILL.mdなどのファイルを環境にマウントします。
3 つすべてをインラインで渡す例を次に示します。
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);
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パラメータを渡すことでオーバーライドできます。リモート MCP サーバーを登録したり、カスタム関数(関数呼び出し)を定義して、エージェントを独自の API やデータベースに接続することもできます。利用可能なツールの詳細については、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