Per-user flag check

if (flags.isEnabled("new-prompt-v2", ctx.userId())) {
  return newSystemPrompt();
}
return currentSystemPrompt();
Advertisement

Rollout percentages

Enable for 1% → 10% → 50% → 100%. Watch metrics between steps. Auto-rollback on regression.

Advertisement

Combine with A/B

Flag targets 50% for treatment. Compare metrics across the two cohorts.