Repository navigation
Antigravity CLI: an adapter for Gemini legs on Google's agy - #90
Merged
Merged
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
A new cli, antigravity-cli, runs Google's Antigravity CLI (`agy`) headless: `agy -p` with --model, --output-format stream-json and --dangerously-skip-permissions, plus --effort when the leg sets one; resume is `agy -c -p` with the same flags. The run's HOME gets ~/.gemini/antigravity-cli/settings.json with modelProvider "gemini", so agy reads the virtual key from GEMINI_API_KEY and sends every request to GOOGLE_GEMINI_BASE_URL, the proxy's /gemini passthrough. AGY_CLI_DISABLE_AUTO_UPDATE=true keeps the pinned binary. EFFORT_LEVELS gains agy's levels (low, medium, high, xhigh, max), and the cli joins PASSTHROUGH_CLIS, so its key is minted uncapped like gemini-cli's. The gemini-cli adapter is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh
EFFORT_LEVELS['antigravity-cli'] narrows to low, medium and high: agy refuses at launch a level the model lacks, and no Gemini model on this route takes xhigh or max. The comment above the effort check now says the fall-back to a default effort is claude-code's. The fallback-model scan is noted as covering claude-code transcripts only, and the README says the passthrough CLIs (gemini-cli, antigravity-cli) get uncapped keys, whose budget the driver enforces from the key's spend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh
Thykof
force-pushed
the
feat/antigravity-cli
branch
from
November 9, 2026 10:50
d016151 to
a76118d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #89: merge that first.
Why
Google now treats Gemini CLI as legacy for Gemini 4: its README says the CLI is "Not optimized for Gemini 4+", and it points Gemini 4 users to the Antigravity CLI (
agy). With Gemini CLI, a Gemini 4 Argon leg sends no thinking level, so the model runs at the API default (medium), and the CLI's compression and loop-detection calls go to other Gemini models.The engine had no adapter for
agy. This PR adds one, so a Gemini leg can run on Google's current harness, through the same metering proxy and at the model's top effort.Stacked on the Kimi Code effort branch (
feat/kimi-code-2-effort).What
A new
cli: antigravity-cli(AntigravityAdapterincli_adapters.py, registered in_ADAPTERSandKNOWN_CLIS):agyexits non-zero on an unknown--modelinstead of falling back to another model.Routing. This is
agy's Gemini-API-key mode. The run's HOME gets~/.gemini/antigravity-cli/settings.jsonwith{"modelProvider": "gemini"}; without that setting,agyignoresGEMINI_API_KEY. The env holds:GOOGLE_GEMINI_BASE_URL<proxy>/geminiGEMINI_API_KEYx-goog-api-key, the same header Gemini CLI sendsAGY_CLI_DISABLE_AUTO_UPDATEtrueThe adapter does not set
GOOGLE_API_KEY: the Gemini SDK would prefer it overGEMINI_API_KEY.EFFORT_LEVELS["antigravity-cli"]is("low", "medium", "high"), the levelsagy's Gemini models take.agyrefuses at launch a level the model lacks, and no Gemini model on this route takesxhighormax, so those are rejected at load, as is a level from another CLI (e.g.ultra). The tuple is an upper bound: Gemini 3.1 Pro has nomedium. Gemini 4 Argon's highest level ishigh, so an Argon leg setseffort: high.goalandultracodestay claude-code only, and the comment above the effort check now says the fall-back to a default effort is claude-code's.PASSTHROUGH_CLISgainsantigravity-cli.agyuses the same/geminipassthrough as Gemini CLI, so its key is minted uncapped. The driver still enforces the budget from the key's real spend.The benchmark README adds Antigravity CLI to its list of CLIs, and now says the passthrough CLIs (gemini-cli, antigravity-cli) get uncapped keys whose budget the driver enforces from the key's spend, where it said every key was budget-capped.
The fallback-model scan (
driver.FALLBACK_MARKER) is noted as covering claude-code transcripts only.Gemini CLI is unchanged, and it stays available for past campaigns.
Not in this PR:
agydocuments no setting that turns telemetry off without the interactive/configmenu.agyleg:substituted_models()reads claude-code transcripts only, so it always reports none here.agy's stream-json names the model only in itsinitevent. Itsflash-tier subagents and web search run on other Gemini models; their tokens go through the proxy, but Google's search-grounding fee never reaches the proxy's ledger, so it is not metered or counted against the budget.agy -cresumes the latest conversation in the workspace; whether it can pick a subagent's conversation after a kill mid-subagent is not settled.Before a real leg, one local capture run checks what the docs don't settle: that the request body carries
thinkingLevel: "HIGH", and thatagyaccepts a plain-httpbase URL. The smoke run also lists the key's spend per model in the proxy's logs (no row at zero cost), reads the modelsagyresolved in<leg>-home/.gemini/antigravity-cli/cli.log, and kills the container once while a subagent runs, to compare the conversation the relaunch resumes with the main one. The sandbox image and the proxy pricing foragylive in the deployment repository.Tests
tests/benchmark/test_cli_adapters.py:--effort high, stream-json and the permission flag, with identical flags on both.<proxy>/geminiwith the virtual key, turns off auto-update, and has noGOOGLE_API_KEY.{"modelProvider": "gemini"}.effort, no--effortflag is passed.tests/benchmark/test_campaign.py:effort: highloads on anantigravity-clileg.effort: max,effort: xhigh,effort: ultra,goal: trueandultracode: trueare rejected on one.tests/benchmark/test_run_campaign.py: anantigravity-clileg's key is minted withcap=None.uvx black@26.5.1 --checkanduvx --with flake8-pyproject==1.2.3 flake8@7.1.2on the changed files: clean.uv run pytest -q: 513 passed, 1 skipped (the unpacked-champions gate, with nochampions/directory to parametrize over).🤖 Generated with Claude Code
https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh