CLAUDE LABJP
MODEL — Claude Sonnet 5 is the default across all plans and Claude Code at $2/$10 per million tokens through August 31FABLE — Access to Claude Fable 5 and Mythos 5 is being restored from July 1 after US export controls were liftedSCIENCE — Claude Science, an AI workbench for researchers, is in beta for Pro, Max, Team, and EnterpriseGATEWAY — The Claude apps gateway for Amazon Bedrock and Google Cloud adds SSO, policy, role-based access, and per-user cost attributionENTERPRISE — Claude Enterprise adds richer admin analytics, model-level entitlements, and spend alertsCODE — Claude Sonnet 5 is now the default model in Claude Code with a native 1M-token context windowMODEL — Claude Sonnet 5 is the default across all plans and Claude Code at $2/$10 per million tokens through August 31FABLE — Access to Claude Fable 5 and Mythos 5 is being restored from July 1 after US export controls were liftedSCIENCE — Claude Science, an AI workbench for researchers, is in beta for Pro, Max, Team, and EnterpriseGATEWAY — The Claude apps gateway for Amazon Bedrock and Google Cloud adds SSO, policy, role-based access, and per-user cost attributionENTERPRISE — Claude Enterprise adds richer admin analytics, model-level entitlements, and spend alertsCODE — Claude Sonnet 5 is now the default model in Claude Code with a native 1M-token context window
Articles/API & SDK
API & SDK/2026-07-08Advanced

Rolling Out Agent Behavior Changes Gradually with Feature Flags

When an unattended agent changes its prompt or behavior all at once, quiet regressions hide until morning. Here is a design for assigning new behavior to only a fraction of runs, keeping a control group, and adding deterministic bucketing, canary comparison, and automatic rollback.

Claude Agent SDK13feature flagunattended ops2canary releasedesign3

Premium Article

I once rewrote the prompts for all four of my sites on the same night.

The intent was good. Align the phrasing of the intros, make the tone one notch warmer. I tried it on two or three drafts by hand, and the results did read better. So I pushed it into every site's generation job and went to sleep.

The next morning, all four logs wore the same expression: failed. One of the quality gates was catching a subtle structural break that the new phrasing produced. The problem never surfaced in the handful I tested by hand, but against real overnight data it reproduced cleanly. And because I had changed every site at once, there was no control group left anywhere. I had erased, with my own hands, the very thing I needed to answer the question "is the new wording actually the cause?"

The more autonomous the thing is, the less you should ship a change to all of it at once. This article is that lesson, turned into a design.

Why "apply everywhere" is especially dangerous for unattended runs

With an interactive tool, if the output looks wrong a human notices on the spot and stops. An unattended agent has no such eyes. A job that runs at two in the morning degrades with nobody watching until the log is opened the next day.

And failure does not always show up as an error. No exception is thrown, generation completes, and yet the density of the article has quietly dropped. That kind of silent regression flows straight to production the moment it slips past a mechanical gate.

As an indie developer I run four technical sites and a handful of apps that earn through AdMob. Each has unattended jobs firing at night, so this “degradation during the hours nobody is watching” is ground I have stepped on many times myself.

That is why, instead of applying a change to every run immediately, you want a design where only a fraction receives the new behavior while the rest is preserved as a control group. Think of it as applying a software canary release, but to behavior — a prompt, an agent's way of acting — rather than to code.

The smallest flag definition

First, consolidate every behavior branch into a single config file. Scatter if (newBehavior) through the code and nobody can tell what is running at what percentage. Keep one source of truth.

FieldTypeRole
keystringIdentifier for the branch, referenced from code
enabledbooleanMaster switch for whether this branch is evaluated at all
rollout0–100Fraction of runs that receive the new behavior
killedbooleanEmergency stop: if true, pin to old behavior regardless of rollout
scopestring[]Axis to narrow the target (e.g. site name). Empty means everything
ownerstringWho added it — a handle for later cleanup
createdAtISO dateWhen it was added, used for lifecycle management
// flags.json — the source of truth for behavior branches
{
  "gentler-intro-phrasing": {
    "enabled": true,
    "rollout": 25,
    "killed": false,
    "scope": ["claudelab"],
    "owner": "masaki",
    "createdAt": "2026-07-08"
  }
}

rollout: 25 together with scope: ["claudelab"] means "try the new phrasing on one site first, and even there, on only a quarter of the runs." That is the decisive difference from the version of me who changed all four sites in a single night.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Deterministic bucketing: hashing the run key so the same job always lands in the same group, which is what makes the comparison trustworthy
Canary comparison and auto-rollback: comparing gate pass rates between control and canary, then closing the flag on the next run if it regresses
Flag lifecycle: retiring a branch once it is proven, so the codebase does not accumulate dead paths nobody can reason about
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-07-05
Don't Let the Opus 4.7 Fast Mode Retirement (July 24) Kill Your Unattended Jobs
claude-opus-4-7 fast mode retires on 2026-07-24, and speed: fast starts throwing errors. Here's how to keep unattended pipelines from breaking silently: mechanically detect where fast mode is used, add a fail-closed runtime guard, and migrate to 4.8 with working code.
API & SDK2026-06-28
Every Tool Call Succeeds, Yet Nothing Moves Forward: Detecting Stagnation in Unattended Agents
No errors, yet the agent keeps replaying the same move while your budget quietly drains. Here is how to detect a success-but-no-progress loop using a progress oracle and action fingerprints, with a working Python implementation that halts safely.
API & SDK2026-06-25
When the Previous Run Hasn't Finished and the Next One Starts: Leases and Fencing Tokens for Scheduled Agents
A scheduled agent that runs on a fixed clock can overtake itself and start twice. From the moment a naive lock breaks to leases, fencing tokens, and bounded catch-up — worked through with the implementation I actually run.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →