Skip to content
Verification and guardrailsallAllLearnVerification and guardrails LearnAllAntigravity AppAntigravity CLIAntigravity IDEIDE ExtensionsAntigravity SDK

AI models can write plausible code that breaks at runtime, misses an edge case, or calls an unrecognized API. Reliable agent workflows treat verification as part of the prompt, not an afterthought.


Combine fast deterministic checks with real runtime checks so the agent catches bugs before you open the diff:

Verification layerWhat it catchesExample in Antigravity
Type checks and lintersSyntax errors, bad imports, and mismatched types.Ask the agent to run tsc --noEmit, eslint, or go vet after edits.
Unit testsLogic regressions and broken math or data transformations.Keep pure logic separate from UI code so npm test or pytest finishes in milliseconds.
Live browser checksBlank renders, broken layouts, 404 assets, and console errors.Use Browser use or /browser to click through flows and inspect screenshots.
Independent reviewMissed edge cases, weakened assertions, and unrequested edits.Pair workers with @verifier in /swarm and inspect diffs in Review changes or /diff.
Failure modeWhy unit tests miss itAntigravity guardrail
Unrecognized API or outdated flagMocks hide real upstream signatures.Ground prompts in package manifests or the Google Developer Knowledge MCP server.
Blank canvas, bad layout, or 404 assetsUnit tests run without a live DOM or WebGL renderer.Run Browser use or /browser to verify console output and screenshots.
Weakened or deleted assertionsThe suite still passes after loosening checks.Review test diffs first in Review or /diff, or run a cross-model @verifier in /swarm.
Unsafe shell command or secret readUnit tests do not enforce host boundaries.Combine the Terminal sandbox, Deny rules, and PreToolUse Hooks.

Before giving an agent broad autonomy, set clear execution and review boundaries:

  • Permissions (Deny > Ask > Allow): Control file access (read_file, write_file), shell commands (command), web URLs (read_url, execute_url, download_url), and MCP tools (mcp). Conflicting rules always evaluate in priority order: Deny > Ask > Allow. See Permissions.
  • Terminal sandbox: Isolates shell commands at the OS level (Linux namespaces, macOS sandbox-exec, and Windows process security environments on Windows 11 24H2+). Outbound network access is blocked by default (only read_url domains are allowlisted), and sensitive files like ~/.ssh and .env are blocked. See Terminal sandbox.
  • Lifecycle hooks: Deterministic shell scripts in .agents/hooks.json or ~/.gemini/config/hooks.json (PreToolUse, PostToolUse). Unlike prompt instructions, hooks run every time and can block unsafe commands or run linters automatically. See Hooks.
  • Plan approval (Artifact review): Controls Plan Review Policy (Always Ask vs. Always Proceed) for implementation plans. Invoking /plan always pauses for your approval before code edits begin.
  • Diff review (Review changes): Inspect Git diffs file by file, leave inline line comments for the agent, stage or discard files, and commit when satisfied.
  • Permission presets: Choose Request Review, Default, Auto, or Turbo. Default runs commands in the sandbox and asks outside. Auto checks safe host commands automatically (v2.23.0+ macOS/Linux, v2.26.0+ Windows, personal accounts). Switch presets in Settings, per project, or from the message box.
  • Built-in browser guardrails: On personal Google Accounts (v2.30.0+), the built-in browser isolates localhost by port and masks sign-in or payment frames. File uploads (and data:/blob: downloads) require one-time approval, while standard file downloads (v2.31.0+) prompt per domain unless allowed by Browser Actuation Rules or Turbo. Business and enterprise accounts use /browser with local Chrome (v144+).
  • Review pane: Open Review from Overview (Cmd + Option + O or Ctrl + Alt + O). Inspect Uncommitted, Branch, or Agent Edits diffs and send inline comments.

Add standing Deny rules in Permissions to block destructive commands and protect sensitive paths regardless of preset:

command(rm -rf)                    # Block destructive deletions
command(regex:curl .*)             # Block unvetted curl downloads
command(sudo)                      # Block sudo privileges
write_file(.git/)                  # Safeguard Git history
write_file(/home/user/.ssh)        # Safeguard SSH keys

Three habits eliminate most hallucination issues:

  • Ground the agent in primary sources. Point to real workspace files, package manifests (package.json, pyproject.toml), or the Google Developer Knowledge MCP server instead of relying on model memory.
  • Keep tests honest. Review test diffs alongside implementation diffs so a failing assertion is fixed at the root cause, never deleted or loosened.
  • Inspect visual output directly. For frontend, canvas, or 3D apps, passing unit tests do not prove the page renders cleanly. Run a live browser check and inspect the screenshot.
Run the unit tests, start the local dev server, and use /browser to verify the main flow loads with zero console errors and no horizontal overflow on desktop and mobile viewports.