explaingit

codeitlikemiley/antigravity-sdk-rust

3RustAudience · developerComplexity · 4/5ActiveSetup · hard

TLDR

Rust SDK for building Gemini-powered agents on Google's Antigravity platform, wrapping a Go localharness binary and supporting WASI sidecar deployments.

Mindmap

mindmap
  root((antigravity-sdk-rust))
    Inputs
      Gemini API key
      localharness binary
      Tool definitions
    Outputs
      Agent responses
      Conversation history
      Tool calls
    Use Cases
      Build Rust agents
      WASI edge deploys
      Axum web agents
    Tech Stack
      Rust
      Gemini
      WASI
      Axum
      Leptos
      Spin

Things people build with this

USE CASE 1

Build a Rust agent on Antigravity with a typed Agent builder and a tool trait

USE CASE 2

Run a Leptos plus Axum web app that hosts an in-process Gemini agent

USE CASE 3

Deploy a Spin WASI component that talks to a sidecar agent_server over HTTP

USE CASE 4

Carry a multi-turn Conversation with policy-guarded tool calls

Tech stack

RustGeminiWASIAxumLeptosSpin

Getting it running

Difficulty · hard Time to first run · 1h+

Needs the Go localharness binary plus a Gemini API key, and WASI paths require a separate agent_server or host runtime.

In plain English

antigravity-sdk-rust is a Rust library for building AI agents on top of Google's Antigravity platform, with Gemini as the underlying model. The README pitches it as an infrastructure layer that wraps the usual agentic loop, the cycle of the model thinking, calling a tool, reading the result, and thinking again, so that a developer can focus on what the agent should do rather than on how each turn is driven. The SDK does not run the loop itself in pure Rust. It depends on a compiled Go runtime binary called localharness that does the actual orchestration. Two install paths are documented. The Rust friendly route runs scripts/install_harness.sh, which downloads the binary directly from the Google package on PyPI (a wheel is a zip file underneath) and writes its path into ANTIGRAVITY_HARNESS_PATH. The alternative is pip install google-antigravity, in which case the Rust SDK finds the binary inside the Python install. After that, exporting GEMINI_API_KEY and running cargo run --example hello_world is enough to talk to a live agent. The Rust API is layered. The simplest entry point is the Agent builder, which discovers the binary, wires tools, registers lifecycle hooks, and applies a default policy. Calling allow_all and build, then start, then chat, gives a one-shot exchange with the model. PhantomData is used in the builder to verify safety policies at compile time. For more control there is a Conversation type built on top of a ConnectionStrategy, which keeps step history across calls so an agent can carry a session forward. Custom tools are added by implementing a Tool trait with a name, description, JSON schema for arguments, and an async call method. A small policy DSL lets the developer write things like deny_all followed by allow VIEW_FILE. Web integration is shown in two patterns. A Leptos plus Axum example runs the agent in process on a normal server. A Leptos plus Spin example targets WASI on the edge: because Spin components cannot open outbound TCP connections themselves, the SDK switches to a sidecar mode in which the Wasm code talks over HTTP to a separate agent_server process. The SDK also compiles to wasm32-wasip1 directly, in which case it switches to a Direct Network Connection mode that opens a WebSocket to a host side runtime server, sends an InitializeConversationEvent, then runs a reader and sender loop on the WASM event loop to ferry events back and forth.

Copy-paste prompts

Prompt 1
Run scripts/install_harness.sh and a cargo run --example hello_world against my GEMINI_API_KEY
Prompt 2
Implement a custom Tool with a JSON schema and register it on the Agent builder
Prompt 3
Set up a deny_all then allow VIEW_FILE policy using the SDK policy DSL
Prompt 4
Wire antigravity-sdk-rust into a Leptos plus Axum server that streams agent replies
Prompt 5
Target wasm32-wasip1 and walk through the Direct Network Connection WebSocket flow
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.