DIRTY STATIC / DISPATCH Tutorials04 DEC 2026 • 11 MIN READ
Two terminal workstations in a concrete room passing a glowing caution yellow task envelope across a desk
TutorialsINTELLIGENCE FOR THE MACHINE AGE

Call Antigravity As Subagent From Claude Code

Since December 1, Google's Antigravity terms explicitly allow calling the unmodified agy CLI as a tool or subagent from another harness. This tutorial installs agy, signs in once, makes a first headless call, then wraps that call in a Claude Code subagent file so Claude can delegate reviews and second opinions to Gemini on its own.

Start reading ↓

For months, calling Google Antigravity from inside another coding agent sat in a grey zone. People did it anyway, then worried about their accounts. On December 1, 2026, Google rewrote section 6 of the Antigravity terms and settled the question. Running the unmodified Antigravity harness through its supported interfaces is permitted, and the terms name the exact pattern this tutorial builds: calling it as a tool or subagent from another harness, and using the Antigravity CLI in headless mode.

That means Claude Code can stay in charge of your session while Antigravity does delegated work in its own loop, with its own sign in, and hands a finished answer back. A second model reads the same code with different blind spots. Reviews, plan checks, and bug hunts are the obvious jobs for it.

The line Google draws is just as clear as the permission. Your Antigravity sign in stays inside agy. Extracting its OAuth tokens for use in other software is still banned, and so is using agy as a raw model proxy that drives another agent loop. This tutorial stays on the right side of both rules: Claude Code starts agy, gives it a task, and reads what comes back. Facts in this guide were checked against Google’s Antigravity documentation and terms on December 4, 2026. No step here is presented as a personal test run.

What You Will Build or Learn

You will build a small bridge with two layers. The first layer is a direct shell call: Claude Code, or you, runs agy -p in headless mode and gets a structured answer back. The second layer is a Claude Code subagent definition that runs that call for you, so delegation becomes part of a normal session instead of a command you paste each time.

By the end you will know how to pick a model your account can actually use, how to keep delegated work in review only mode, how to resume a delegated thread for a follow up question, and how to read the JSON envelope well enough to spot a run that quietly failed. If the idea of a second model checking the first is new to you, our earlier guide to auditing Claude Code with a second model covers why the pattern is worth the setup.

A central terminal in a concrete control room sending a glowing caution yellow sheet to a side terminal and receiving it back stamped The shape of the whole setup: one agent delegates, the other answers, and the first agent decides what to do with the result. Illustration: Dirty Static

Before You Begin

Decide what work you plan to delegate before you write any files. Review only work is the safe starting point, because plan mode keeps Antigravity from editing files while it reads and reports. Delegating edits is possible later, once you trust the flow, and it deserves its own permission rules. Start narrow.

One more expectation to set: a delegated call is a full agent run, not a quick completion. Google’s docs show even a one sentence question using about ten thousand input tokens, because the harness loads its own context. Treat each call as a deliberate step, not a reflex.

Steps

Step 1: Install the Antigravity CLI

On macOS or Linux, run Google’s install script, then confirm the binary answers:

macOS and Linux · Terminal

curl -fsSL https://antigravity.google/cli/install.sh | bash
agy --version

Expected result: the version command prints your installed agy version. Google also publishes PowerShell and CMD installers for Windows on the same Antigravity site. If agy is not found after installing, open a fresh terminal so your shell picks up the updated path.

Step 2: Sign in once, interactively

Start a normal interactive session and complete the Google sign in it offers:

Terminal

agy

Expected result: on a desktop, agy reads your OS keyring or opens a browser so you can sign in with your Google account. Over SSH it prints an address to open on your own machine instead. Google’s ACP documentation lists agy acp --login as a second sign in route. Quit the session when sign in completes. Every headless call after this reuses those saved credentials.

Step 3: List the models your account can use

Model slugs differ by account, and headless mode refuses to guess. Ask the CLI what you have, and note the exact slug of the Gemini model you want for delegated work:

Terminal

agy models

Expected result: a list of model slugs beside their display names. In one published account of this workflow, the list included gemini-4-neon-high, gemini-4-neon-medium, gemini-4-neon-low, and gemini-4-hydrogen-low. Your list is the source of truth, not that example. A slug the CLI does not know exits with an error rather than falling back to a different model, which is what you want in a script.

Step 4: Make your first headless call

Run one small review task directly, before wiring anything into Claude Code. This example asks for a review only pass over one file and returns the JSON envelope:

Terminal

agy -p "Read src/auth/session.ts only. Do not run shell commands and do not edit files. List the top 3 edge cases, cite line numbers, and be concise." --model gemini-4-neon-low --mode plan --output-format json --print-timeout 180s

Expected result: one JSON object on stdout with fields including conversation_id, status, response, duration_seconds, and usage. Swap in a real file from your project and the exact slug from your own agy models list. The two safety rails matter: --mode plan keeps the run in review mode, and the prompt itself tells the agent not to run shell commands, because headless mode soft denies tool actions it cannot ask about and still reports success. Pipe through jq when you want the envelope in a readable shape:

Terminal

