ANTIGRAVITY LABJP
Articles/Agents & Manager
Agents & Manager/2026-07-01Advanced

It Worked Interactively but Went Silent Overnight — Making an Antigravity Agent Behave the Same in the Desktop and the CLI

An agent that runs perfectly in the Antigravity desktop app but does nothing when you schedule it through the CLI. This walks through absorbing the gap between interactive and unattended runs across four points — approvals, context, secrets, and runtime — with working code and a preflight check, so one definition behaves identically on both.

antigravity405agents115cli7automation71

Premium Article

On a Friday night I took an agent that ran flawlessly on my desktop and dropped it, unchanged, into a scheduled run. The next morning the log showed nothing — no commit, no push, not even an error. It had quietly timed out waiting for an approval dialog that could never appear.

This gets easier to hit now that Antigravity 2.0 has split into a VS Code–style IDE and a chat-style agent app, and the surfaces have multiplied further with the Antigravity CLI (agy) and cloud runs via the Gemini Enterprise Agent Platform. The moment an agent definition assumes an interactive run, it stops holding up unattended. As an indie developer I run several blog and app updates in parallel — interactively during the day, and through a scheduled CLI at night — so I have tripped over this "surface gap" more than once.

Forking the definition per surface is the wrong fix: patch one and the other rots. The goal here is to keep a single definition and absorb the interactive/unattended difference at four points, with working code.

The gap breaks on assumptions, not on speed

When an unattended run fails, the cause is rarely the model's intelligence or latency. It's almost always an assumption a human filled in silently during an interactive run that simply isn't there off the terminal. In my experience the gap collapses to four places.

Break pointInteractive (desktop)Unattended (CLI / scheduled / cloud)
ApprovalsA human decides in the approval dialogNo dialog can show; it waits silently, then dies
Context@ references, the selection, the open folder flow in implicitlyNone of that exists; only the string you passed is context
SecretsPulled interactively from the keychainKeychain is locked; only env vars or secret files
RuntimeThe interactive shell's PATH and working folder applyA minimal PATH; working directory undefined

The important move is not to rewrite the definition so it "also works unattended," but to detect the surface in one place and insert a layer that absorbs the per-surface difference. The definition itself reads the same on either surface.

Detect the surface in exactly one place

Scatter the check and interactive-only branches spread everywhere until it breaks. Decide once at the entry point and carry it through an environment variable.

# surface.sh — detect the run surface once and carry it through
# If stdin and stdout are attached to a terminal, treat it as interactive
if [ -t 0 ] && [ -t 1 ] && [ -z "${AGY_SCHEDULED:-}" ]; then
  export AGY_SURFACE="interactive"
else
  export AGY_SURFACE="unattended"
fi
echo "surface=$AGY_SURFACE"

When you launch from a scheduler or the CLI, also pass AGY_SCHEDULED=1 so the run is unambiguously unattended. Relying on the terminal check alone can misclassify a piped interactive case, and that one line of insurance is what makes the approval policy below fail safe.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
You'll be able to pin down why an agent that worked in the desktop app silently stalls under the CLI or a scheduled run, by splitting the causes into approvals, context, secrets, and runtime
You'll add surface detection, an approval-policy shim, and a fixed secret-resolution order so a single agent definition behaves the same interactively and unattended
You'll wire a preflight parity check before scheduling, so an overnight unattended run doesn't surface as a morning incident
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
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 →

Related Articles

Agents & Manager2026-06-28
The Day the Article I Asked It to Format Became the Agent's Instructions
When you run an unattended content-formatting pipeline with Antigravity CLI, instruction-like text buried in the file you are processing can hijack the agent. Here is how I separate the instruction channel from the data channel and add an output-scope acceptance gate to reject anything out of bounds.
Agents & Manager2026-06-25
Before a Major Update Silently Breaks Your Overnight Automation — Designing a Staged-Adoption Canary Gate
After a major update dropped my unattended run success rate from about 98% to 63% overnight, I built a staged-adoption gate that freezes the working setup, verifies a new version against a golden output in an isolated profile, and only then adopts it. Here is the design with bash and Python.
Agents & Manager2026-06-19
How to Orchestrate Multiple Agents: Drawing the Line Between Parallel and Serial Work
Antigravity 2.0 brings true parallel execution across multiple agents. But making everything parallel does not make it faster. Which work should fan out in parallel, and which should stay serial? This is an orchestration design that does not fall apart, viewed through dependencies and contention.
📚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 →