Пример запроса
# Step 1: Create a custom agent.
curl -X POST https://generativelanguage.googleapis.com/v1beta/agents \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "code-reviewer",
"base_agent": "antigravity-preview-05-2026",
"system_instruction": "You are a senior code reviewer. Check every file for bugs, style issues, and security vulnerabilities.",
"base_environment": {
"type": "remote",
"sources": [{
"type": "repository",
"source": "https://github.com/octocat/Spoon-Knife",
"target": "/workspace/repo"
}]
}
}'
# Step 2: Use the custom agent.
curl -X POST https://generativelanguage.googleapis.com/v1beta/interactions \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent": "code-reviewer",
"input": "Review the latest changes in /workspace/repo/src and file a summary.",
"environment": "remote"
}' import uuid
from google import genai
client = genai.Client()
# Step 1: Create a custom agent.
agent_id = f"code-reviewer-{uuid.uuid4().hex[:8]}"
client.agents.create(
id=agent_id,
base_agent="antigravity-preview-05-2026",
system_instruction="You are a senior code reviewer. Check every file for bugs, style issues, and security vulnerabilities.",
base_environment={
"type": "remote",
"sources": [{
"type": "repository",
"source": "https://github.com/octocat/Spoon-Knife",
"target": "/workspace/repo",
}],
},
)
# Step 2: Use the custom agent.
result = client.interactions.create(
agent=agent_id,
input="Review the latest changes in /workspace/repo/src and file a summary.",
environment="remote",
)
print(result.output_text)
import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({});
// Step 1: Create a custom agent.
const agentId = `code-reviewer-${crypto.randomUUID().slice(0, 8)}`;
await ai.agents.create({
id: agentId,
base_agent: 'antigravity-preview-05-2026',
system_instruction: 'You are a senior code reviewer. Check every file for bugs, style issues, and security vulnerabilities.',
base_environment: {
type: 'remote',
sources: [{
type: 'repository',
source: 'https://github.com/octocat/Spoon-Knife',
target: '/workspace/repo',
}],
},
});
// Step 2: Use the custom agent.
const result = await ai.interactions.create({
agent: agentId,
input: 'Review the latest changes in /workspace/repo/src and file a summary.',
environment: 'remote',
});
console.log(result.output_text);
import com.google.genai.Client;
import com.google.genai.gaos.models.agents.Agent;
import com.google.genai.gaos.models.agents.BaseEnvironment;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment;
import com.google.genai.gaos.models.interactions.Environment;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Source;
import com.google.genai.gaos.models.interactions.SourceType;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import com.google.genai.gaos.models.operations.CreateInteractionResponse;
import java.util.List;
import java.util.UUID;
Client client = new Client();
// Step 1: Create a custom agent.
String agentId = "code-reviewer-" + UUID.randomUUID().toString().substring(0, 8);
Environment baseEnv = Environment.builder()
.sources(List.of(
Source.builder()
.type(SourceType.REPOSITORY)
.source("https://github.com/octocat/Spoon-Knife")
.target("/workspace/repo")
.build()
))
.build();
Agent customAgent = Agent.builder()
.id(agentId)
.baseAgent("antigravity-preview-05-2026")
.systemInstruction("You are a senior code reviewer. Check every file for bugs, style issues, and security vulnerabilities.")
.baseEnvironment(BaseEnvironment.of(baseEnv))
.build();
client.agents.create(customAgent);
// Step 2: Use the custom agent.
CreateAgentInteraction params =
CreateAgentInteraction.builder()
.agent(AgentOption.of(agentId))
.input(InteractionsInput.of("Review the latest changes in /workspace/repo/src and file a summary."))
.environment(CreateAgentInteractionEnvironment.of("remote"))
.build();
CreateInteractionResponse response =
client.interactions.create(CreateInteractionRequestBody.of(params));
Interaction interaction =
response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
System.out.println(interaction.outputText().orElse(""));