Brakes for StuckAI Agents.
Stops agent tasks that run far past their normal length, and tells you why. Learned from your own past tasks; runs on your machine.
LoopBrake
LoopBrake
An agent that runs forever wastes your time and your tokens.
Fixed limits guess
The usual fixed rule stopped anywhere from 1.2% to 99.3% of good runs, depending on the agent.
Learned from your normal
Your limit comes from your own past successful tasks, so it fits how your agent really works.
A reason in plain words
When it stops a task, it says why, in plain words, so you know what to look at.
Three lines.
A brake per agent.
Name what you watch, wrap each tool your agent can call, and run each job inside a task. Every tool call is counted by itself. In a team of agents, use one brake for the whole job or one per agent, each with its own limit.
import loopbrake
brake = loopbrake.watch("my-agent")
@brake.tool
def search(query): # one of your agent's tools
return f"results for {query}"
with brake.task(): # one job for your agent
search("flights to Lisbon") # your agent calls its tools as usual2,979
public agent runs
4.8%
at most, of good runs stopped, on average
0
runtime dependencies
Tested on 2,979
public agent runs.
For each public agent group, LoopBrake set its limit from 20 successful runs and was scored on runs it hadn't seen. The promise held in every group: on average it stopped at most 4.8% of good runs. For you: fewer than 1 in 20 good tasks get stopped, as long as your future tasks are like your past ones.
See the benchmarkWorks where your agents run.
Claude Code
/plugin marketplace add SahilSelokar/LoopBrake
/plugin install loopbrake@loopbrakeCodex CLI
codex plugin marketplace add SahilSelokar/LoopBrake
codex plugin add loopbrake@loopbrake