Skip to content
Sign in

provider-antigravity

v0.3.0

POC llm-router provider `antigravity` that drives the Antigravity CLI (`agy acp`, Agent Client Protocol) on the host, reusing agy's own sign-in; the caller's functions reach the model as native tools.

license: Apache-2.0acpagyantigravityllmprovider

Install

bash
iii call compose::add worker=provider-antigravity@0.3.0

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

provider-antigravity (POC)

An llm-router provider, antigravity, that answers chat turns by driving the Antigravity CLI (agy) over the Agent Client Protocol (agy acp), reusing agy's own sign-in. Its models show up in the console's model picker like any API-key provider. (This worker was formerly provider-acp.)

This is the client side of ACP: iii drives agy. The acp worker is the server side: an editor drives iii.

Setup

Do these on the machine where the worker runs (the host, not the computer you open the ADE from).

  1. Install the Antigravity CLI (macOS and Linux):

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

    The installer puts agy in ~/.local/bin/agy, where the worker finds it. agy install sets up PATH and the shell afterwards. Installed elsewhere: set the agy path in Settings > Antigravity, or AGY_BIN. Install docs.

  2. Sign in with your Google account, in a terminal:

    agy acp --login

    Over SSH (no browser on that machine), it prints a URL: open it in your own browser, sign in, and paste the code it gives you back into the terminal. The credentials go to the OS keyring. To sign out, run /logout inside agy. Sign-in docs.

    Instead of an account:

    • Gemini API key: set "modelProvider": "gemini" in ~/.gemini/antigravity-cli/settings.json and export GEMINI_API_KEY in the worker's environment, then restart the worker. The key alone does nothing.
    • Application Default Credentials: gcloud auth application-default login --project <PROJECT>, then AGY_ADC_AUTH=true for the worker (optionally GOOGLE_CLOUD_QUOTA_PROJECT, GOOGLE_CLOUD_LOCATION).
  3. Add the worker to the stack (see Run).

The ADE guides the same steps: Settings > Antigravity and Manage models > Antigravity (CLI) > Configure show a checklist (installed, signed in, models available) for the worker's host, with the commands to copy and a Check again button.

How it works

  • Catalog. agy models lists one id per model and effort (gemini-4-neon-high). The provider folds them into one model per family, as agy's own switcher does, and publishes them as antigravity/<family> with reasoning_efforts. The console's effort picker then works:

    • the turn's thinking_level selects the agy id <family>-<effort>, sent with session/set_model;
    • no level, or a level the family lacks, falls back to high.

    antigravity/default keeps agy's own configured model. Exact agy ids (antigravity/gemini-4-neon-low) still work. A turn that finds no catalog for the current binary lists the models first; if that listing fails, a family id fails the turn with the listing error.

  • Turns. Each router call starts agy acp in a fresh, empty temp directory and runs one ACP session:

    1. initialize;
    2. session/new, with the system prompt in _meta.antigravity.systemPrompt.append;
    3. session/set_model;
    4. one session/prompt carrying the conversation, flattened into one user message. A line of the caller's text that could pass for a role, call, result, image or file marker gets a \ ahead of it; other lines stay as written. Names and ids inside a marker lose their line breaks.

    agent_message_chunk updates stream as router text, agent_thought_chunk updates as thinking, and the prompt's usage becomes the turn's usage.

  • Function calling is native. The caller's functions are declared as tools of a stub MCP server named iii, so the model calls them with real structured arguments. agy launches the stub as this same binary, provider-antigravity mcp-stub <tools.json>, with the tool list written to the turn's workspace. Bus ids are encoded as engine__workers__list; ids that encode alike get _2, _3. The stub never runs anything.

    • A .agents/hooks.json PreToolUse hook in the workspace denies every tool call before it runs.
    • Each blocked call to an iii tool becomes a router function_call, with agy's toolSummary stripped unless the function declares it.
    • 300 ms after the last call of a batch, the client sends session/cancel, so the model never spends a step reacting to the block.

    The turn then ends with stop_reason: function_call. The caller (the harness, with its policy, approvals, transcript and traces) runs the calls and sends the results in the next turn's history.

  • agy's own tools stay blocked. The hook blocks them too. Any session/request_permission is refused, as a second layer. Attempts show up as warnings on the message.

  • Environment. agy gets an allowlisted environment (see Run), so no III_* variables reach it.

  • Errors.

    Failure Router error_kind
    Quota reached permanent
    429 or rate limit rate_limited
    Auth failure auth_expired
    agy dies before answering transient, retried by the router
    Any other error agy answers with permanent

    The text is written for the chat user. A missing agy says the Antigravity CLI is not installed on <host>, with the install command and the agy path setting. An auth failure says it is not signed in on <host>, with <agy path> acp --login. agy's own message follows as the detail.

    stopReason: max_tokens ends the turn with stop_reason: length.

  • Abort. The router's abort (keyed by resolution_key), a closed channel (seen at the next frame or keep-alive ping, at most 25s) or a worker shutdown kills agy's process group: SIGTERM first, then SIGKILL after 3s.

  • Images. Each image block, including those inside function results, stays as an [image N] marker in the flattened text. The image itself goes after the conversation as an ACP image block, behind a matching [image N] text block. The catalog sets supports_vision on every model except agy's text-only gpt-oss, which drops images without an error.

  • Context windows. These are the sizes agy reports in ACP usage_update: 1,048,576 tokens for Gemini, 1,000,000 for Claude and 131,072 for gpt-oss. agy models does not list them, so the worker sets them by family name, and an unknown family gets the smallest. input_limit subtracts the 64k output budget and 20k for agy's own system prompt and tool schemas, which measured 10.7k to 19k tokens on a one-word prompt.

  • Unsupported request fields. response_format is not passed to agy.

  • Cost. Every router call is a fresh agy process and session given the full flattened history. Each round trip of a tool loop therefore pays agy's start-up (about 2s for session/new) before the model runs.

Run

Requires an installed, signed-in agy (Setup) on the same machine. Without agy the worker still starts and registers its functions; turns then fail with the install instructions, and the setup screen shows step 1 as not done.

cargo run --release -- --url ws://127.0.0.1:49134

iii.worker.yaml gives a supervisor the same thing: cargo build --release, then ./target/release/provider-antigravity. Stop it with SIGINT or SIGTERM: it aborts the turns in flight, waits up to 5s for them to report, and exits within 8s.

Build

cargo build --release
cargo fmt --all -- --check
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo test --locked --all-features

The release binary is the whole artifact: the worker, the MCP stub (mcp-stub subcommand) and the ADE screen (assets/, embedded at build time). Published builds cover macOS and Linux only, where agy runs.

--url sets the engine URL. Without it: III_URL, then III_ENGINE_URL, then ws://127.0.0.1:49134.

Env var Purpose
AGY_BIN agy binary, used when the saved agy_bin setting is empty. Default: ~/.local/bin/agy, then agy on PATH
III_CONFIG_NAME id of the configuration entry. Compose sets it (<namespace>-provider-antigravity); default provider-antigravity
III_URL engine URL when --url is not given. Compose sets it
III_ENGINE_URL engine URL when neither --url nor III_URL is given
RUST_LOG log filter. Default info

agy runs with only these variables from the worker's environment:

Passed to agy Why
HOME, PATH, USER, LOGNAME, SHELL, TERM, TMPDIR, LANG, LC_ALL, LC_CTYPE, XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_DATA_HOME, XDG_RUNTIME_DIR Home, locale, temp
DBUS_SESSION_BUS_ADDRESS The keyring on Linux (Secret Service over D-Bus), where agy keeps its sign-in
GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL Gemini API key sign-in
AGY_ADC_AUTH, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION, GOOGLE_CLOUD_QUOTA_PROJECT, GOOGLE_APPLICATION_CREDENTIALS Application Default Credentials sign-in

The worker must run on the host (path:// in compose, no base_image) so it can reach agy and its sign-in (the keyring and ~/.gemini).

Configuration

The worker creates a configuration entry named Antigravity, with metadata.ui_form: provider-antigravity, through configuration::ensure (a stored value is kept). It holds one setting:

Key Default Purpose
agy_bin "" Absolute path of the agy binary. Empty: AGY_BIN, then ~/.local/bin/agy, then agy on PATH. A non-empty value wins over AGY_BIN.

A save applies with no restart. The worker observes configuration::on-updated for its entry, re-reads the value, and re-lists the models with the new binary. The binary is resolved on every turn and listing. If the configuration worker does not answer at start, the worker runs on AGY_BIN and the defaults and retries in the background (1 s, doubling to 30 s) until it answers, then applies the saved value with no restart.

The worker injects one ADE stylesheet and one script through iii-console-ui (provider-antigravity::ui-content behind the ade::ui::asset observers). Both are hand-written files in assets/, embedded in the binary, so there is no frontend build. The script registers two forms, both led by the same setup checklist for the worker's host:

  1. Install the Antigravity CLI: done when agy runs (path, where it came from, version). Otherwise the install command, with a Copy button.
  2. Sign in: done when agy has proved it is signed in. Otherwise <agy path> acp --login, the SSH flow, and the API key and ADC alternatives. Waits for step 1.
  3. Models available: done when the models are listed and registered with llm-router. Otherwise the listing error or the last turn error.
  • Settings > Antigravity: the checklist, then the optional agy_bin field (Advanced) and the model list. The ADE owns the draft, validation and Save.
  • Manage models > Antigravity (CLI) > Configure: the same checklist, read-only, with a link to the Settings entry. It replaces the router's generic API endpoint form.

The screen never runs a command or signs in for you: it shows the commands to run in a terminal on the worker's host, then Check again re-lists the models. Copy needs a secure origin; over plain http the command stays selectable.

Two bus functions back the screen:

Function Returns
provider::antigravity::status host (the worker's hostname), the binary (path, source, agy --version, error), signed_in, sign-in hints, model count, listing error, registration, last turn error, and the sign-in command. It runs only agy --version and never returns a token or key value. signed_in comes from the current binary's last model listing or a newer turn's auth failure: null when unknown.
provider::antigravity::refresh_models {count}, after re-listing the models and re-registering with llm-router. A failed listing keeps the previous models and shows in status. Denied to agents.

The sign-in hints in status.credentials follow the Antigravity docs. They only describe how agy may be signed in; signed_in is the truth.

Hint True when
token_file ~/.gemini/antigravity-cli/antigravity-oauth-token exists (never read)
api_key settings.json there has "modelProvider": "gemini" (only that key is read) and GEMINI_API_KEY is set for the worker
adc AGY_ADC_AUTH=true for the worker

Security

  • The ADE on 0.0.0.0 has no auth: anyone who reaches it can open these screens and the rest of the console.
  • The agy path setting is a code-execution route: whoever can save it picks the binary the worker runs on every turn and listing. Keep the ADE off untrusted networks.

Code

  • src/main.rs: the CLI, boot order and shutdown.
  • src/acp.rs: the ACP transport (one turn against a fresh agy acp).
  • src/mcp_stub.rs: the stub MCP server that declares the caller's functions.
  • src/antigravity.rs: agy specifics (binary, environment, models, efforts, errors, probe, session cleanup).
  • src/prompt.rs: the conversation flattened into one ACP prompt, and the host instructions.
  • src/frames.rs: router stream frames.
  • src/provider.rs: llm-router plumbing, status and refresh_models.
  • src/configuration.rs, src/ui.rs, assets/: the setting and the ADE screens.
  • tests/fixtures/: fake-agy.mjs and fake-agy-signed-out.mjs, test doubles of agy, and render-page.mjs, which renders the served page for tests/ui.rs (all need Node).

Search the registry

Find workers, kits and executables, or jump to a page.