How to call Google Antigravity (agy -p) as a subagent from Claude Code or Codex Google's December 1, 2026 rewrite of clause 6 of the Antigravity Terms of Service explicitly permits calling the unmodified `agy` CLI, including `agy -p` headless mode, as a tool or subagent from other coding harnesses such as Claude Code and Codex, according to a guide by Flavio tested with `agy` 1.5.17, Claude Code 2.1.332 and Codex 0.172.0. The guide shows delegating read-only code reviews to Gemini 4 Neon models (`gemini-4-neon-high`, `-medium`, `-low`, plus `gemini-4-hydrogen-low`) via `--model`, `--mode plan`, `--output-format json` and `--print-timeout 120s`, with the JSON envelope returning `conversation_id`, `status`, `response` and `usage`. The rule the guide draws is that Antigravity must run its own agent loop — extracting OAuth tokens or using `agy` as a raw completions proxy to drive another harness's loop still risks suspension, and external harnesses wanting their own loop should use a Gemini API key backed by Google Cloud API credits. How to call Google Antigravity agy -p as a subagent from Claude Code or Codex By Flavio https://flaviocopes.com/about/ Tagged: AI https://flaviocopes.com/tags/ai/ Run Gemini 4 Neon through Google's unmodified agy CLI as a subagent from Claude Code or Codex, with real benchmarks, structured JSON output, and the gotchas I hit. On December 1, 2026, Google rewrote clause 6 of the Antigravity Terms of Service https://antigravity.google/terms/ and updated the Antigravity FAQ https://antigravity.google/docs/faq/ . One change unlocked a workflow a lot of us wanted for months: calling the unmodified agy CLI including agy -p headless mode as a tool or subagent from another coding harness is now explicitly permitted. That means you can stay inside Claude Code https://flaviocopes.com/claude-code-guide/ or Codex https://flaviocopes.com/codex/ as your main driver and delegate a second opinion, a code review, or an architecture check to Gemini 4 Neon https://flaviocopes.com/gemini-4-neon-review/ using your existing Google AI Pro or Google AI Ultra https://flaviocopes.com/google-ai-ultra/ subscription. In this guide I will show you how to set it up, what real timings and token counts look like on a real codebase, and the four gotchas I ran into when testing it with agy 1.5.17, Claude Code 2.1.332, and Codex 0.172.0. Why this is allowed and where the line is Before writing a single wrapper script, it helps to be crystal clear on what stays inside Google’s Terms of Service and what still gets Antigravity access suspended. I covered the full policy rewrite in Google Antigravity and Gemini Neon: what gets accounts banned https://flaviocopes.com/google-ai-account-bans/ . The short rule is simple: let Antigravity run its own agent loop. When Claude Code or Codex invokes agy -p over the shell, Google’s unmodified CLI handles authentication, reads the files it needs, runs its own reasoning, and prints a finished answer back to stdout. You are not extracting OAuth tokens and you are not using agy as a raw completions proxy to drive Claude Code’s own loop. If you want an external harness to run its own loop straight against Gemini models without calling agy , use a Gemini API key backed by your monthly Google Cloud API credits https://flaviocopes.com/google-ai-ultra-api-credits/ instead. Prerequisites and picking a model First make sure agy is installed and signed in with one interactive session headless mode reuses those cached credentials and exits with an auth error if you have not logged in yet . If you are setting up Antigravity for the first time, start with the complete guide to Google Antigravity https://flaviocopes.com/antigravity/ , or grab the free Antigravity Handbook https://flaviocopes.com/access/ to read offline. List the exact model IDs your account can pass to --model : agy --version agy models On my machine agy 1.5.17 , the Gemini 4 models I use for subagent work are: gemini-4-neon-high Gemini 4 Neon High gemini-4-neon-medium Gemini 4 Neon Medium gemini-4-neon-low Gemini 4 Neon Low gemini-4-hydrogen-low Gemini 4 Hydrogen Low Your first agy -p subagent call Let’s run a real read-only code review against a file in this site’s repository, src/plugins/remark-pele.mjs , and ask agy -p to return a JSON envelope so another agent can parse it cleanly. agy -p "Read src/plugins/remark-pele.mjs only do not run shell commands and list the top 2 edge cases. Be concise, cite line numbers." \ --model gemini-4-neon-low \ --mode plan \ --output-format json \ --print-timeout 120s \ | jq '{conversation id, status, duration seconds, usage}' Notice the two safety rails in that command: --mode plan keeps the session out of edit mode, and the prompt tells the model not to run shell commands I will explain why that sentence matters in the gotchas section below . Here is the real output from running that command on my Mac: The JSON envelope gives the calling agent everything it needs: - conversation id so you can ask a follow-up question in the same thread later - status SUCCESS or ERROR - response with the plain Markdown answer - duration seconds and usage including thinking tokens and cache read tokens - denied actions if Antigravity tried to use a tool that headless mode blocked On that review of src/plugins/remark-pele.mjs , Gemini 4 Neon caught two real edge cases: passing HTML wrapper divs