Antigravity SDK 支持本地模型,可完全离线运行智能体

Google Developers Blog(RSS)·2026-09-24 01:09·10分钟前
AI 导读

Google 宣布 Antigravity SDK 支持本地模型工作流,首发通过 Google AI Edge 的 LiteRT 支持 Gemma 4 26B A4B,可完全离线运行智能体,建议机器配备 >24GB VRAM 或统一内存。

Google Developers Blog(RSS)
精选
70AI 编辑部评分,满分 100

Antigravity SDK 支持本地模型,可完全离线运行智能体

2026-09-24 01:09· 10分钟前
AI 导读

Google 宣布 Antigravity SDK 支持本地模型工作流,首发通过 Google AI Edge 的 LiteRT 支持 Gemma 4 26B A4B,可完全离线运行智能体,建议机器配备 >24GB VRAM 或统一内存。

推荐理由

官方发布了本地模型支持与混合编排示例,给出代码、硬件要求和具体 token 数据,开发者可评估离线智能体工作流的可行性。

agy_litrt

Today, we’re announcing that the Antigravity SDK supports local workflows across a wide range of local models and execution options, featuring initial support for Gemma 4 26B A4B using Google AI Edge’s LiteRT.

The Antigravity SDK enables developers to build with the same agentic capabilities that power Google Antigravity. With this new support you can enable agentic assistance via local models completely offline. We’ve optimized this workflow for LiteRT and Gemma 4 26B, efficiently using the local GPU and RAM in order to further amplify what your local machine is capable of delivering!

Why run agents locally?

Local model execution offers several advantages for agentic experiences:

  • Cost efficiency: Execute local agentic workflows without API costs or rate limits.
  • Privacy: Keep your code and requests entirely on your local machine, ideal for developers navigating strict data privacy requirements or compliance-restricted corporate environments.
  • Offline resiliency: Execute your agentic workflows seamlessly, even in environments where a consistent or stable internet connection is unavailable.
  • Hybrid workflows: Combine token-efficient local processes with cloud-based ones to maximize efficiency while retaining access to larger, more powerful models when needed.

Here is how you can get started: (We recommended a machine with >24GB VRAM or unified memory).

Create a virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install Antigravity SDK and LiteRT-LM, and download Gemma 4 26B A4B:

pip install google-antigravity litert-lm

litert-lm import \
  --from-huggingface-repo=litert-community/gemma-4-26B-A4B-it-litert-lm \
  gemma-4-26B-A4B-it-gpu.litertlm \
  gemma4-26b

In your directory, create a file called agy_sample.py. Paste the following contents into it.

import asyncio
import os
from google.antigravity import Agent, LiteRTAgentConfig
from google.antigravity.hooks import policy

# UPDATE: Point to the locally downloaded model from the previous step (litert-lm import ...)
MODEL_PATH = os.path.expanduser("~/.litert-lm/models/gemma4-26b/model.litertlm")

async def main():
   print(f"Using local LiteRT model: {MODEL_PATH}. Please wait for local inference to complete. This could take several minutes.")

   config = LiteRTAgentConfig(model_path=MODEL_PATH).lightweight()
   async with Agent(config) as agent:
      response = await agent.chat("What files are in the current directory?")
      async for token in response:
         print(token, end="", flush=True)

if __name__ == "__main__":
   asyncio.run(main())

Hybrid Orchestration: Cloud Architect Meets On-Device Workforce

In many cases we see that an Architect-Builder pattern is a great way of combining cloud model scale with local model advantages. In the hybrid demo video below, built with the updated Antigravity SDK, a cloud architect (Gemini 3.8 Flash) acts as the planner and conductor, while a local swarm of Gemma 4 26B instances handles the heavy lifting entirely on-device.

When tasked with auditing and patching three vulnerable modules (auth.py, billing.py, and database.py), the workflow maintains strict data privacy and allows us to make the most of our token utilization:

  • No code uploaded: Gemini 3.8 Flash plans the strategy and decomposes the work based purely on filenames and task descriptions - spending just 95 cloud tokens without any source code ever leaving the machine.
  • Autonomous local gauntlet: Local Gemma 4 26B models take over on the local GPU to execute an adversarial audit loop: reproducing security vulnerabilities, authoring candidate fixes, critiquing patches, and validating against regression test suites.
  • Massive cost and privacy wins: In this recorded run, 97.2% of all tokens (3,322 tokens) run locally and offline without calling a cloud API, delivering fully verified, green patches while keeping proprietary code completely secure on-device.

Check out the example project here to run the built-in 3-file gauntlet or point it at your own Python modules and test suite.

视频封面视频 · 前往原文观看

Token Free Local Utilities: CLI Resource Monitor

The Antigravity SDK with Gemma 4 26B A4B excels at building practical system utilities. In this example, the agent built a live-updating resource monitor that runs in the terminal. Given a single prompt, the agent autonomously writes a Python script that uses the psutil and rich libraries to track CPU and memory usage, generates the necessary requirements.txt file, and even tests the resulting code to ensure it works - all running entirely on your local machine and using Gemma 4 26B.

视频封面视频 · 前往原文观看

A Python based CLI Resource Monitor tool generated on-device with Gemma 4 26B

## cli_resource_monitor.py

import asyncio
import os
from google.antigravity import Agent, LiteRTAgentConfig
from google.antigravity.hooks import policy

# UPDATE: Your prompt
PROMPT = "Build a command-line interface tool using the psutil and rich libraries that displays a live-updating terminal dashboard. It should show CPU usage, memory consumption, and a sorted table of the top 5 most memory-intensive processes. Save the script as 'monitor.py' and create a 'requirements.txt' file. Test that it works."

# UPDATE: Point to the locally imported LiteRT-LM model path
MODEL_PATH = os.path.expanduser("~/.litert-lm/models/gemma4-26b/model.litertlm")

# UPDATE: Give AGY-SDK a workspace to write files
WORKING_DIR = os.path.expanduser("~/agy-test")

os.makedirs(WORKING_DIR, exist_ok=True)
os.chdir(WORKING_DIR)

async def main():
  print(f"Using local LiteRT model: {MODEL_PATH}. Please wait for local inference to complete. This could take several minutes.")

  config = LiteRTAgentConfig(
     model_path=MODEL_PATH,
     workspaces=[WORKING_DIR],
     policies=[policy.allow_all()],
  ).lightweight()

  async with Agent(config) as agent:
     response = await agent.chat(PROMPT)
     async for token in response:
        print(token, end="", flush=True)

if __name__ == "__main__":
  asyncio.run(main())

The Antigravity SDK also offers seamless, plug-and-play support for any OpenAI-compatible server such as Ollama, LM Studio, or vLLM via LocalOpenAIAgentConfig. This gives you the flexibility to experiment with different local inference backends while keeping your agent orchestration, tools, and workflows completely unchanged.

Get started with local AI by checking the instructions on the Antigravity Python SDK README, and learn more about how you can run models efficiently on the edge using LiteRT. Please share your feedback and feature requests on the Antigravity Python SDK GitHub Issue Tracker. We look forward to seeing what you build!

Acknowledgements: Abhi Patel, Ander Dobo, Ben Miles, Cormac Brick, Ian Ballantyne, Jingxiao Zheng, Jonathan Reay, Kimish Patel, Lu Wang, Marissa Ikonomidis, Matthias Grundmann, Olivier Lacombe, Omar Sanseviero, Rishika Sinha, Rody Davis, Taylor Mullen, Tyler Mullen, Wai Hon Law, Xiaoming Hu, Xu Chen, Yu-hui Chen

来源:Google Developers Blog(RSS)· developers.googleblog.com