How loop gain works: knowing when an AI agent loop has converged
max_iterations is a guess because it ignores the one thing that tells you whether to stop: the trajectory of the error. Here’s how LoopGain reads that trajectory — loop gain, a log-space trend fit, and a t-test — to decide an agent loop is done.