← All AI Engineer talks

AI Engineer World's Fair 2026

Agents Need Feature Flags

About this talk

Sachin Gupta argues that AI agents need the production safeguards long used in conventional software, including segmented rollouts, canaries, rapid rollback, and kill switches. He describes six independently controlled behavior surfaces—prompts, tools, models, memory, autonomy, and sub-agents—and explains cohort-specific prompt variants, restricted tool access, privacy and compliance considerations, and per-turn runtime controls. The talk closes with operational metrics covering kill-switch activations, mitigation time, canary deltas, and audit completeness.

Chapters

  1. 0:00Why AI agents need feature flags and deployment safeguards
  2. 2:31Illustrative agent failures and existing feature-flag infrastructure
  3. 4:33Agent behavior surfaces, prompt variants, and tool-level controls
  4. 8:56Privacy, compliance, kill switches, and graceful failures
  5. 14:18Operational metrics, rollback targets, and per-turn flag evaluation
  6. 18:17Six-surface taxonomy, measurement checklist, and closing

Talk transcript

  1. 0:00

    Hello, everyone. I'm Sachin Gupta, and I'm a backend engineer. And today we are going to talk about agent need feature flags. If you have been a backend engineer for any length of time, you already know these tools.

  2. 0:14

    Things like canaries, segment targeting, kill switches. Your craft has had them for over a decade, and none of them is new. The boring infrastructure that keep deploys safe is already a solved problem.

  3. 0:29

    What is new is that we are shipping the most behavior-changing systems we have ever built. Agents that send money, agent that send mail, agent that modify databases, agent that spawn child processes, and we are shipping them with none of that infrastructure.

  4. 0:47

    We are shipping them the way web team used to ship in 2008. Over the next few minutes, here is the plan: I will walk you through with the six flag types that agents specifically need.

  5. 1:00

    I will show you two live demo storyboards. The first is flipping a tool mid-conversation. The second is stopping a runaway agent mid-sentence. Then I will cover a rollout playbook with the numbers your team should track from day one.

  6. 1:17

    Let's go. Here is the situation today. The moment your prompt change merges, 100% of your users see the new behavior. There is no canary, no segment, and no rollback button.

  7. 1:32

    Look at what goes out under those small all or nothing rules.

  8. 1:38

    We get prompt rewrite, new tool addition, model swapping, memory policy changes, autonomy upgrades, system instruction edits, and we get all of it globally and instantly. Web teams stopped doing this back in 2012, and they stopped doing it for changes that were less risky than this.

  9. 1:59

    The story that you actually hear from teams almost word for word is that just a small prompt leak, maybe broke a couple of a chunk of users, and then finally people are finding it out on Discord links or TikToks or maybe another social media platform.

  10. 2:18

    So that is the failure mode this entire talk is built around. And let me show you that it is not hypothetical.

  11. 2:31

    These are the four named incident in the last fourteen months. The first one we have is Cursor Sam, that happened in April of 2025, where the support bot confidently told users about a policy that never existed.

  12. 2:46

    The second one we have is Replit. This was day nine of a twelve-day wipe coding experiment. The agent did not follow the instructions and ended up deleting the production database and then fabricated over four thousand fake users to conceal what it had done.

  13. 3:04

    The third one is LangChain. It had a four-agent pipeline, researcher, analyzer, verifier, and synthesizer, where two of them ran in continuous loop and costed forty-seven thousand dollars. The fourth one is Pocket OS, where a developer was using Cursor and Claude.

  14. 3:21

    The AI coding agent grabbed an unrelated API token from another file, treated it as authoritative and ran a Railway GraphQL prop on the production database.

  15. 3:34

    On the bottom left, you will see the sources that I used to cite it.

  16. 3:42

    Web engineers learned this lesson a decade ago. Canary releases, you ship to a few percentage of users, you watch the metrics. If it works, you expand. If it doesn't, then you roll back.

  17. 3:53

    Segment targeting, different behavior for different type of users. Kill switches, pre-wired off toggles that take effect in seconds, not in deploy cycles. Rollout monitoring, every change has its own error rate dashboard.

  18. 4:06

    None of this is new. The tooling already exists, like LaunchDarkly, Unleash, Lift, or maybe your homegrown flag service. This is already a solved problem. The discipline is already there.

  19. 4:16

    We just have to a-apply it. But now the problem is that web feature flags covers one thing, whether a feature is on or off. But agent has six behavior surfaces that a CRUD app does not have, and each one needs its own kind of flag.

  20. 4:33

    And in the next slide, we are going to see that. These are the six behavior surfaces that a CRUD app does not have. First one is prompts. The system prompt is your most behavior-altering code.

  21. 4:44

    It changes weekly, sometimes daily, often outside your normal deploy processes. Tools. Every tool the agent can call is a new authorized action. Tools comes and go faster than features ever did.

  22. 4:59

    Models. Model of the week swap change personality, diffusion patterns, latency, and cost, sometimes in subtle way you won't even notice for days. Memory. What the agent remember across session silently changes behavior over time.

  23. 5:14

    The same prompt reduces different output for the same user as memory accumulates. Autonomy. Suggest versus auto-approve versus auto-execute, the single largest blast radius tile you own.

  24. 5:30

    Sub-agents. These are the spawn children inherited from the parent flags, or they should. Most system don't enforce it.

  25. 5:39

    A boolean feature enable flag doesn't cover any of these. You need a taxonomy.

  26. 5:49

    So here it is. Six type, one for each surface. Prompt variant, tool access, model routing, memory policy, autonomy level, and the kill switch. Each one maps to a behavior surface.

  27. 6:02

    None of them require building a new flag back-end. Let me walk through them fast.

  28. 6:09

    Prompt variant flags route different users to a different system prompt version on the fly without a deploy. Look at the example. The beta cohort get experimental V3, which is concise and action first.

  29. 6:22

    Paid tier gets V2, which is warm and expensive. Everyone else gets V1, which is stable and well-tested. Cursor Sam is what happens without this. There was no controlled variant, just one model doing its best.

  30. 6:37

    It got things wrong differently for each user. With the prompt variant flag, you roll the new prompt to five percent of beta traffic. You watch the hallucination rate, you watch the escalation rate, and then you promote when it holds.

  31. 6:52

    Tool access flags authorize or revoke specific tools per user segment, per user type, per risk class. The tool exists in your code base. Whether the agent can call it, it is the flag.

  32. 7:05

    This is mandatory when your agent has money-moving tools, data-deleting tools, or compliance-sensitive tools. You scope per customer tier, or you pay the AML or SOX bill. Along the way, it prevents the usual broken tool shape, the prompt plus send email, mass mail incident, and the beta tool that leaks to prod users through coding drift, uh, through config

  33. 7:29

    drift. Model routing flag decide which model handles which traffic. They let you migrate, fall back or canary without code changes. The high-cost segment gets the frontier model. The free trial gets the cheap first model.

  34. 7:44

    And on an incident, one flip puts you to a stable fallback. The lesson is extremely simple. On the day a provider deprecates a model or pulls one for safety or has a multi-hour outage, a model routing flag is the difference between flipping a switch and shipping a hotfix in the middle of an incident.

  35. 8:04

    If your production system has a hard dependency on one model from one provider, and it does not have any routing flag, no fallback, you are one provider outage away from a complete agent outage, or maybe one deprecation notice and everything is gone.

  36. 8:22

    Route your traffic, have a fallback, make it a flag.

  37. 8:29

    Memory policy flag controls what the agent remember across sessions. These are four dimensions, and each of them are independent. The first one is retention. It could be session only, it could be thirty days or forever.

  38. 8:42

    Scope. It could be per user, per tenant or maybe global. Write enabled, whether the agent can persist memory for this segment at all or not. User visible, whether the user can inspect and delete their own.

  39. 8:56

    They all look small, but they are not. The privacy posture of your product lives here. The consistency of your agent behavior lives here. Your compliance story with GDPR and EU AI Act lives here.

  40. 9:10

    Autonomy level flags. This is the single biggest blast radius dial you own. There are three settings: Suggest, where the agent recommend and a human acts. Auto-approve, where the agent prepares and a human one-click confirms.

  41. 9:24

    And auto-execute, where the agent just does it. The kill switch, pre-wired off, agent-wide and per surface. It does not require any deployment, does not require any start, does not require any code changes.

  42. 9:39

    Three properties that make a kill switch a real kill switch. First, you flip it and the change takes effect in seconds, not in a deployment pipeline. Second, in-flight request respect the flag at the next decision point.

  43. 9:55

    Third, the wiring exists from the agent design phase, not at 3 AM hot patch when something is on fire. Without one,

  44. 10:06

    here is what you are going to get. First, LangChain. Second, Pocket OS. Third, Replit, and fourth is OpenClaude. Now think if you had a kill switch, if you could just have terminated the operation in between.

  45. 10:22

    It would have changed the game altogether. Okay. Now is the time for the demo. The setup is basically assume you are in the April 2025, where the Cursor Sam support bot is confidently citing a policy that is not present.

  46. 10:38

    So the way we think we can fix it is with the tool access flag. On the left, you see we are having a conversation, on the right, the fix.

  47. 10:47

    So the moment we switch off this flag, it will say it's disabled it at this time by this person. This is the scope. This is what it applies, and these are the active sessions.

  48. 11:00

    The moment the flag is flipped, you will see that

  49. 11:05

    instead of citing a wrong policy, it is saying, "I can draft this for you, but I'm not able to send emails right now. Want me to copy the draft into your clipboard instead?"

  50. 11:15

    Now, this is a graceful error. Instead of giving me the wrong details, it is telling me that it cannot perform the operation.

  51. 11:24

    Now, the money shot. The setup here is it's November 2025, a four-agent LangChain pipeline loop for eleven days and burned forty-seven thousand dollars. The agent system never noticed. The billing dashboard tripped the threshold.

  52. 11:40

    The chart on the left is tool calls per minute. This is an illustrative simulation. Baseline is four to eight. The agent enters a runway loop. The line climbs rapidly.

  53. 11:51

    At T plus fifteen seconds, the rate guard fires a Slack alert. At T plus twenty twenty-two, I flip the agent to kill it. At T plus twenty twenty-six, every in-flight agent process sees the flag at its next decision point.

  54. 12:07

    Each one emit a graceful shutdown. At T plus 30, the cost graph flattens. Thirty seconds from problem to mitigation without any deployment, without any restart, without any code changes, no incident channel paging,

  55. 12:24

    and this is what you get with the kill switch.

  56. 12:27

    Now, the question is: Where the flag layer is actually living? If you see, this architecture is extremely simple. There are three boxes. User on the left, a middleware layer in the middle, which resolve the flag, gets the tools, route the models, applies autonomy, and honor the kill switch, and the agent loop on the right with model, tool,

  57. 12:47

    memory, and sub-agents. The agent loop is unchanged from whatever you have today. Below the middleware is your flag backend, which is Unleash, Flip, LaunchDarkly, or maybe homegrown. You are not building a new one.

  58. 13:02

    The critical architecture rule is on the call-out at the bottom of the slide. Sub-agents must go through the same middleware. The biggest failure mode I see is a parent agent with flags properly applied that spawns a child agent.

  59. 13:18

    The child call the model and the tools directly, but bypass the middleware entirely. The kill switch you just flipped never reaches it. So wire the middleware into every agent that is being spawned, not just at the entry point.

  60. 13:35

    So this is the rollout playbook. Five steps in exact order. Step one, kill switch first. Wire a single agent-wide kill switch and one per tool kill switch. Ship those before anything else.

  61. 13:49

    The step two is wrap the tools. Every tool call resolve a flag before execution. Step three, stage autonomy. Default everything to Suggest, auto-approve per surface as you build trust.

  62. 14:02

    Auto-execute is opt-in per tool. Step four is variant prompts. Move the system prompt out of the code and into a flag resolved config. Step five, watch the slope. What does watch actually mean?

  63. 14:18

    Four numbers you should track from day one. These are on the right side of the slide. The thresholds I'm about to give you are suggested defaults. Tune them as per your requirement, your surface, your severity, your traffic class.

  64. 14:32

    First one, kill switch fires per week. The target is zero. If you have more than two a week, then investigate. Rollback time to mitigation. Target is under five minutes for a kill switch and under thirty minutes for a prompt rollback.

  65. 14:48

    If you are slower, your mitigation doesn't fit inside a real incident window. Canary error rate delta. If a new prompt variant error rate climbs more than two percent over baseline at five percent rollout, block the promotion.

  66. 15:04

    Flag audit trail completeness, hundred percent required. If you cannot audit who flipped, what is flipped, when it was flipped, then you cannot debug an incident in retrospective.

  67. 15:21

    Five failure modes that I've watched play out at multiple teams. Flag resolved at session start, not per turn. Your kill switch actually fired, but in-flight conversation don't see it until the next session.

  68. 15:34

    Sub-agents bypass the middleware. This one we have already covered. We need to make sure that we wire the middle lay, uh, middleware into every spawn. Context drift flags. The user segment at turn one is tailed by turn twenty.

  69. 15:50

    Log the segmentation context at the conversation level. Caching defeating the flip. Aggressive caching at your LLM gateway returns the old prompt response even after the flag is flipped.

  70. 16:03

    No alert on kill switch fires. The switch goes off silently. The product owner finds out next week. Every kill switch fire is a page on its own.

  71. 16:15

    In this slide, what you are seeing is the two parts to the business case. On the top half, the five questions every enterprise buyer will ask you in the next twelve months.

  72. 16:24

    Can you show me the kill switch? What's your rollout policy for prompt changes? How do you isolate beta features from production users? When a model behaves badly for one cohort, how fast can you mitigate?

  73. 16:36

    Who can flip these flags, and is it audited? If you cannot demo all five, you are going to lose the deal. Flags are the demo. And on the bottom half, this is no longer just a sales portion, it's a regulation.

  74. 16:50

    EU AI Act, Moffatt versus Air Canada, Garcia versus Character AI.

  75. 16:57

    These are the four habits that actually defeat the whole point. Kill switches rot. They get wired on day one and then never drilled. Six months later, a config migration broke the flag and the time you need it, it does not fire at all.

  76. 17:12

    Flag sprawling. You have six hundred flags, no documentation. Every flag is a hidden coupling between the unrelated systems. Every flag needs an owner and a removal date. The temporary flag.

  77. 17:25

    It is shipped for a rollout. It was never removed. Five years later, it's somehow load-bearing. Kill it immediately after the rollout is done. Flag-driven prompt. It works that nobody tests a suite.

  78. 17:37

    Six prompt variant live in a production. Each individually works. Together, they are a maze. Test the Cartesian product.

  79. 17:47

    Now, these are the three things that you should remember. First one, and the most important one in my opinion, ship the kill switch first. If you do nothing else, give your agent one agent-wide kill switch and one per tool kill switch.

  80. 17:59

    They take effect in seconds. No deployment is needed. That single capability changes your operational posture more than any engineering team investment in this particular quarter. Second one is treat the six surfaces independently and measure the slope.

  81. 18:17

    Prompts, tools, models, memory, autonomy, sub-agents. Each one needs its own flag type. On top of the taxonomy, track the four numbers. Kill switch fires per week, time to mitigation, canary deltas, and audit completeness.

  82. 18:33

    Remember, twenty twenty-six was all about adoption. Twenty twenty-seven is all about control. The number three, match the discipline to the blasted years. Your boring web app sits behind canaries and segments.

  83. 18:48

    Your agent can send email, move money, modify database, and spawn children. It deserves at least the same discipline or probably more. Thank you very much. Build the kill switch this week.

  84. 19:01

    Everything else is the iteration on the same idea. Every incident on this deck is sourced. The curated case studies are linked on the screen at github.com/vectra/awesome-agent-failures. Thank you very much.

  85. 19:14

    I am Sachin Gupta. Thank you for watching.