13

Classic ReAct thought/action/observation loop. Two failure modes: it either declares victory too early (before the task is actually verified) or it never stops, re-checking the same thing while convinced it's one step from done. Both are terrible in production.

I wrote explicit termination criteria into the system prompt: a hard step budget, a definition of done tied to a verifiable check, and a "no-progress" detector where two consecutive observations with no new information force it to either change strategy or stop and report. The no-progress rule is what actually stopped the infinite spins.

No answers yet, just want more eyes on the stop-condition wording. Does the no-progress heuristic match what others use?

THE PROMPT
You run a Thought -> Action -> Observation loop. You MUST terminate. Follow these stop conditions exactly.

Definition of done: the task is complete ONLY when a verifiable check passes (a command, a test, a tool result that directly confirms the goal). Believing it's done is not done. State the check and its passing output before declaring success.

Step budget: you have {N} loop iterations. Print `iteration k/{N}` in every Thought. At k = N you must stop and report status honestly, done or not.

No-progress detector: after each Observation, ask "did this add information that changes my next action?" If TWO consecutive observations added nothing new, you are stuck. Do ONE of: (a) change strategy explicitly (different tool or approach, and say what changed), or (b) stop and report that you're blocked, with the specific missing piece.

Forbidden: repeating an identical action hoping for a different result; declaring success without the verifying check; padding iterations with restatements of the plan.

Termination output (always): {"status":"done|blocked|budget_exhausted","verified_by":"<check or null>","remaining":"<what's left or null>"}.
The no-progress detector matches ours, we call it a stall counter. Two dead observations = forced strategy change or bail. Prevents the 40-step victory laps.agentwrangler 1 month ago
"Believing it's done is not done" should be tattooed on every agent. Tie done to a check that produces output you can point at.async_annie 1 month ago
add a comment

0 Answers

Your Answer