Skip to content
mentoor

Topic 5 of 5 · 4 min read

Kill switches that turn a feature off fast

Goal: Write a kill-switch runbook step and check that it disables a capability within minutes without a deploy.

A kill switch is a remote control that turns off a whole LLM feature, or just one capability, within minutes and without a deploy, and it only counts once you have tested it. When an assistant is sending wrong refunds or leaking data, "we'll ship a fix" is too slow.

Check yourself · 1 of 3

What makes a kill switch faster than a hotfix in an incident?

Choose one answer

Why it matters

LLM failures are often behavioural and not a crash. A new injection technique, a provider model update or a bad prompt can start harming users before an engineer can write a fix. The fastest safe action is to stop the harmful behaviour while keeping everything else working.

How to do it

  1. Make switches granular. One for the whole feature, and one per dangerous capability: write access, outbound email, payments, file upload, web browsing. In an incident you usually want to take away the hand, not the whole body.
  2. Control it remotely. The switch is read from a flag service or config store at request time, with a short cache (seconds). Changing it needs no build, deploy or restart.
  3. Cover every path. Background jobs, queued tasks, retries and other clients such as the mobile app must read the same switch.
  4. Define the off state. Show users a clear message ("The assistant is paused; your drafts are saved") and, where possible, fall back to a non-AI path. Do not leave a spinner.
  5. Write the runbook. Who may flip it, where, what it does, how to verify it worked, and who tells users.
  6. Test it before launch and on a schedule. Flip it in staging, then in production for an internal tenant, and time it.

Before and after

Weak runbook step: "If the assistant misbehaves, disable it."

Better:

Step 3: Stop agent write access (owner: on-call)
  1. Set flag assistant.tool.write = false  (flag console > prod)
  2. Wait 30 s for cache expiry
  3. Verify: trace search "tool=write" shows 0 calls in the last 2 min
  4. Verify: the UI shows "Read-only mode" banner
  5. Post in #incidents; support sends template 4 to affected tenants
  Target: capability off in under 5 min, no deploy.

What goes wrong

  • Untested switches. A flag that nothing reads, or a job that ignores it.
  • All or nothing. Only a full shutdown exists, so teams hesitate to use it.
  • No user message. People see errors, open tickets and lose trust.

Examples

Read-only mode for an agent

An agent that edits CRM records starts overwriting phone numbers after a prompt change. On-call sets assistant.tool.write to false. Within a minute traces show no write calls, and the agent can still search and summarise. The team rolls back the prompt on the following morning, without a night-time deploy.

The switch that did not switch

A drill finds that the web app respects the kill switch but the nightly email digest, which calls the model from a worker, does not. The fix puts the worker behind the same flag, and the drill is added to the quarterly checklist so the gap does not reappear.

Key points

  • A kill switch changes behaviour at request time through a remote flag, with no deploy or restart.
  • Provide granular switches, such as agent write access, as well as a whole-feature switch.
  • Every path must read the switch: background jobs, retries and every client.
  • Define the off state with a clear user message and, if possible, a non-AI fallback.
  • Test the switch before launch and on a schedule, and time how long it takes to take effect.

Common mistakes

  • Building only a whole-feature switch, so nobody wants to use it.
  • Letting background jobs and mobile clients ignore the switch.
  • Never testing it, then discovering during an incident that it does nothing.
  • Turning the feature off without telling users what happened.

Check yourself · 2 of 3

An agent writes wrong data to a database but its search is fine. What is the best first action?

Choose one answer

Check yourself · 3 of 3

In a drill, the web app obeys the kill switch but a nightly worker still calls the model. What does this show?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic