The article argues that production AI agents often fail because developers treat validation as a deterministic assertion rather than a non-deterministic loop. In deterministic systems, an assertion—such as assert(result == expected) —works because outcomes are binary and checks are computationally cheap. However, LLM outputs are probabilistic and often result in partial success, such as an agent renaming six out of eight function call sites. Treating these partial successes as a binary "fail" discards critical data, while treating them as "success" leads to false confidence. To solve this, the author proposes a validation loop consisting of four stages: observing the real-world outcome (not the model's self-report), scoring that outcome with partial credit (e.g., a score of 0.75 for 6/8 tasks), deciding on an action based on thresholds, and routing the result—whether to retry, escalate to a stronger model, or halt. This architecture should be implemented at two scales: as per-step middleware to prevent error compounding, and as an end-to-end harness to act as a circuit breaker for the final task. Ultimately, the orchestrator must control the loop to ensure the agent does not unilaterally decide its own success based on internal belief rather than external observation.

Read original