curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-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);
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import com.google.genai.Client;
import com.google.genai.gaos.models.operations.CreateAgentResponse;
import com.google.genai.gaos.models.interactions.GoogleSearch;
Client client = new Client();
String agentId = "research-assistant-" + UUID.randomUUID().toString().substring(0, 8);
Agent agent =
Agent.builder()
.id(agentId)
.baseAgent("antigravity-preview-05-2026")
.description("A helpful research assistant.")
.systemInstruction("You are a helpful research assistant.")
.baseEnvironment(BaseEnvironment.of("remote"))
.tools(List.of(new GoogleSearch()))
.build();
CreateAgentResponse response = client.agents.create(agent);
System.out.println(response.agent().flatMap(Agent::id).orElse(""));