Skip to content

feat(antigravity): add Antigravity CLI (agy) provider#323

Open
MarkusWohlmuth wants to merge 3 commits into
awslabs:mainfrom
MarkusWohlmuth:feat/antigravity-cli-provider
Open

feat(antigravity): add Antigravity CLI (agy) provider#323
MarkusWohlmuth wants to merge 3 commits into
awslabs:mainfrom
MarkusWohlmuth:feat/antigravity-cli-provider

Conversation

@MarkusWohlmuth

Copy link
Copy Markdown

What

Adds an AntigravityCliProvider so CAO can drive Google's Antigravity CLI (agy) — the terminal-native successor to the Gemini CLI. Google retired the free Gemini Code Assist "Login with Google" path for the gemini binary on 2026-06-18 and is steering users to Antigravity, so teams relying on the gemini_cli provider for an independent-model worker need a path forward.

How it works

Modeled on the cursor_cli / gemini_cli providers:

  • Launch: agy --dangerously-skip-permissions [--model "<name>"] [-i "<system prompt>"]. Models are the human-readable strings agy models prints (e.g. "Gemini 3.1 Pro (High)"). The profile body + skill catalog (+ security prompt when tool-restricted) is injected via -i with an "acknowledge your role and wait" guard so the agent adopts its role without exploring on launch.
  • Status detection (footer-anchored, render-stable): esc to cancel → PROCESSING; ? for shortcuts → IDLE/COMPLETED, split on a turn counter (the TUI footer is identical in both states — same approach as cursor_cli). Survives strip_terminal_escapes.
  • Response extraction: text between the echoed > <query> line and the input-box separator, filtering TUI chrome (banner, separators, footer, tips, spinner, thought lines, tool-call lines).
  • MCP: writes the profile's mcpServers into agy's ~/.gemini/config/mcp_config.json (the fixed path it reads), forwarding CAO_TERMINAL_ID so cao-mcp-server resolves the terminal for handoff/assign; removed on cleanup.
  • Registration: ProviderType.ANTIGRAVITY_CLI, manager branch, tool_mapping, RUNTIME_SKILL_PROMPT_PROVIDERS, SOFT_ENFORCEMENT_PROVIDERS, provider_binaries.
  • Exit via /quit.

Testing

  • Unit: test/providers/test_antigravity_cli_unit.py (18 tests) — status detection, extraction, command building, MCP config write/cleanup — against captured live-TUI fixtures. Full provider suite green (872 passed).
  • Live end-to-end: launched a reviewer agent via CAO on agy (Gemini 3.1 Pro (High)). Verified: agy boots, the -i system prompt + skill catalog inject, role adoption, IDLE→PROCESSING→COMPLETED transitions, and cao-mcp-server connects and load_skill is invoked (confirming the CAO_TERMINAL_ID wiring). The agent returned a structured review (Verdict: CHANGES_REQUESTED).

Notes / limitations

  • Tool restrictions are soft (prompt-level via the security prompt) — agy exposes no native hard deny flag, so the provider is in SOFT_ENFORCEMENT_PROVIDERS.
  • agy reads MCP config from a single fixed path; concurrent terminals share it. This is safe under CAO's serialized launch (each agy reads the config and spawns its MCP subprocess before the next terminal writes), matching the gemini_cli provider's existing model.
  • agy occasionally shows a server-driven feedback survey; it auto-dismisses on normal text input, so it does not affect task delivery.
  • Docs: docs/antigravity-cli.md.

Happy to file a tracking issue first if that's preferred per CONTRIBUTING — opening this as a draft for visibility.

🤖 Generated with Claude Code

Adds an AntigravityCliProvider so CAO can drive Google's Antigravity CLI
(`agy`), the terminal successor to the Gemini CLI after the free Gemini
Code Assist login was retired (2026-06-18).

- New provider modeled on cursor_cli/gemini_cli: launches
  `agy --dangerously-skip-permissions [--model] [-i <system prompt>]`,
  footer-anchored status detection (`esc to cancel` -> PROCESSING,
  `? for shortcuts` -> IDLE/COMPLETED split on a turn counter), structural
  response extraction, MCP servers written to ~/.gemini/config/mcp_config.json
  with CAO_TERMINAL_ID forwarded, `/quit` exit.
- Registered: ProviderType.ANTIGRAVITY_CLI, manager branch, tool_mapping,
  RUNTIME_SKILL_PROMPT_PROVIDERS, SOFT_ENFORCEMENT_PROVIDERS, provider_binaries.
