◉ANTIGRAVITY LABJP
Articles/Agents & Manager
◈ Agents & Manager/2026-05-29Advanced

Supervising Long-Running Antigravity Agents — Watchdog and Tiered Recovery

Eight weeks of running AdMob revenue optimization on Antigravity background agents revealed three quiet failure modes. Here is the watchdog plus tiered recovery design I landed on.

agents146antigravity464watchdogobservability19production71

✦ Premium Article

I am Masaki Hirokawa (@dolice), an indie developer since 2014, running a portfolio of wallpaper and mindfulness apps with around 50 million cumulative downloads. For the past eight weeks I handed off AdMob eCPM tuning and Crashlytics triage to Antigravity background agents. After the first three weeks I learned an uncomfortable thing: agents keep running while completely broken. The process is alive, the terminal stays quiet, but nothing inside is actually moving.

Below are the three stall modes I observed across that period, and the watchdog plus heartbeat plus tiered recovery design I eventually settled on. Notes for fellow indie developers running agents overnight.

Three observed stall modes

When a long-running agent goes quiet, the failure mode almost always falls into one of three buckets. Across eight weeks I logged 142 abnormal terminations with the following breakdown.

  1. Unresponsive (41%) — An LLM call goes out and never returns, but the SDK never raises a timeout or retry either. Process is alive, CPU sits at 0%, everything looks fine.
  2. Session-dead (34%) — The Antigravity workspace session has expired internally. New tool calls fail silently. The agent keeps planning the "next step" as if nothing was wrong.
  3. Context-bloat (25%) — Input context exceeds limits, the agent enters elision mode, can no longer recall its earlier decisions, and loops over the same step.

None of these is detectable from outside. The process is alive, memory and CPU look calm. You have to look at internal logical state. This is the biggest trap I fell into as someone who used to rely on process-level monitoring.

Overall architecture

This is the layout I landed on.

  ┌────────────────────────────────┐
  │ Agent Process (Antigravity)    │
  │  - business logic              │
  │  - heartbeat(stage, progress)  │──┐
  └────────────────────────────────┘  │ writes
                                       ▼
                            ┌───────────────────┐
                            │ heartbeat.json    │ (atomic write)
                            └───────────────────┘
                                       ▲
                                       │ reads (5s interval)
  ┌────────────────────────────────┐  │
  │ Supervisor Process             │──┘
  │  - watchdog timer              │
  │  - tiered recovery             │
  │  - escalation log              │
  └────────────────────────────────┘

The agent itself only writes its own progress to heartbeat.json. All judgment lives in the supervisor. The premise is that an agent in trouble cannot be relied on to rescue itself.

Why an external supervisor instead of self-monitoring

I tried the pattern of "if you find yourself stuck, please recover" inside the agent itself first. It failed on two of the three stall modes. The unresponsive mode never reaches the recovery code path, and the context-bloat mode forgets the very fact that it is stuck. An independent supervisor process is non-negotiable.

✦

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
✦Three stall modes observed across 8 weeks (unresponsive / session-dead / context-bloat) and how to detect each
✦Full TypeScript implementation of watchdog and heartbeat protocol in about 90 lines
✦Tiered recovery (soft retry / context reset / agent rotation) with the measured 87% auto-recovery ratio across 6 parallel sites
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-05-27
Record & Replay for Antigravity Agents
How to deterministically replay a failed Antigravity Agent run offline, drawn from a month of running it across four production sites. Covers boundary recording, R2 + KV storage costs, PII masking, and a working TypeScript harness.
◈ Agents & Manager2026-05-12
Tracking AI Agent Decisions in Antigravity: Implementing Decision Logs and Explainability
Learn how to design decision logging systems that capture why your AI agents make specific choices. Includes working Python code examples, Before/After patterns, and a quality improvement cycle for production Antigravity agents.
◈ Agents & Manager2026-05-11
Canary Deployment with Auto-Rollback for AI Agents — Protecting Production with Antigravity and Burn-Rate SLOs
A practical playbook for shipping new AI agent versions through canary deployment on Antigravity, with automatic rollback driven by burn-rate SLOs. Includes a lightweight setup that solo developers can sustain.