SaaS technology
Businesses SaaS July 13, 2026 • 7 min read

AI Feature Flags Cheatsheet: What to Gate, Rollback, and Monitor

For: A product engineer at a 30–150 person B2B SaaS company who just shipped an AI feature to 100% of users, got a wave of support tickets about wrong or weird outputs, and now needs to roll it back — but realizes their feature flag setup was designed for UI changes, not probabilistic model behavior, so they have no clean way to segment affected users, pin a model version, or define what 'bad output' even means as a rollback trigger

Standard feature flags gate who sees a feature. AI features need a second layer that gates how the model behaves — version, prompt template, embedding schema, retrieval index, and output quality thresholds. If your rollback story is a single boolean, you can only ship 100% on or 100% off. This cheatsheet covers the flags to add, the rollback triggers to define, and the signals to monitor.

The two-layer flag model

Every AI feature should sit behind two independent flag layers. If you only have one, the same code path can produce wildly different outputs the moment a model or prompt changes underneath you.

LayerGatesExampleRollback speed
EligibilityWhich users/tenants/plans see the featureai_summary_enabled for tenant XInstant
BehaviorWhich model, prompt, retriever, and guardrail version runssummary_model=claude-3.5-sonnet-v2, prompt=v7Instant, but requires warm fallback

The behavior layer is what lets you roll back a bad prompt without turning the feature off entirely.

What to gate

Always gate these

Gate per-tenant when

Don't bother gating

Rollout patterns for AI features

PatternWhen to useWhat it catchesBad at
Shadow modeNew model or major prompt changeRegression vs. baseline, latency, costUser-perceived quality (no user sees output)
Canary (1% → 5% → 25%)Any behavior-layer changeError rate, thumbs-down rate, refusal spikesRare-but-severe failures on long tail
Champion/challengerComparing two prompts or modelsRelative quality on live trafficRequires eval harness or user feedback signal
Per-tenant opt-inHigh-risk verticals or enterprise contractsTenant-specific failure modesSlow to reach statistical significance
Kill-switch onlyLow-stakes internal toolsCatastrophic failureEverything else

The mistake most teams make: jumping straight from staging to a 100% eligibility rollout with no canary on the behavior layer. Ship the feature to 100% of eligible users, then ramp the new model version from 1% → 100% behind a second flag.

Rollback triggers — what counts as "bad"

You cannot roll back on "users complained." Define numeric triggers before shipping. Each trigger needs a threshold, a window, and an action.

SignalThreshold exampleAction
Thumbs-down rate>2x baseline over 30 min, min 50 samplesAuto-revert behavior flag
Refusal / "I can't help" rate>5% of requestsPage on-call
Output validator failure rate>1% (JSON schema, length bounds, banned phrases)Auto-revert
p95 latency>2x baseline for 10 minRevert to faster model variant
Cost per request>1.5x baselineAlert, investigate token bloat
Support ticket rate tagged AI>3x 7-day rolling avgManual review, likely revert
Hallucination rate (eval sample)>baseline + 3σ on golden setBlock promotion beyond canary

Tradeoff: automatic rollback on thumbs-down feels safe but is easy to trigger with a single angry power user. Require a minimum sample size and a comparison against a rolling baseline, not an absolute number.

What to monitor per rollout stage

Pre-launch (shadow)

Canary (1–25%)

Full rollout

Minimum flag schema

{
  "feature": "ai_summary",
  "eligibility": { "tenants": ["..."], "plans": ["pro","enterprise"] },
  "behavior": {
    "model": "claude-3-5-sonnet-20241022",
    "prompt_version": "summary_v7",
    "temperature": 0.2,
    "max_tokens": 800,
    "retriever": { "index": "docs_v3", "embed_model": "text-embedding-3-large", "top_k": 6 },
    "guardrails": ["pii_redact_v2","json_validator_v1"]
  },
  "rollout": { "stage": "canary", "percent": 5, "fallback": "summary_v6" },
  "triggers": { "thumbs_down_ratio": 0.15, "validator_fail_pct": 1.0 }
}

Two details that matter: an explicit fallback configuration (not just "off"), and the trigger thresholds shipped with the flag itself so ops teams don't have to hunt through dashboards.

Common mistakes

Teams building on top of LLM APIs — especially in regulated verticals like healthcare or lending — usually end up building this two-layer setup after their first production incident. Building it before the incident is cheaper. More on how we approach production AI systems on the AI Studio page.

Frequently Asked Questions

Can I use LaunchDarkly or Unleash for AI feature flags?

Yes for the eligibility layer — they're excellent at that. For the behavior layer (model version, prompt version, retriever config), you'll want either multivariate flags carrying JSON payloads or a separate config service keyed by flag variant. The out-of-the-box boolean model isn't enough on its own.

What's the difference between a canary release for ML and a normal canary?

A normal canary looks at error rates and latency. An ML canary also needs output-quality signals — thumbs-down ratio, validator failure rate, refusal rate, and comparison to a golden eval set — because the code path can be healthy while the outputs are wrong. You also segment by input type, not just user cohort, because failures cluster around specific input shapes.

How do I roll back an AI feature without turning it off completely?

Keep the previous behavior config (model + prompt + retriever versions) warm and callable, and make your flag variant point to it as a fallback. Rollback then becomes a variant switch, not a feature disable. This is why the behavior layer must be independent from the eligibility layer.

What should trigger an automatic rollback vs. a human review?

Automate on hard signals with clear baselines: validator failures, schema violations, latency breaches, and refusal-rate spikes above a minimum sample size. Route soft signals — thumbs-downs, support tickets, subjective quality drops — to human review. Auto-rollback on subjective signals produces too many false positives.

How large should a golden eval set be?

Start with 200–500 curated examples covering your top intents, edge cases, and known past failures. Grow it every time an incident produces a new failure mode — regressions caught by a golden set are cheaper than regressions caught in production. Rerun it on every behavior-layer change before promoting beyond canary.

Found this useful? CodeNicely publishes engineering and product playbooks weekly. Browse the archive or tell us what you're building.