# Antigravity Goal Loops: Set Retry Limits Before Letting an Agent Run

Use Antigravity's goal workflow with explicit stopping rules, independent checks and recoverable state. Google's example budgets are not universal limits.

By Paras Madan | 2026-11-18


A coding loop needs more than an instruction to keep working until the tests pass. It needs a way to distinguish success from exhaustion, preserve unfinished work and stop when another attempt would repeat the same mistake.

Google's November 18 Antigravity tutorial makes those controls concrete. The useful question for a developer is not how long an agent can run. It is what happens when the first attempt fails, the budget runs out or the next step needs a decision nobody authorized.

## Set the goal before starting the loop

The [Google Cloud tutorial](https://cloud.google.com/blog/topics/developers-practitioners/how-to-build-durable-agentic-systems-with-google-antigravity-from-instructions-to-loops) pairs `/grill-me` for clarifying requirements with `/goal` for sustained execution. Its custom SDK example is explicitly experimental, not production-ready.

For a bounded repository change, use the planning stage to settle three things: the behavior that must change, the behavior that must remain intact and the evidence required to call the task complete.

I would also identify decisions that stop execution. A dependency replacement, database migration or public API change should not become an incidental fix merely because it makes a local test pass. Put those boundaries in the task before the agent encounters them.

## Treat the example budgets as examples

Google's SDK sample sets `max_model_calls=20` and `max_total_tokens=200_000`. The call limit is described as soft and session-wide. The loop checks the returned `stop_reason` for budget exhaustion.

These values are not universal Antigravity limits or evidence that every task should finish in 20 calls. Start with a budget appropriate to a small experiment, then inspect what the agent actually spends.

Keep elapsed time and tool activity visible too. A token budget does not explain whether a test process hung or an external service is repeatedly timing out. Nor is a token count a fixed dollar ceiling across models with different prices.

## Give a failed check one defined next step

The sample allows one targeted retry using the real test failure output, then returns failure for human attention. That is a useful alternative to asking the model to keep trying indefinitely.

For your own workflow, distinguish a failed implementation from a broken test environment. A missing database, unavailable package registry or expired credential may not be fixable by editing application code. Repeating the same instruction in those circumstances can create unrelated changes without resolving the original blocker.

Make the handoff specific: include the failing command, relevant output, changed files and remaining uncertainty. “Could not finish” is much less useful than evidence showing exactly where execution stopped.

## Test the stop paths, not only the happy path

Before trusting a loop unattended, deliberately exercise its failure behavior. Give it a task with an impossible acceptance condition in a disposable workspace. Check that it stops instead of weakening the test, inventing success or consuming another unrestricted run.

Then try a small budget and confirm that exhaustion produces a distinct result. Finally, interrupt a run and inspect whether its notes identify the last verified checkpoint.

These are suggested validation steps, not tests I have performed against Antigravity. Their purpose is to establish that the surrounding program enforces the contract even when the model does not complete the work.

## Keep recovery separate from restarting

Google's [agent-design guidance](https://docs.cloud.google.com/architecture/choose-design-pattern-agentic-ai-system) recommends considering cost, latency and human involvement before adding orchestration. Predictable work may not need an agentic workflow at all.

For work that does, I would record the starting revision, current diff and completed checks outside the conversation. Before resuming, compare that record with the actual workspace. Restarting from a vague summary can repeat edits or overlook changes made while the run was stopped.

The result you want is not an agent that never pauses. It is a workflow that either produces verifiable work or stops with enough information for the next decision.

I'm Paras. I work at the intersection of AI, engineering and distribution.

I help developer-tool teams explain agent workflows through practical technical stories.

[Book a 30-minute call](https://cal.com/paras-madan/30min).

