Log inBook a Demo
BuildSeniorBackendAuto-graded

Cut off a failing dependency and probe recovery

Tests whether someone can build automatic cutoff and recovery for a failing dependency, and prove the timing without waiting.A flaky downstream service keeps timing out, and hammering it while it is down adds latency for your callers and makes the outage worse. A circuit breaker trips after enough consecutive failures, fast-fails for a cooldown window to spare the dependency, then cautiously probes whether it has recovered. The starter in breaker.py is deliberately broken. Implement the real state machine — closed, open, half-open — with the transitions in each direction correct.
45 min
python

You're done when

  • The breaker opens after exactly the configured number of consecutive failures — not one before, not one after.
  • While open it fast-fails with CircuitOpenError, without calling the dependency at all.
  • After the reset timeout elapses it moves to half-open rather than staying open forever.
  • A failure while half-open reopens the circuit.
  • A success while half-open closes it and resets the failure count.

What it measures

Resilience engineeringImplementing a state machine whose whole purpose is to behave correctly when a dependency is misbehaving.
Recovery strategy developmentProbing a recovering service carefully rather than reopening the floodgates, and knowing what a single probe outcome should mean.
Precision on transitionsGetting the exact threshold and each state change right, where off-by-one means the breaker trips at the wrong moment.

Your environment

Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards

Start this lab

45 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo