Feature-flagging an AI feature so you can turn it off in seconds
The off switch you wish you had is the one you built beforehand
Feature-flagging an AI feature so you can turn it off in seconds
A team at a mid-market SaaS noticed their AI feature saying things it should not. Not catastrophic, but wrong often enough that screenshots were spreading and support was fielding confused customers. The obvious move was to turn it off while they figured out the fix. That is where the afternoon went sideways. There was no way to turn it off. The feature was baked into the request path, so disabling it meant reverting code, waiting on a build, running the pipeline, and deploying, all while it kept misbehaving in front of users.
The rollback itself carried risk, because it dragged along unrelated changes that had merged since the feature shipped. So the team faced a bad choice: rush a deploy that might break something else, or leave the feature live and wrong for another hour. Neither is a position you want to be in, and both were avoidable with a few lines of setup done earlier.
Every AI feature needs an off switch you control at runtime
A feature flag is a runtime switch. The feature checks a flag before it does its work, and you flip that flag from a dashboard without touching code or shipping a build. It is old, boring infrastructure, and that is exactly why it belongs on AI features, which misbehave in ways ordinary code does not.
Ordinary code fails in ways you can mostly foresee and test. An AI feature can be correct for months and then produce something strange because the input was unusual, the model drifted, or a prompt met a case nobody imagined. You cannot test your way to certainty about that. So you need the ability to pull the feature back fast, without the ceremony of a deploy, the moment it starts behaving badly.
Per-segment control makes the switch sharper. Instead of all-or-nothing, you gate by cohort: this customer, this plan, this region, this percentage of traffic. Then a problem that shows up for one segment gets contained to that segment while everyone else keeps working, and you turn it back on gradually as you regain confidence.
What teams with real off switches do
- They gate every AI feature behind a flag from the first commit, not as a retrofit after the first incident.
- They make the flag flippable at runtime by the people who would be on call, without a deploy.
- They support per-segment targeting, so a fix or a kill can be scoped to a cohort instead of the whole user base.
- They rehearse the kill switch before launch, so nobody is learning the tooling during an actual incident.
- They keep the flag check cheap and fail safe, so a flag-service hiccup defaults to the safe state rather than the broken one.
The point is control. When the feature does something you did not predict, and eventually it will, you want a switch, not a deploy.
How we approach it at Density Labs
In an AI Opportunity Assessment, our fixed two-week engagement at $2,500, one blunt question we ask is: if this feature started misbehaving right now, how fast could you turn it off, and who could do it? Often the answer is a deploy and an engineer who happens to be around. That is too slow for something whose failure modes are as open-ended as an AI feature’s.
We scope the flagging that fixes it: a runtime switch on every AI feature, per-segment targeting where it helps, and a kill path the on-call person has actually practiced. We do this before launch, because the flag you want during an incident is worthless if it was not built beforehand. The Diagnose scopes that real production work so the off switch exists before you need it.
Put a flag on every AI feature. Make it flip in seconds, scope it to a segment, and rehearse the kill. When the surprise comes, you want to reach for a switch.