Google just dropped local model support for the Antigravity engine. While the IDE’s graphical chat panel is still locked to cloud models, here is the quick trick to spin up an offline, interactive Antigravity CLI powered by Ollama, LM Studio, or Gemma 4 in under 10 lines of code.
If you’ve been following Google’s recent release of Local AI Model Support in the Antigravity SDK, you probably opened your Antigravity IDE or Desktop app, clicked the model selector dropdown in the sidebar chat, and wondered:
“Where is the toggle for Ollama or local Gemma? Why are there only cloud Gemini models here?”
Here is the reality: The Antigravity IDE and Desktop GUI chat panel do not natively support local model selection yet. Their graphical sidebar is still hardcoded to Google Cloud endpoints.
However, Google released full on-device agentic capabilities in the underlying Antigravity engine (google-antigravity).
With a simple trick using the SDK’s built-in interactive runtime, you can build your own offline Antigravity CLI agent that runs directly inside your terminal (including your IDE’s integrated terminal). It gives you complete agentic superpowers—autonomous file edits, shell execution, workspace sandboxing, and MCP tools—powered entirely by Ollama, LM Studio, or on-device Gemma 4, with zero API keys and zero cloud bills.
Here is how to set it up in less than 5 minutes.
The “Trick”: Bridging the SDK to an Interactive CLI
Rather than running one-off scripts, the Antigravity SDK includes an interactive REPL runner (run_interactive_loop). When paired with LocalOpenAIAgentConfig or LiteRTAgentConfig, it transforms into a terminal-based coding assistant.
Step 1: Install Dependencies
Create an isolated environment and install the Antigravity SDK:
# Create and activate your environment
python3 -m venv ~/.antigravity-local
source ~/.antigravity-local/bin/activate
# Install the Antigravity SDK
pip install google-antigravityMethod A: The Universal Ollama / LM Studio CLI (Any Open-Source Model)
If you already have Ollama, LM Studio, or vLLM running, this method allows you to use models like Qwen 2.5 Coder, Llama 3.3, or DeepSeek.
1. Ensure your local server is running
Pull your model of choice with Ollama:
ollama run qwen2.5-coder:14b2. Create the CLI runner script
Save the following as ~/.antigravity-local/agy_local.py:
import asyncio
import os
import sys
from google.antigravity import Agent, LocalOpenAIAgentConfig, CapabilitiesConfig
from google.antigravity.hooks import policy
from google.antigravity.utils.interactive import run_interactive_loop
# 1. Target current working directory as the agent workspace
CURRENT_DIR = os.getcwd()
# 2. Configure the local agent with write permissions
config = LocalOpenAIAgentConfig(
model="qwen2.5-coder:14b", # Your Ollama/LM Studio model
base_url="http://localhost:11434/v1", # 11434 for Ollama, 1234 for LM Studio
workspaces=[CURRENT_DIR],
capabilities=CapabilitiesConfig(), # Enables file edit & command execution
policies=[policy.allow_all()], # Permits automated tool execution
system_instructions=(
"You are an expert autonomous software engineer operating inside the terminal. "
"Inspect code, create patches, run tests, and explain your reasoning clearly."
),
)
async def main():
print(f"
🚀 Antigravity CLI [Local Engine: Ollama]")
print(f"📁 Workspace: {CURRENT_DIR}")
print("Type '/exit' or press Ctrl+D to quit.
")
async with Agent(config=config) as agent:
await run_interactive_loop(agent)
if __name__ == "__main__":
try:
asyncio.run(main())
except (KeyboardInterrupt, EOFError):
sys.exit(0)Method B: On-Device Hardware Acceleration with LiteRT & Gemma 4 26B
If you want the exact setup Google showcased in their announcement, you can run Gemma 4 26B A4B compiled directly for your GPU or NPU via Google AI Edge’s LiteRT.
LiteRT (short for Lite Runtime, the next-generation evolution of TensorFlow Lite) is Google AI Edge’s high-performance, on-device inference engine. Unlike external server daemons such as Ollama or vLLM, LiteRT’s LLM subsystem (LiteRT-LM) runs directly within the agent’s execution lifecycle. It loads compiled .litertlm binaries and automatically delegates heavy matrix operations to native hardware accelerators—using Metal on Apple Silicon, CUDA on NVIDIA GPUs, or dedicated NPUs. By combining efficient 4-bit weight compression (A4B), pre-allocated 64k KV caching, and multi-token speculative decoding, LiteRT delivers fast, local token throughput without the memory bloat of traditional Python inference stacks.
(Recommended: Machine with ≥ 24 GB unified memory on Mac Apple Silicon or ≥ 24 GB VRAM on NVIDIA).
1. Install LiteRT and download the model
pip install "litert-lm>=0.15.0"
# Import Gemma 4 26B A4B from Hugging Face
litert-lm import --from-huggingface-repo=litert-community/gemma-4-26B-A4B-it-litert-lm gemma-4-26B-A4B-it-gpu.litertlm gemma4-26b2. Create the LiteRT CLI runner
Save this as ~/.antigravity-local/agy_litert.py:
import asyncio
import os
import sys
from google.antigravity import Agent, LiteRTAgentConfig, CapabilitiesConfig
from google.antigravity.hooks import policy
from google.antigravity.utils.interactive import run_interactive_loop
MODEL_PATH = os.path.expanduser("~/.litert-lm/models/gemma4-26b/model.litertlm")
CURRENT_DIR = os.getcwd()
config = LiteRTAgentConfig(
model_path=MODEL_PATH,
workspaces=[CURRENT_DIR],
max_context_tokens=65536, # 64k token context window
enable_speculative_decoding=True, # Fast inference acceleration
capabilities=CapabilitiesConfig(),
policies=[policy.allow_all()],
).lightweight()
async def main():
print(f"
⚡ Antigravity CLI [Local Engine: LiteRT Gemma 4 26B]")
print(f"📁 Workspace: {CURRENT_DIR}
")
async with Agent(config=config) as agent:
await run_interactive_loop(agent)
if __name__ == "__main__":
try:
asyncio.run(main())
except (KeyboardInterrupt, EOFError):
sys.exit(0)See It in Action: Hybrid Orchestration Demo
Google demonstrated this in action using an Architect-Builder swarm: a cloud planner (Gemini 3.8 Flash) designed the strategy, while local Gemma 4 26B instances ran the security gauntlet on-device, saving over 97% of API tokens.
Check out the official demonstration run:
(If you are reading this in an environment without JavaScript widgets enabled, you can watch the video directly on X).
Step 3: Turn It into a Global Shell Command
To make this feel like a native tool just like agy, add a quick alias to your shell configuration (~/.zshrc or ~/.bashrc):
# Add this to your ~/.zshrc or ~/.bashrc:
alias agy-local='~/.antigravity-local/bin/python ~/.antigravity-local/agy_local.py'
alias agy-litert='~/.antigravity-local/bin/python ~/.antigravity-local/agy_litert.py'Reload your shell:
source ~/.zshrcNow, navigate to any repository on your machine and simply type:
agy-localYou are immediately dropped into a full Antigravity agentic terminal loop:
🚀 Antigravity CLI [Local Engine: Ollama]
📁 Workspace: /Users/username/my-project
Type '/exit' or press Ctrl+D to quit.
> You: Inspect my repository, find all failing pytest cases, and fix them.
[Agent]: Reading tests/test_auth.py...
[Agent]: Running terminal command `pytest tests/`...
[Agent]: Modifying auth/service.py to fix token expiration bug...
[Agent]: Re-running pytest... Tests passed!Why Running in the CLI is Often Better Than the GUI
While having a dropdown in the Antigravity IDE sidebar will be convenient once Google adds it, running your local agent via this CLI trick has distinct advantages today:
- Air-Gapped Privacy: Because it connects directly to
localhost:11434or local memory, zero packets leave your workstation. It complies with strict enterprise non-disclosure policies. - Zero Context Throttling: You aren’t subject to API rate limits or hourly request caps during long, iterative refactoring loops.
- IDE Terminal Integration: Because it runs in the terminal, you can open it side-by-side with your code inside the Antigravity IDE terminal pane, giving you visual code diffs while the local terminal agent modifies files in real time.
- Hybrid Orchestration Ready: You can leave the Antigravity IDE GUI chat set to Gemini 3.8 Flash for high-level architectural brainstorming, and switch to your
agy-localterminal for deep, iterative, token-heavy test and repair loops.
What to Expect Next
The introduction of LiteRTAgentConfig and LocalOpenAIAgentConfig in the SDK shows where the Google Antigravity ecosystem is heading: full modularity between agentic orchestration and the underlying LLM.
Until Google builds a local model picker into the IDE’s graphical settings panel, this simple CLI wrapper bridges the gap—giving you unrestricted, private, on-device agentic development today.
