Build a Rust agent on Antigravity with a typed Agent builder and a tool trait
Run a Leptos plus Axum web app that hosts an in-process Gemini agent
Deploy a Spin WASI component that talks to a sidecar agent_server over HTTP
Carry a multi-turn Conversation with policy-guarded tool calls
Needs the Go localharness binary plus a Gemini API key, and WASI paths require a separate agent_server or host runtime.
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.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.