When a model provider starts timing out, retrying is the worst thing you can do. Every request waits its full 30-second timeout before failing, your workers fill with calls that are going nowhere, and an outage in one dependency becomes an outage in your whole application. A circuit breaker fails fast instead, and, crucially, knows how to find out when the provider is back.
Write circuit_breaker(timestamps, results, failure_threshold=3, cooldown=10.0).
results[i] is what the call would return: "ok" or "fail". Return what actually happened for each request: "ok", "fail", or "rejected" if the breaker refused to make the call at all.
failure_threshold consecutive failures opens it. A success resets the count."rejected" without being attempted, until cooldown seconds have passed since it opened.Build the architecture on a canvas: place the components, configure them, connect them into a data flow, and write a short reason for each one. The AI reviewer grades your design against a rubric written specifically for this problem.
Minimum 5 components · needs a wide desktop screen