Source-backed implementation notes
Google's Gemini 3.5 announcement confirms a developer focus across Gemini API, Google AI Studio, Android Studio, and Antigravity. The managed agents documentation is the important part for this page because Antigravity Agent is not just another completion endpoint.
Use this as a starting pattern, then confirm the latest SDK method names in the official docs before production:
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
apiKey: process.env.GEMINI_API_KEY,
});
const first = await ai.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Create a small TypeScript slugify helper and include tests.",
environment: { type: "remote" },
});
console.log(first.id);
console.log(first.environment_id);
For follow-up work, keep the state explicit:
const second = await ai.interactions.create({
agent: "antigravity-preview-05-2026",
previous_interaction_id: first.id,
environment: first.environment_id,
input: "Add edge cases for punctuation, whitespace, and duplicate separators.",
});
console.log(second.output_text);
If the SDK shape changes during preview, keep the same architecture: one API key, one small task, one stored interaction ID, one stored environment ID, then a review gate.
Troubleshooting checklist
401 or authentication failure: confirm GEMINI_API_KEY is exported in the same shell or deployment environment that runs the script.
- Unknown agent ID: verify the current Antigravity Agent identifier in the managed agents docs.
- Follow-up loses context: check that you passed
previous_interaction_id from the first response, not a locally generated request ID.
- Files disappear between turns: confirm whether you are reusing the environment ID and whether the preview API keeps that environment available for your account.
- Output is too broad: reduce the task to one file, one test, or one generated artifact.
Practical guardrail
Do not let a managed agent write directly to production repositories during the first week of adoption. Save generated artifacts, inspect them, run tests, and only then copy or commit the result.