ANTIGRAVITY LABJP
Articles/Agents & Manager
Agents & Manager/2026-04-11Intermediate

Antigravity × Gemma 4 Multi-Agent Workflow: Building Local LLM-Powered AI Systems

Learn how to combine Antigravity IDE with Gemma 4 to build multi-agent systems that run entirely on your local machine. From setup to a practical CI/CD pipeline, this guide has you covered.

gemma412multi-agent49local-llm17antigravity429agents-md8

Combining Google's AI IDE Antigravity with the open-source Gemma 4 model opens up a compelling option: multi-agent systems that run entirely on your local machine — no cloud API costs, no data leaving your environment. Below, we build that setup from scratch and wire it into a workflow you can actually use day to day.

Why Antigravity × Gemma 4 for Multi-Agent Work?

Antigravity's multi-agent system lets multiple AI agents collaborate on complex tasks, each handling a specific responsibility. By default it uses Gemini API, but swapping in a locally-running Gemma 4 brings meaningful advantages.

Zero marginal cost for agent-to-agent calls

In a multi-agent setup, agents exchange messages constantly — the Manager delegates, sub-agents report back, the Manager synthesizes. Every round-trip with a cloud API is a billable call. Running Gemma 4 locally means none of that costs anything, no matter how many iterations your agents go through.

Data stays on your machine

For teams working with proprietary codebases, client data, or anything sensitive, local execution is a hard requirement in many cases. With Gemma 4 running locally, your code and context never touch an external server.

Unlimited experimentation

Rate limits disappear. You can run the same agent workflow dozens of times to tune your prompts and agent configurations without worrying about hitting quotas.

For a solid grounding in multi-agent concepts first, check out our Antigravity Multi-Agent Beginner's Guide.


Setting Up Gemma 4 Locally with Antigravity

There are two ways to use Gemma 4 in Antigravity: via the Gemini API (cloud) or via a local runtime like Ollama. We'll use the local Ollama approach here.

Install Ollama and Pull Gemma 4

# macOS / Linux
curl -fsSL https://ollama.com/install.sh | sh
 
# Download the Gemma 4 12B model (~4GB)
ollama pull gemma4:12b
 
# Verify it works
ollama run gemma4:12b "Introduce yourself in one sentence."
# Expected output: I'm Gemma 4, an open-source model developed by Google.

Configure Antigravity to Use Your Local Model

Add the following to ~/.antigravity/config.json:

{
  "models": {
    "local": {
      "provider": "ollama",
      "model": "gemma4:12b",
      "baseUrl": "http://localhost:11434",
      "enabled": true
    }
  },
  "agents": {
    "defaultModel": "local"
  }
}

Restart Antigravity and you should see "Gemma 4 (Local)" in the model selector. For a more detailed walkthrough of local LLM configuration, see our Complete Guide to Running Local LLMs in Antigravity.


Defining Your Multi-Agent System with AGENTS.md

Antigravity's multi-agent framework reads its configuration from an AGENTS.md file in your project root. This is where you declare each agent's role, responsibilities, and which model it should use.

Example: Two-Agent Code Review Setup

# Multi-Agent Configuration
 
## Manager
- Role: Receive tasks, delegate to sub-agents, synthesize results
- Model: local (Gemma 4)
- Responsibilities:
  - Analyze incoming user requests
  - Route tasks to CodeReviewAgent or DocAgent as appropriate
  - Consolidate outputs and present a summary to the user
 
## CodeReviewAgent
- Role: Review code quality, security, and readability
- Model: local (Gemma 4)
- Responsibilities:
  - Analyze specified files for issues
  - Produce a prioritized list of problems and improvement suggestions
  - Flag any security risks at the top of the report
 
## DocAgent
- Role: Generate and update documentation from code
- Model: local (Gemma 4)
- Responsibilities:
  - Write JSDoc comments for functions and classes
  - Propose README updates based on changes
  - Append change entries to the changelog

Antigravity loads this file, spins up the agents, and routes work through the Manager automatically.


Practical Workflow: Automated Pre-PR Review Pipeline

Here's a real-world example: a script that runs your multi-agent system before every pull request, automatically reviewing code and updating docs.

How the Pipeline Works

  1. Developer finishes writing code
  2. The script triggers the Antigravity multi-agent system
  3. CodeReviewAgent scans changed files and produces feedback
  4. DocAgent generates JSDoc comments and README updates
  5. Manager combines the outputs into a single report

The Script

Save this as scripts/pre-pr-review.sh in your project:

#\!/bin/bash
# Run AI-powered review before opening a PR
 
set -e
 
TARGET_FILES=$(git diff --name-only HEAD~1 HEAD | grep -E '\.(ts|tsx|js|py)$')
 
if [ -z "$TARGET_FILES" ]; then
  echo "✅ No reviewable files changed."
  exit 0
fi
 
echo "🤖 Starting Antigravity multi-agent review..."
echo "Files:"
echo "$TARGET_FILES"
 
antigravity agent run \
  --config AGENTS.md \
  --task "Please review the following files and provide feedback and documentation suggestions: $TARGET_FILES" \
  --model local \
  --output review-report.md
 
echo "📋 Review complete. See review-report.md for results."
# Make it executable and run it
chmod +x scripts/pre-pr-review.sh
./scripts/pre-pr-review.sh
 
# Sample output:
# 🤖 Starting Antigravity multi-agent review...
# Files:
#   src/api/user.ts
#   src/components/UserCard.tsx
#
# [CodeReviewAgent] Analyzing src/api/user.ts...
# [CodeReviewAgent] Found 2 issues, 3 improvement suggestions
# [DocAgent] Generating JSDoc comments...
# [Manager] Consolidating results...
# 📋 Review complete. See review-report.md for results.

To automate this on every commit, add it to your .git/hooks/pre-commit file or wire it into your package.json scripts.


Performance Tuning for Local Multi-Agent Runs

Local LLMs are slower than cloud APIs, but smart configuration goes a long way.

Trim Context Per Agent

Multi-agent conversations accumulate context quickly. Keep each agent's input focused:

{
  "agents": {
    "contextWindow": 4096,
    "summarizeAfter": 2048,
    "parallelAgents": 2
  }
}

Setting parallelAgents: 2 lets CodeReviewAgent and DocAgent run simultaneously, cutting total wall-clock time roughly in half.

Use a Quantized Model Variant

If you're RAM-constrained, quantized versions run significantly faster:

# Q4 quantized — half the memory, slight quality trade-off
ollama pull gemma4:12b-q4_K_M
 
# Point Antigravity at it in config.json:
# "model": "gemma4:12b-q4_K_M"

For a deeper look at what Gemma 4 can do, see our Gemma 4 Complete Guide 2026, which covers multimodal features and API integration as well.


Looking back

Here's what the Antigravity × Gemma 4 local multi-agent stack gives you:

  • Zero API cost for agent-to-agent communication — local execution means no metered calls
  • Declarative agent design via AGENTS.md — readable, version-controllable configuration
  • Easy CI/CD integration — drop the review script into your pre-commit hooks
  • Hybrid cloud/local flexibility — mix models per agent based on what each task needs

The best way to get started is to pick one small workflow — code review, doc generation, test writing — and build a minimal two-agent system around it. Once that's running smoothly, you'll have a clear sense of where adding more agents actually helps.

Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Agents & Manager2026-04-14
Antigravity × AgentKit 2.0 × Gemma 4: Cut API Costs by 80% with a Local Multi-Agent System in Production
A complete implementation guide to combining AgentKit 2.0 with locally-run Gemma 4, cutting cloud API costs by 80% while maintaining production-grade quality. Covers hybrid LLM routing, fault tolerance, and cost monitoring.
Agents & Manager2026-03-26
Multi-Agent Development with Antigravity — Building Autonomous AI Teams with AgentKit
Deep dive into AgentKit 2.0 multi-agent design patterns. 5 orchestration strategies, runaway prevention, cost control, and production-ready templates.
Agents & Manager2026-06-19
Your Antigravity Sandbox Isolates Multi-Agents Less Than You Think — Notes on Containing the Blast Radius
An Antigravity sandbox gives you the feeling of isolation, but isolation leaks through three real gaps: shared volumes, over-broad allowed domains, and approval fatigue. Field notes on plugging the leaks, containing the blast radius by design, and proving isolation holds with tests.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →