LoopBrake · Open source

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.

GitHub
LoopBrakeA real public SWE-bench run (GPT-5-mini), replayed through LoopBrake

LoopBrake

LoopBrake

Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Claude Code
Codex
Python
Why it exists

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.

Your own agents

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.

python
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 usual

2,979

public agent runs

4.8%

at most, of good runs stopped, on average

0

runtime dependencies

Proof

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 benchmark
Ways to use it

Works where your agents run.

Claude Code

bash
/plugin marketplace add SahilSelokar/LoopBrake
/plugin install loopbrake@loopbrake
How to set it up

Codex CLI

bash
codex plugin marketplace add SahilSelokar/LoopBrake
codex plugin add loopbrake@loopbrake
How to set it up

Your own Python agents

bash
pip install loopbrake
How to set it up

Put a brake on your agents.