# Google Antigravity SDK

> A Python SDK for building AI agents powered by Google Antigravity and Gemini, providing a secure, scalable, and stateful infrastructure layer that abstracts the agentic loop.

The Google Antigravity SDK is a Python library released by Google as part of the Google I/O event, designed to simplify the construction of AI agents built on Gemini. It abstracts the agentic loop behind a clean async API, letting developers focus on agent behavior rather than infrastructure plumbing. The SDK is distributed via PyPI (`pip install google-antigravity`) and includes a compiled runtime binary bundled in platform-specific wheels — cloning the repository alone is not sufficient to run it.

## What It Is

Google Antigravity SDK is a developer framework in the **agent frameworks** category. Its core job is to provide a stateful, secure, and scalable infrastructure layer for Gemini-powered AI agents written in Python. Rather than requiring developers to manually wire together model calls, tool dispatch, session history, and lifecycle hooks, the SDK encapsulates all of that behind three composable layers: a high-level `Agent` class, a session-level `Conversation` abstraction, and a low-level transport adapter (`Connection`/`ConnectionStrategy`).

## Three-Layer Architecture

The SDK is organized into a deliberate three-layer stack:

- **Layer 1 — Simplified**: The `Agent` class is the batteries-included entry point. It handles binary discovery, tool wiring, hook registration, and policy defaults behind a single async context manager.
- **Layer 2 — Session**: `Conversation`, `ChatResponse`, `Step`, `ToolCall`, `HookRunner`, `ToolRunner`, and `TriggerRunner` provide stateful session management with history accumulation, turn counting, and streaming step introspection.
- **Layer 3 — Adapter**: `Connection`, `ConnectionStrategy`, and `LocalConnection` abstract the transport and backend, making it possible to swap execution environments without changing application logic.

## Key Capabilities

- **Multimodal ingestion**: Attach images, videos, audio, and documents alongside text prompts using typed content classes (`Image`, `from_file`) or raw in-memory bytes.
- **Custom tools**: Register plain Python functions as agent-callable tools with automatic type inference.
- **MCP integration**: Connect to external Model Context Protocol (MCP) servers via `McpStdioServer`, exposing their tools directly to the agent.
- **Hooks and policies**: A declarative policy system supports `deny`, `allow`, `ask_user`, and `enforce` rules per tool, enabling fine-grained human-in-the-loop control.
- **Triggers**: Background tasks can react to external events (e.g., on a timer with `every(60, handler)`) and push messages into the agent autonomously.
- **Streaming**: Real-time token streaming, thought/reasoning delta streaming, and strongly-typed `ToolCall` event streaming are all supported via async iterators.

## Safety and Defaults

By default, `Agent` runs in **read-only mode** — write-capable tools are disabled unless explicitly enabled via `CapabilitiesConfig()`. The policy system allows developers to block all tools by default and selectively allow or gate specific operations behind user confirmation, making it practical to deploy agents in sensitive environments.

## Update: Released at Google I/O

The SDK was released as part of the Google I/O event and published to PyPI under the package name `google-antigravity`. The GitHub repository (`google-antigravity/antigravity-sdk-python`) was created in April 2026 and last updated in May 2026. The project is licensed under Apache License 2.0, making it fully open source. Documentation is expected at the Google Cloud developer docs landing page, though the vendor notes that the docs page had not yet been updated at the time of release. The repository had accumulated 108 stars and 13 forks shortly after launch.

## Features
- Async Agent class with full lifecycle management
- Stateful Conversation sessions with history accumulation
- Real-time token streaming via async iterators
- Thought/reasoning delta streaming
- Strongly-typed ToolCall event streaming
- Multimodal ingestion (images, video, audio, documents)
- Custom Python function tool registration
- MCP (Model Context Protocol) server integration
- Declarative hooks and policy system (deny, allow, ask_user, enforce)
- Background triggers reacting to external events
- Read-only mode by default for safety
- Three-layer architecture (Agent, Conversation, Connection)
- Interactive loop utility
- Platform-specific PyPI wheels with compiled runtime binary

## Integrations
Gemini API, Model Context Protocol (MCP), PyPI, Google Cloud

## Platforms
API, CLI, DEVELOPER_SDK

## Pricing
Open Source

## Links
- Website: https://github.com/google-antigravity/antigravity-sdk-python
- Documentation: https://antigravity.google/docs/sdk-overview
- Repository: https://github.com/google-antigravity/antigravity-sdk-python
- EveryDev.ai: https://www.everydev.ai/tools/google-antigravity-sdk
