AI engineering · 16 of 42
Stop repeatedly calling a failing service
Scroll
Stop repeatedly calling a failing service
When a dependency starts failing, the instinctive response — retry — is the worst one. Retries add load to the service that is already struggling and turn a small outage into a large one.
A circuit breaker watches the failure rate and, past a threshold, stops calling altogether. Callers get an immediate error or a fallback instead of waiting for a timeout. After a cooldown it lets one request through: success closes it, failure reopens it.
The half-open state is the part people skip, and it is what stops the breaker becoming a permanent outage of its own. Fast failure is also kinder to whatever is upstream of you, which in an agent loop is usually something that will otherwise retry too.
Reliability