What is a circuit breaker for AI agents?

A circuit breaker stops an AI agent from retrying a tool call that cannot succeed, ending retry loops before they burn tokens and time.

Updated

A circuit breaker for AI agents stops an agent from retrying a tool call that cannot succeed, ending the loop early so the agent, or its code, can hand off instead of burning tokens and time.

The retry-loop problem

Agents told to "keep trying" will retry a failing call with small variations until they hit a step or budget limit. When the failure is permanent (a missing permission, a closed account, an unsupported operation), every retry is waste, and sometimes harmful.

How an agent circuit breaker works

  • Count repeats: the same failure several times in one run trips the breaker.
  • Use history: a failure known to be unrecoverable trips it on the first occurrence.
  • Return what is known: for a failure with a known fix, return the fix instead of a bare error.
  • Raise clearly: a distinct error lets the calling code escalate, hand off to a person or report.

In Retrack

memory.protect(tools) wraps LangChain tools with a breaker driven by the agent's failure signatures. See Known fixes and the circuit breaker, and how to make AI agents cost-efficient for the other places agent spend leaks.