Back to browse
GitHub Repository

An open-source cost controller for AI agent loops — stops a loop when it's actually converged and rolls back before it degrades, instead of running to a fixed max_iterations cap. Real-time loop-gain (Aβ) bands + best-so-far rollback. Adapters for LangGraph, CrewAI, AutoGen, LangChain, OpenAI Agents, and Claude Agent SDK; raw API for custom stacks.

1 starsPython

LoopGain – Cut agent API spend by measuring when loops stop improving

by fitz2882·Jun 10, 2026·1 point·1 comment

AI Analysis

●●●BangerBig BrainWizardry

1921 electrical engineering oscillator math stops AI loops at convergence.

Strengths
  • Barkhausen criterion from control theory is genuinely non-obvious approach
  • 92.8% spend reduction with preserved output quality across 2000 trials
  • Adapters for six major agent frameworks plus raw API for custom stacks
Weaknesses
  • Detects convergence not correctness — verifier quality determines output
  • Requires measurable error signal, limiting applicability to some workflows
Category
Target Audience

Developers building iterative AI agent workflows

Similar To

LangGraph · AutoGen

Similar Projects

AI/ML●●Solid

Agentic Intent Benchmark

First benchmark testing structured requirements on complex greenfield agent tasks.

Niche GemBig Brain
ryan4rtmx
2012d ago