Skip to content

Antigravity CLI: an adapter for Gemini legs on Google's agy - #90

Merged
Thykof merged 2 commits into
mainfrom
feat/antigravity-cli
Nov 9, 2026
Merged

Thykof merged 2 commits into
mainfrom
feat/antigravity-cli

Conversation

@Thykof

@Thykof Thykof commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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 (AntigravityAdapter in cli_adapters.py, registered in _ADAPTERS and KNOWN_CLIS):

    agy -p <prompt> --model <model> --output-format stream-json --dangerously-skip-permissions [--effort <effort>]
    agy -c -p <prompt> <same flags>        # resume: the latest conversation in the workspace
    
    • In print mode, agy exits non-zero on an unknown --model instead of falling back to another model.
    • The flags are the same on every launch, so a crash relaunch keeps the model and the effort.
  • Routing. This is agy's Gemini-API-key mode. The run's HOME gets ~/.gemini/antigravity-cli/settings.json with {"modelProvider": "gemini"}; without that setting, agy ignores GEMINI_API_KEY. The env holds:

    Variable Value Effect
    GOOGLE_GEMINI_BASE_URL <proxy>/gemini every Gemini SDK client in the process calls the proxy's passthrough
    GEMINI_API_KEY the leg's virtual key sent as x-goog-api-key, the same header Gemini CLI sends
    AGY_CLI_DISABLE_AUTO_UPDATE true the pinned binary does not replace itself mid-leg

    The adapter does not set GOOGLE_API_KEY: the Gemini SDK would prefer it over GEMINI_API_KEY.

  • EFFORT_LEVELS["antigravity-cli"] is ("low", "medium", "high"), the levels agy's Gemini models take. agy refuses at launch a level the model lacks, and no Gemini model on this route takes xhigh or max, 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 no medium. Gemini 4 Argon's highest level is high, so an Argon leg sets effort: high. goal and ultracode stay claude-code only, and the comment above the effort check now says the fall-back to a default effort is claude-code's.

  • PASSTHROUGH_CLIS gains antigravity-cli. agy uses the same /gemini passthrough 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:

  • No telemetry switch. agy documents no setting that turns telemetry off without the interactive /config menu.
  • No check that flags a substituted model on an agy leg: substituted_models() reads claude-code transcripts only, so it always reports none here. agy's stream-json names the model only in its init event. Its flash-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.
  • Resume by conversation id. agy -c resumes 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 that agy accepts a plain-http base URL. The smoke run also lists the key's spend per model in the proxy's logs (no row at zero cost), reads the models agy resolved 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 for agy live in the deployment repository.

Tests

  • tests/benchmark/test_cli_adapters.py:
    • The launch and resume commands carry the model, --effort high, stream-json and the permission flag, with identical flags on both.
    • The env routes to <proxy>/gemini with the virtual key, turns off auto-update, and has no GOOGLE_API_KEY.
    • The provisioned settings file is exactly {"modelProvider": "gemini"}.
    • Without effort, no --effort flag is passed.
  • tests/benchmark/test_campaign.py: effort: high loads on an antigravity-cli leg. effort: max, effort: xhigh, effort: ultra, goal: true and ultracode: true are rejected on one.
  • tests/benchmark/test_run_campaign.py: an antigravity-cli leg's key is minted with cap=None.
  • uvx black@26.5.1 --check and uvx --with flake8-pyproject==1.2.3 flake8@7.1.2 on the changed files: clean.
  • uv run pytest -q: 513 passed, 1 skipped (the unpacked-champions gate, with no champions/ directory to parametrize over).

🤖 Generated with Claude Code

https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Thykof
Thykof added this pull request to stack #92 November 9, 2026 10:48
Base automatically changed from feat/kimi-code-2-effort to main November 9, 2026 10:50
Thykof and others added 2 commits November 9, 2026 11:50
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
Thykof force-pushed the feat/antigravity-cli branch from d016151 to a76118d Compare November 9, 2026 10:50
@Thykof
Thykof merged commit 552339b into main Nov 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant