WhoBuilt

Agents Need Feature Flags

Jul 18, 2026· 19 min· 1.2K views·Watch on YouTube

Speaker

Backend engineer Sachin Gupta of AI Engineer explains how teams can use feature flags to control agent behavior and limit operational risk.

Agents ship without rollout controls

Gupta says teams already use canaries, user segments, and kill switches for web software, but often ship agent changes globally and immediately. He points to prompt rewrites, tool additions, model swaps, and autonomy changes as examples, and describes incidents involving Cursor, Replit, LangChain, and Pocket OS.

Six behavior surfaces need flags

Gupta outlines six surfaces to control independently: prompt variants, tool access, model routing, memory policy, autonomy level, and kill switches. He describes prompt canaries, tool permissions by user or risk class, model fallbacks, memory retention and visibility settings, and autonomy from suggesting to executing. Subagents should inherit the same controls.

Middleware makes controls actionable

In an illustrative Cursor scenario, disabling a tool flag stops the agent from acting on incorrect policy information and lets it offer a safer alternative. In a simulated LangChain runaway loop, a kill switch halts processes at their next decision point; the cost graph flattens about 30 seconds after the problem begins. Gupta places flag resolution in middleware between users and the agent loop, with every subagent routed through it.

Roll out in stages and track results

Gupta's rollout order is to add agent-wide and per-tool kill switches, wrap every tool call, default autonomy to suggest, move prompts into flag-resolved configuration, and monitor results. Suggested metrics include zero kill switch fires per week, mitigation within five minutes for a kill switch, prompt rollback within 30 minutes, canary error increases under 2% at 5% rollout, and complete audit trails.

Avoid flag failures and keep controls maintained

Gupta warns that flags resolved only at session start, subagents bypassing middleware, stale user segments, caching, and silent kill switch activations can undermine controls. He also cautions against untested kill switches, undocumented flag sprawl, temporary flags that linger, and prompt variants tested only in isolation. He says enterprise buyers ask about kill switches, rollout policies, beta isolation, mitigation speed, and flag auditability.

Takeaways

  • Ship an agent-wide kill switch and per-tool switches before adding more autonomy.
  • Resolve controls at each decision point so in-flight work and subagents see flag changes.
  • Give prompts, tools, models, memory, and autonomy separate rollout controls.
  • Track mitigation time, canary error changes, kill switch activations, and audit completeness.
  • Assign every flag an owner and removal date, and test prompt variants in combination.

Mentioned in this talk

Search inside this talk

What was claimed 6

  • feature
    feature flags: Canary releases, segment targeting, and kill switches help control deployments
    “These tools: canaries, segment targeting, and kill switches.”
    YouTube
    Unverified1 source· Talk
  • metric
    LangChain: A four-agent pipeline looped and cost $47,000
    “two of the agents ran in a continuous loop and cost $47,000”
    YouTube
    Unverified1 source· Talk
  • feature
    feature flags: Agents need separate controls for prompt variants, tool access, model routing, memory policy, autonomy level, and kill switches
    “six types, one for each surface—prompt variant, tool access, model routing, memory policy, autonomy level, and the kill switch”
    YouTube
    Unverified1 source· Talk
  • feature
    kill switch: Takes effect in seconds without deployment, restart, or code changes; in-flight requests respect it at the next decision point
    “the change takes effect in seconds, not through a deployment pipeline”
    YouTube
    Unverified1 source· Talk
  • metric
    rollout playbook: Suggested defaults: zero kill switch fires per week; investigate above two; mitigation under five minutes for a kill switch and under 30 minutes for prompt rollback; block promotion if canary error rate rises more than 2% at 5% rollout; audit trail completeness 100%
    “The thresholds I'm about to give you are suggested defaults.”
    YouTube
    Unverified1 source· Talk
  • metric
    rollout playbook: Track kill switch fires per week, time to mitigation, canary error-rate delta, and audit trail completeness
    “Four numbers you should track from day one.”
    YouTube
    Unverified1 source· Talk

Related talks