agy -p "Read src/auth/session.ts only. Do not run shell commands and do not edit files. List the top 3 edge cases, cite line numbers, and be concise." --model gemini-4-neon-low --mode plan --output-format json --print-timeout 180s | jq '{status, duration_seconds, usage, denied_actions}'

Step 5: Wrap the call in a Claude Code subagent

A Claude Code subagent is a Markdown file with YAML front matter and a system prompt. Save this one as .claude/agents/antigravity-reviewer.md inside a project to share it with that project, or as ~/.claude/agents/antigravity-reviewer.md to use it in every project:

---
name: antigravity-reviewer
description: Gets an independent second opinion from Google Antigravity on a code review, a plan, or a bug hunt. Use when a check from a different model would help.
tools: Bash
model: haiku
---

You are a bridge to Google Antigravity. You do not review code yourself.

When given a task, run exactly one command, replacing TASK with the task text and MODEL with a slug from `agy models` on this machine:

agy -p "TASK. Do not run shell commands and do not edit files." --model MODEL --mode plan --output-format json --print-timeout 180s

Then read the JSON output. If status is not SUCCESS, or denied_actions is present and not empty, say so plainly and include the error. Otherwise return the response text, followed by the duration_seconds and total token count from usage.

Expected result: the file exists in the agents folder with the front matter intact. The tools: Bash line is deliberate: this subagent can do one thing, run the shell command, and nothing else. Its own model can be a small one, since the heavy thinking happens on the Antigravity side.

Step 6: Delegate from a Claude Code session

Start Claude Code in the same project and ask for the subagent in plain words:

Terminal

claude

Then, inside the session, make a request that matches the description you wrote, for example: “Use the antigravity-reviewer subagent to get a second opinion on the session handling in src/auth/session.ts.” Claude Code matches the request against subagent descriptions, starts the subagent in its own context, and the subagent runs the agy call and brings back the summary.

Expected result: a summary in your main session that came from Antigravity, with the delegated run kept out of your main context. If Claude does not delegate, name the subagent directly, as in the example. Vague requests get vague routing.

Verification

Three checks confirm the bridge works end to end. First, agy --version and agy models both answer without a sign in prompt, which proves the saved credentials are in place. Second, the step 4 command returns a JSON envelope with status set to SUCCESS and a response that actually discusses your file, not a generic answer. Third, a request inside Claude Code produces a summary that mentions the delegated run and its duration.

For a follow up question, resume the same delegated thread instead of starting over. The docs give two routes: --continue for the most recent conversation, or --conversation with the conversation_id from an earlier envelope:

Terminal

agy -p "For edge case 2, show the smallest fix you would suggest." --conversation YOUR_CONVERSATION_ID --model gemini-4-neon-low --mode plan --output-format json --print-timeout 120s | jq -r '.response'

Note that usage and duration_seconds in a resumed envelope are cumulative across the whole conversation, while response holds only the latest turn.

Troubleshooting

ProblemLikely causeFix
authentication required error in headless modeNo interactive sign in has been saved yetRun agy once interactively, or agy acp --login, complete sign in, then retry
Run reports SUCCESS but the answer is thin or emptyA tool action was soft denied and recorded in denied_actionsTell the prompt not to run shell commands, keep --mode plan on review work, and check denied_actions before trusting any result
agy fails when Claude Code runs it in a sandboxed shellThe CLI opens a local port and writes logs under ~/.gemini/, which a sandbox can blockAllow the agy command to run outside the Bash sandbox, a gotcha reported by Flavio Copes in his walkthrough of this setup
Run ends with a deadline error--print-timeout was too short for the model and taskRaise the timeout; in the same walkthrough, the high effort Neon model needed close to 300 seconds on a hard review
Warning that plan mode has no effect--disable-slash-commands was passed together with --mode planDrop --disable-slash-commands when you want plan mode
Error naming an unknown modelThe slug does not exist on your accountCopy the slug exactly from your own agy models output
Claude Code never delegatesThe request does not match the subagent descriptionName the subagent in the request, or sharpen the description in its front matter

Next Steps

Once the review bridge feels routine, the same command shape covers more work. Swap the prompt and the same subagent pattern handles plan checks before a big change, or a second pass over a failing test’s stack trace. When a caller needs typed answers instead of prose, add --json-schema with --output-format json and read the parsed object from structured_output, as Google’s headless mode documentation describes.

Two extensions are worth knowing about. A shared skill file can hold the same command for both Claude Code and Codex, which the walkthrough in the sources sets up under ~/.agents/skills/ with a link into ~/.claude/skills/. And editors that speak the Agent Client Protocol can wrap Antigravity through agy acp, the third pattern the December terms name. For wider Antigravity habits once this is running, see our guide to running Antigravity workflows with parallel agents safely.

Keep the boundary from step one in view as you extend this. Delegate tasks to an unmodified agy, read its answers, and let it hold its own sign in. The moment a setup wants Antigravity tokens inside another tool, it has crossed the line Google kept.

Sources

■

END OF TRANSMISSION

Stay curious. Question everything.

CONTINUE THE DESCENT

MORE FROM DIRTY STATIC ↘