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?
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
- 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.
- 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.
- Cover every path. Background jobs, queued tasks, retries and other clients such as the mobile app must read the same switch.
- 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.
- Write the runbook. Who may flip it, where, what it does, how to verify it worked, and who tells users.
- 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?
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?
Practice items, not counted towards your mastery.
Start here
- Feature Toggles (martinfowler.com) (opens in a new tab)ArticleFree
Release, ops and permission toggles, and why stale toggles must be removed.
- Canarying releases (Google SRE Workbook) (opens in a new tab)BookFree
How to size, time and judge a canary against a control population.
- OpenFeature (opens in a new tab)ToolFree
A vendor-neutral flag API, so evaluation code does not depend on one flag provider.
More for this topic
- Applied LLMs: What we learned from a year of building with LLMs (opens in a new tab)ArticleFree
Practitioner lessons on evals, guardrails and shipping LLM products.