AntigravityCliSdk

GitHub MIT License

AntigravityCliSdk

Current release: 0.5.0.

AntigravityCliSdk is the supported Google coding-agent SDK for the Antigravity CLI (agy). It gives Elixir applications a typed streaming API, a simple synchronous run/2, governed launch checks, and the runtime module consumed by agent_session_manager for the :antigravity SDK lane.

The retired gemini_cli_sdk is not supported or revived by this package. gemini_ex is a distinct model API SDK and is not a coding-agent CLI runtime.

The SDK does not reimplement subprocess handling. It uses cli_subprocess_core, the same core runtime that powers ASM's common Antigravity lane.

Antigravity model selection

Use AntigravityCliSdk.Models.list_available/1 to load the signed-in account's exact model IDs in CLI order. The bundled catalog also includes Gemini 4 Carbon for eligible Google AI Ultra and Enterprise accounts. Select an advertised slug to pin a model. An omitted model, default, or auto delegates selection to agy. Refresh discovery after changing accounts. A failed discovery query returns an error, while a successful empty list returns {:ok, []}. A rejected explicit selection returns a :model_rejected error with the requested model in its context. Refresh discovery and choose another advertised model if needed.

Installation

AntigravityCliSdk 0.5.0 requires Elixir 1.19 or later and cli_subprocess_core ~> 0.10.0.

Sibling checkout during local development:

def deps do
  [
    {:antigravity_cli_sdk, path: "../antigravity_cli_sdk"}
  ]
end

Hex dependency after publish:

def deps do
  [
    {:antigravity_cli_sdk, "~> 0.5.0"}
  ]
end

Quickstart

{:ok, text} =
  AntigravityCliSdk.run("Reply with exactly: OK", %AntigravityCliSdk.Options{
    dangerously_skip_permissions: true
  })

For streaming:

"Explain OTP in one sentence."
|> AntigravityCliSdk.execute(%AntigravityCliSdk.Options{})
|> Enum.each(fn
  %AntigravityCliSdk.Types.MessageEvent{content: text} -> IO.write(text)
  %AntigravityCliSdk.Types.ResultEvent{} -> :ok
  %AntigravityCliSdk.Types.ErrorEvent{} = error -> IO.inspect(error)
end)

Configuration

Runtime configuration is explicit:

Library modules read application config, not the parent OS environment.

Three independent timeout controls are available:

completion_only: true and non-nil output_schema are explicit common intents, but Antigravity currently rejects both with AntigravityCliSdk.Error{kind: :unsupported_capability} before resolving or starting agy.

Live Example

mix run examples/simple_stream.exs

The example uses the real agy binary through cli_subprocess_core. Run the full SDK-owned suite with:

~/scripts/with_bash_secrets bash examples/run_all.sh

See Examples for the full inventory. ASM provider examples live in agent_session_manager/examples.

Documentation