What is the difference between a kill switch and a circuit breaker for an agent, and why do you need both?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
A kill switch is manual and global: a human notices something wrong and stops the agent. A circuit breaker is automatic and local: a threshold trips and the agent stops itself, in milliseconds, without waiting for a human. Teams almost always build the kill switch and skip the circuit breaker, and then discover that agents fail on a timescale humans cannot react to. An agent in a tool loop can burn a four-figure API bill or send 400 emails before anyone opens the dashboard.
Full worked answer with diagram
A kill switch is manual and global: a human notices something wrong and stops the agent. A circuit breaker is automatic and local: a threshold trips and the agent stops itself, in milliseconds, without waiting for a human. Teams almost always build the kill switch and skip the circuit breaker, and then discover that agents fail on a timescale humans cannot react to. An agent in a tool loop can burn a four-figure API bill or send 400 emails before anyone opens the dashboard.
Circuit breakers need concrete, boring thresholds:
class AgentBreaker:
def __init__(self, max_steps=25, max_cost_usd=2.00, fail_window=3):
self.max_steps, self.max_cost, self.fail_window = max_steps, max_cost_usd, fail_window
self.steps, self.cost, self.recent_fails, self.seen = 0, 0.0, 0, {}
def check(self, tool, args, cost, ok):
self.steps += 1
self.cost += cost
self.recent_fails = 0 if ok else self.recent_fails + 1
key = (tool, repr(args))
self.seen[key] = self.seen.get(key, 0) + 1
if self.steps > self.max_steps: raise Trip("step cap")
if self.cost > self.max_cost: raise Trip("budget cap")
if self.recent_fails >= self.fail_window: raise Trip("repeated failures")
if self.seen[key] > 2: raise Trip("loop guard")
The loop guard (same tool, same arguments, more than twice) catches the single most common runaway pattern and costs nothing.
Three things people get wrong about the kill switch. It must be out of band: if the stop command is routed through the agent's own loop, it does not work when the loop is wedged. It must revoke credentials, not just terminate a process, because in-flight requests and queued jobs continue. And it needs a tested granularity ladder: per-session, per-tool flag, per-tenant pause, then global. A single big red button that takes the whole product down never gets pressed, which means it may as well not exist.
Worth sketching. Putting the thresholds on the exit arrows shows you know the automatic control lives inside the loop and the manual one has to sit outside it.
flowchart TD
A["Agent step"] --> B["Breaker check"]
B -->|"steps over cap"| S["Trip and stop"]
B -->|"cost over budget"| S
B -->|"3 failures in a row"| S
B -->|"same tool and args twice"| S
B -->|"all clear"| C["Execute tool"]
C --> A
H["Human kill switch<br/>out of band"] --> R["Revoke credentials"]
R --> S
What a good answer covers
- A kill switch is manual and global: a human notices something wrong and stops the agent
- A circuit breaker is automatic and local
- Teams almost always build the kill switch and skip the circuit breaker, and then discover that agents…
- An agent in a tool loop can burn a four-figure API bill or send 400 emails before anyone opens the dashboard
- The loop guard (same tool, same arguments, more than twice) catches the single most common runaway…
In the glossary: Circuit breaker
Interviewer follow-ups to expect
What would you alert on to catch a runaway agent before the breaker trips?
How do you make sure the kill switch actually works when you need it, given it is never exercised in normal operation?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep