curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-H "Api-Revision: 2026-05-20" \
-d '{
"id": "research-assistant-abc123",
"base_agent": "antigravity-preview-05-2026",
"description": "A helpful research assistant.",
"system_instruction": "You are a helpful research assistant.",
"base_environment": "remote",
"tools": [{"type": "google_search"}]
}'
import uuid
from google import genai
client = genai.Client()
agent = client.agents.create(
id=f"research-assistant-{uuid.uuid4().hex[:8]}",
base_agent="antigravity-preview-05-2026",
description="A helpful research assistant.",
system_instruction="You are a helpful research assistant.",
base_environment="remote",
tools=[{"type": "google_search"}],
)
print(agent.id)
import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({});
const agentId = `research-assistant-${crypto.randomUUID().slice(0, 8)}`;
const agent = await ai.agents.create({
id: agentId,
base_agent: 'antigravity-preview-05-2026',
description: 'A helpful research assistant.',
system_instruction: 'You are a helpful research assistant.',
base_environment: 'remote',
tools: [{ type: 'google_search' }],
});
if (!agent.id) {
throw new Error('Agent creation failed: ID is undefined');
}
console.log(agent.id);