2026年9月23日,纽约
今天,我们宣布反重力SDK支持本地工作流程,包括各种本地模式及执行方案
Antigravity SDK使开发者能够以同样的代理能力来构建Google Antigravity. 有了这种新的支持,你就可以通过本地模型实现完全离线的代理援助。 我们优化了LiteRT和Gemma 4 26B的工作流程
当地模式执行为代理经验提供了若干好处:
- 成本效率:执行本地代理工作流程,没有API成本或费率限制。
- 隐私:将您的代码和请求完全保存在您的本地机器上,理想的开发者浏览严格的数据隐私要求或者遵守限制的企业环境。
- 离线恢复能力:无缝地执行您的代理工作流程,即使在没有连贯或稳定的互联网连接的环境中也是如此。
- 混合工作流程:将象征性高效的本地流程与基于云的流程结合起来,以最大限度地提高效率,同时在必要时保留更大、更强大的模式。
以下是您如何启动:(我们推荐了一台带有 > 24GB VRAM或统一内存的机器).
python3 - m venv.venv (英语).
来源.venv/bin/激活
Python
复制
pip 安装 google 反重力 Litert-lm
导入 lter- lm \
- 从-huggingface-repo=liter-community/gemma-4-26B-A4B-it-liter-lm - 读取 =
gemma-4-26B-A4B-it-gpu.litertlm \
gemma4-26b 电话
在您的目录中创建一个名为 agy sample.py 的文件。 粘贴以下内容。
导入 Ayncio
导入 Os
从 google.antigravity 导入 Agent, LitERTAgent Config
从 google.antigravity.hooks 导入策略
# UPDATE:指向上一步本地下载的模型(liter-lm导入。
MODEL PATH = os.path.expanduser ("~/.litert-lm/型号/gemma4-26b/model.literlm").
async def 主线( ):
print(f)"正在使用本地的LitERT模型:{MODEL PATH}. 请等待本地推论完成。 这可能需要几分钟。”
配置 = LiteRT Agent Config(模式 path=MODEL PATH). 轻量级()
以 Agent( 配置) 作为 agent 同步:
响应=等待 agent.chat("当前目录中的文件是什么?").
作为响应的符号:
打印( token, end=),冲= True)
如果。.. 名字。.. "... main...":
ayncio.run(主要( ))
在许多情况下,我们看到建筑师-建筑师模式是将云模型尺度与当地模型优势相结合的伟大方式。 在下面与更新的Antigravity SDK搭建的混合演示视频中,一位云建筑师(Gemini 3.8 Flash)担任策划者和导师,而当地Gemma 4 26B的集群例则完全处理举重的端侧。
当承担审计和补丁三个脆弱模块(Auth.py、billing.py和database.py)的任务时,工作流程保持严格的数据隐私,并使我们能够充分利用我们的象征性使用:
- 没有上传代码:Gemini 3.8 Flash计划了策略,并完全根据文件名和任务描述来分解工作——只花费了95个云符号,而没有任何源代码离开机器。
- 自主的本地格鲁莱特:本地Gemma 4 26B型机型接手本地GPU执行对抗性审计循环:复制安全弱点,编写候选修正,刻痕补丁,并验证反回归测试套件。
- 大规模成本和隐私获胜:在本次录制的运行中,97.2%的所有令牌(3,322个令牌)在本地和下线运行时没有呼叫云API,发送经过充分验证的绿色补丁,同时保持专有代码完全安全端侧。
在此检查运行内置的 3 文件 grandlet 的示例项目,或者将其指向自己的 Python 模块和测试套件。
装有Gemma 4 26B A4B的抗重力SDK在建设实用系统公用事业方面表现优异。 在这个例子中,agent建立了一个在终端运行的实时更新资源显示器。 由于一个单一的提示,agent自动写一个Python脚本,使用psutil和丰富的库来跟踪CPU和内存使用,生成必要的要求。 txt文件,甚至测试生成的代码以确保其工作——全部运行在您的本地机器上,并使用Gemma 4 26B.
一个基于 Python 的 CLI 资源监视器工具生成端侧与 Gemma 4 26B
^ cli 资源监视器.py
导入 Ayncio
导入 Os
从 google.antigravity 导入 Agent, LitERTAgent Config
从 google.antigravity.hooks 导入策略
最新消息:您的及时
PROMPT = "利用显示实时更新终端仪表板的psutil和丰富的库来构建命令行界面工具。 它应该显示CPU的使用,内存消耗,以及前5个内存最密集过程的排序表。 将脚本保存为“ monitor. py” 并创建“ requiredments. txt” 文件。 测试它是否有效。"
# UPDATE:指向本地导入的LiteRT-LM模型路径
MODEL PATH = os.path.expanduser ("~/.litert-lm/型号/gemma4-26b/model.literlm").
# UpDate:给 AGY- SDK 写文件的工作空间
Working DIR = os.path.expanduser ("~/agy-test") (中文(简体) ).
os. makedirs( WORKING DIR,存在 ok= True) (韩语).
os.chdir (WORKING DIR) (英语).
async def 主线( ):
print(f)"正在使用本地的LitERT模型:{MODEL PATH}. 请等待本地推论完成。 这可能需要几分钟。”
配置 = LitERT 客户端
模式 path=MODEL PATH
工作空间=[WORKING DIR]
政策=[政策.allow all()]
。轻量级( )
以 Agent( 配置) 作为 agent 同步:
响应=等待 agent.chat(PROMPT)
作为响应的符号:
打印( token, end=),冲= True)
如果。.. 名字。.. "... main...":
ayncio.run(主要( ))
Antigravity SDK也通过LocalOpenAIAgentConfig为任何OpenAI兼容服务器如Ollama,LM Studio,或vLLM提供无缝,插件和播放支持。 这使得你能够灵活地用不同的本地推论后端进行实验,同时保持你的agent管弦乐,工具和工作流程完全不变。
从本地AI开始,检查Antigravity Python SDK README上的指令,并更多地了解如何利用LiteRT在边缘高效运行模型。 请分享您关于反重力 Python SDK GitHub 问题跟踪器的反馈和特性请求。 我们期待着看到你们建造的东西!
致谢:阿比·帕特尔,安德·多博,本·迈尔斯,科马克·布里克,伊恩·巴兰庭,郑静晓,乔纳森·雷伊,基米什·帕特尔,卢旺,玛丽萨·伊科诺米迪斯,马蒂亚斯·格伦德曼,奥利维耶·拉科姆贝,奥马尔·桑塞维罗,里希卡·辛哈,罗德·戴维斯,泰勒·穆伦,泰勒·穆伦,韦荣洛,小明胡,许陈玉辉。
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
SEPT. 23, 2026
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!
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).
python3 -m venv .venv
source .venv/bin/activate
Python
Copied
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())
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.
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
Auto-fetched and translated by AI Atlas. All rights belong to the original author.