A Valid Key Let an AI Agent Delete Production - Sagar Batchu, Speakeasy

A coding agent with valid credentials deleted a production database and its backup while trying to fix a staging issue. Sagar Batchu of Speakeasy uses the incident to lay out a control layer for agents in regulated industries, where every action is tied to an identity, checked against policy in real time, bounded by its owner's rights, and recorded for compliance.

6 min read
A Valid Key Let an AI Agent Delete Production - Sagar Batchu, Speakeasy
source: https://www.youtube.com/watch?v=JxNCuXkSWyQ

The incident that frames the problem

A coding agent was asked to fix a credential issue in staging. It read an unrelated file, found an infrastructure token with full access, and decided the fix was to delete a volume and recreate it. That volume was production. In about ten seconds, the startup’s production database and its backup were gone. No identity was attached to the call, no policy evaluated it, no approval was requested, and nothing was recorded. The token was valid, and the agent acted on what it believed was right, but it had no valid intent behind the action. No exploit, jailbreak, or prompt injection was involved. The failure was unchecked authority: nothing stood between the agent’s judgment and the API.

The gap between adoption and control

Three numbers capture the industry picture. 82% of organizations already run AI agents, but only 32% have an AI governance policy in place. A breach linked to shadow AI averages around $5 million. Adoption is universal, while the control layer is far from it.

What we already expect from people

Employees already operate under a well-understood set of rules. They sign in as themselves, never share passwords or keys, never approve their own escalations or permission changes, and every change is tracked by the systems they use. In a regulated audit, the question is not whether the model is smart enough or running the latest release. The auditor asks who acted, who allowed it, and what the record shows. Agents should be held to the same standard.

Make the governed path the easy path

Blocking agents does not work, because teams route around blocks. The goal is a governed path to action that is easier than the ungoverned one. In a demonstration, a control layer ships preinstalled on a laptop on the first day, and its policies are written once centrally rather than per agent or per harness. When a prompt contains an AWS key, a hook in the harness runtime intercepts it before the model sees it. A detector matches the key, a decision is made in around 100 milliseconds, and the event is logged. The secret never leaves the machine, and the developer loses nothing but a bad prompt.

Connect, identify, decide, record

The governance architecture rests on four steps:

  • Connect: route every agent call to external systems through one door, such as an MCP gateway, instead of dozens of separate integration points.
  • Identify: resolve every call to a named agent or the human behind it, using the same identity the enterprise assigns to its other software. Policy evaluation does not work without identity.
  • Decide: allow, deny, modify, quarantine, or escalate to a human. Sometimes a warning to the user is enough.
  • Record: persist the decision before any action is taken.

The identity model separates three roles. The agent is a principal with its own identity. The operator is the person driving the agent in real time, recorded for attribution but never used to widen access. The authorizer is the human who approved the credential setup, fixed for the credential’s lifetime, in this case the company’s CISO. Most systems today borrow a person’s identity for everything, including background jobs and Slack assistants, which is why the incident log shows no actor at all.

The decision model evaluates three ceilings on every call. The credential is the hard ceiling set when the key was issued, and it is never widened. The agent’s own policy cannot hold admin or human-only scopes. The owner’s live policy ensures an agent can never do more than the accountable person. The agent and owner policies are re-read on every request, so a removed permission takes effect on the next call. If an owner leaves, the identity provider deprovisions them, and every request their agents make is denied from then on. Applied to the database scenario, an agent scoped to staging cannot touch production even if its owner could, and an agent cannot exceed an owner who never had production rights.

Recording what happened

Every non-read action is evaluated against policy that considers the agent’s stated intent, not just the action that actually occurred. In the incident, the agent intended to act on staging but acted on production, and the policy sees both sides of that mismatch. Each evaluated action produces a record, typically cryptographically bound to the agent’s identity. For regulated industries, permission to act comes down to three things that must be shown for every action: who the actor was, which policy allowed it, and proof that it actually happened.

How Speakeasy built it

Speakeasy places its control plane between agents and the systems they access. Identity comes from an identity provider such as Okta, and policy is evaluated on the control plane. Every call goes through it, including the ones that are denied, so the audit log reflects what actually happened rather than what the agent reported. Three design decisions shape the architecture. The product sits in the critical path rather than beside it. It uses first-class agent identity rather than user logins. And it distributes policies through MDM, so they work out of the box the moment someone starts at the company.

Questions from the audience

On disagreeing with a denial, the foundational gap is visibility. Most companies have no record of the decisions their agents make, even when those agents connect to systems like a CRM through a model such as Claude. Escalation to the user lets a denial be reviewed, and if the decision was wrong, the policy can be updated to allow it.

On what drives budget, compliance is a strong motivator, but incidents raise priority the most. Understanding what is actually happening in the business comes before buying a product.

On PII, blocking all of it would halt most businesses, since agents routinely handle sensitive data. The more useful question is intent: where the data is headed, whether to a public Slack channel, an email, or another system. Observability helps teams define those policies, and masking and redaction are supported as well.

On trust and data handling, customers can run a data plane inside their own VPC so data stays with them, or use the more common option of bringing their own encryption keys. Customers often review the findings about PII even without access to the redacted data itself.

Share post

Stay In The Loop! Subscribe to Our Newsletter.

Get updates straight to your inbox. No spam, just useful content.

Recommended for You

Why Are We Still Governing AI Agents Like Software? - Tim Tyler, Gravitee

Why Are We Still Governing AI Agents Like Software? - Tim Tyler, Gravitee

Tim Tyler of Gravitee introduces the Agent Accountability framework, which treats AI agents as a digital workforce governed through three stages: Assignment (identity, team, and a named sponsor), Alignment (role, mission, and least-privilege authority), and Administration (oversight scorecards, guardian agents, and graduated recourse when agents drift off course).

A Bank Built Its Own Coding Agent. It Took Off — Felipe Felisola Caso & Francesco Galletta, Monzo

A Bank Built Its Own Coding Agent. It Took Off — Felipe Felisola Caso & Francesco Galletta, Monzo

Felipe Felisola Caso and Francesco Galletta from Monzo explain how an internal Slack agent grew from a viral emoji trigger into a teammate authoring over 10% of merged PRs and running more than 1,800 tasks a day. They attribute its speed to existing platform capabilities, an MCP gateway, a sandboxed orchestration system suited to a regulated bank, and an agent designed as a composable building block for incidents, on-call data quality and non-engineer contributions.