- Unit tests (status/extraction/command/MCP) with captured TUI fixtures.
- docs/antigravity-cli.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MarkusWohlmuth MarkusWohlmuth marked this pull request as ready for review June 22, 2026 10:34
@haofeif haofeif requested a review from Copilot June 23, 2026 03:12
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 144 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@b8b1897). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...li_agent_orchestrator/providers/antigravity_cli.py 24.46% 142 Missing ⚠️
src/cli_agent_orchestrator/providers/manager.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #323   +/-   ##
=======================================
  Coverage        ?   14.69%           
=======================================
  Files           ?       76           
  Lines           ?     7670           
  Branches        ?        0           
=======================================
  Hits            ?     1127           
  Misses          ?     6543           
  Partials        ?        0           
Flag Coverage Δ
unittests 14.69% <25.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haofeif

haofeif commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@MarkusWohlmuth Thanks for your contribution! This is a much needed PR as the antigravity cli replaces gemini cli as the new Google Cli.

Can you please make sure that the new provider pass the examples/assign test ?
Supervisor agent is able to parallel assign 3x tasks to data analysts, and sequential handoff to report generator. Data analyst are ables to complete the jobs and successfully send message back to supervisor agent. supervisor agent is able to complete the reporting. Supervisor agent is not supposed to complete the jobs itself.

You can also refer to the skill https://github.com/awslabs/cli-agent-orchestrator/tree/main/skills/cao-provider for the new provider.

Also please address the copilot's reviews, and fix the CI errors and Codecov Report. Much appreciated!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new antigravity_cli provider so CLI Agent Orchestrator can drive Google’s Antigravity CLI (agy) in a tmux-backed interactive TUI session, including status detection, response extraction, and MCP server wiring.

Changes:

  • Introduces AntigravityCliProvider with footer-anchored status detection, response extraction, launch command construction, and MCP config merge/cleanup.
  • Registers the new provider across the orchestrator (provider type enum, provider manager, runtime skill prompt + soft enforcement sets, API provider listing, and tool mapping).
  • Adds unit tests plus captured TUI fixtures and user-facing documentation for setup/usage.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/providers/test_antigravity_cli_unit.py Unit tests for status detection, extraction, command building, and MCP config lifecycle.
test/providers/fixtures/agy_review_completed.txt Captured “completed” TUI output fixture used by extraction tests.
test/providers/fixtures/agy_processing.txt Captured “processing” TUI output fixture used by status tests.
test/providers/fixtures/agy_idle.txt Captured “idle” TUI output fixture used by status tests.
test/providers/fixtures/agy_completed.txt Captured “completed” TUI output fixture used by status tests.
src/cli_agent_orchestrator/utils/tool_mapping.py Adds CAO→native tool mapping for antigravity_cli.
src/cli_agent_orchestrator/services/terminal_service.py Includes antigravity_cli in runtime skill prompt + soft enforcement provider sets.
src/cli_agent_orchestrator/providers/manager.py Wires provider creation branch for ProviderType.ANTIGRAVITY_CLI.
src/cli_agent_orchestrator/providers/antigravity_cli.py New provider implementation (launch, MCP config, status detection, extraction, cleanup).
src/cli_agent_orchestrator/models/provider.py Adds ANTIGRAVITY_CLI to ProviderType enum.
src/cli_agent_orchestrator/api/main.py Adds antigravity_cliagy to /agents/providers binary probe list.
docs/antigravity-cli.md Documentation for installing/configuring/using the new provider.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +183 to +188
# mark_input_received(), which the terminal service calls after every
# send_input(). This keeps the handoff/assign "wait for IDLE before
# sending the task" contract working right after init.
self._turns: int = 0

# ------------------------------------------------------------------ #
Comment on lines +369 to +372
2. PROCESSING — footer "esc to cancel" (or a spinner line) in the tail
3. WAITING_USER_ANSWER — an interactive approval / picker prompt
4. IDLE / COMPLETED — footer "? for shortcuts" (IDLE pre-first-turn,
COMPLETED after)
Comment thread test/providers/fixtures/agy_idle.txt Outdated
Comment on lines +2 to +6
markuswohlmuth@MacBook-Pro cli-agent-orchestrator % cd '/tmp/agy_onb/work' && agy --dangerously-skip-permissions

▄▀▀▄ Antigravity CLI 1.0.10
▀▀▀▀▀▀ markus.wohlmuth@bitmovin.com (Antigravity Starter Quota)
▀▀▀▀▀▀▀▀ Gemini 3.5 Flash (Medium)
Comment on lines +2 to +6
markuswohlmuth@MacBook-Pro cli-agent-orchestrator % cd '/tmp/agy_onb/work' && agy --dangerously-skip-permissions

▄▀▀▄ Antigravity CLI 1.0.10
▀▀▀▀▀▀ markus.wohlmuth@bitmovin.com (Antigravity Starter Quota)
▀▀▀▀▀▀▀▀ Gemini 3.5 Flash (Medium)
Comment on lines +2 to +6
markuswohlmuth@MacBook-Pro cli-agent-orchestrator % cd '/tmp/agy_onb/work' && agy --dangerously-skip-permissions

▄▀▀▄ Antigravity CLI 1.0.10
▀▀▀▀▀▀ markus.wohlmuth@bitmovin.com (Antigravity Starter Quota)
▀▀▀▀▀▀▀▀ Gemini 3.5 Flash (Medium)
▸ Thought for 2s, 608 tokens
Prioritizing Tool Usage

● Read(/Users/markuswohlmuth/.gemini/antigravity-cli/mcp/cao-mcp-server/load_skill.json) (ctrl+o to expand)
@haofeif haofeif added the enhancement New feature or request label Jun 23, 2026
- opt into blocks_orchestrated_input_while_waiting_user_answer so agy
  approval/picker prompts don't consume orchestrated assign/handoff messages
- correct get_status docstring priority order (WAITING_USER_ANSWER before
  PROCESSING, matching implementation)
- redact PII from test fixtures (email, hostname, home directory paths)
- add antigravity_cli to PROVIDERS_REQUIRING_WORKSPACE_ACCESS
- add examples/assign e2e tests (data_analyst, report_generator, callback)
- assert antigravity_cli in /agents/providers endpoint tests
- add dedicated CI workflow for the provider
- document provider in README and CHANGELOG

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MarkusWohlmuth

Copy link
Copy Markdown
Author

@haofeif thanks for the review! Just pushed 2c9fd1a addressing all the feedback:

Copilot review comments

  • Safety guardAntigravityCliProvider now opts into blocks_orchestrated_input_while_waiting_user_answer = True, so orchestrated assign/handoff messages are held back while an approval/picker prompt is up instead of being pasted in as the answer.
  • Docstring priority order — corrected get_status docstring so WAITING_USER_ANSWER is listed before PROCESSING, matching the actual check order.
  • PII in fixtures — redacted email, hostname, and home-directory paths across agy_idle.txt, agy_processing.txt, agy_completed.txt, and agy_review_completed.txt (now user@host / user@example.com / /Users/example/...).

examples/assign

  • Added TestAntigravityCliAssign in test/e2e/test_assign.py covering parallel data_analyst assignment, sequential report_generator handoff, and the full callback round-trip (worker completes → send_message → supervisor receives), plus a require_antigravity fixture. Also added antigravity_cli to PROVIDERS_REQUIRING_WORKSPACE_ACCESS so the supervisor delegates rather than doing the work itself.

CI / Codecov

  • Added a dedicated .github/workflows/test-antigravity-cli-provider.yml (unit tests + coverage upload across Python 3.10–3.12, plus black/isort/mypy).
  • Added /agents/providers endpoint assertions for antigravity_cli.

One note on coverage: the e2e assign tests require a live agy binary so they skip in CI — the provider's status/extraction logic is exercised by the unit fixtures, but the codecov patch % mostly reflects the e2e paths that can't run on the runner. Happy to add more unit-level coverage if you'd like.

agy redraws its footer in place, flipping "esc to cancel" (PROCESSING) to
"? for shortcuts" (IDLE) with cursor moves. The status monitor's raw
append-only pipe-pane stream keeps BOTH strings after strip_terminal_escapes,
so get_status() found the stale "esc to cancel" and latched PROCESSING
forever — the session never reached IDLE, POST /sessions blocked the full
180s init wait, and the CLI's 30s read timeout fired ("Failed to connect to
cao-server: Read timed out"). Every antigravity_cli launch failed, so the
provider could not pass examples/assign.

Fix: set supports_screen_detection = True and implement get_status_from_screen
against the pyte-composited viewport (mirroring claude_code / kimi_cli), where
the in-place footer rewrite is resolved and only the live footer remains.
Verified live: status monitor now transitions unknown -> idle in ~10s and
cao launch --provider antigravity_cli succeeds.

Adds unit tests for the screen detector plus a regression test asserting the
raw stream reports PROCESSING while the composited screen reports IDLE.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants