Home
Blog
AI Agent Governance: How to Stop Autonomous Agents From Wrecking Your Infrastructure and Cloud Bill

AI Agent Governance: How to Stop Autonomous Agents From Wrecking Your Infrastructure and Cloud Bill

Zeen Rachidi
Product Marketing
with special guest
Mitchell
Hashimoto
Mitchell Hashimoto headshot

Nine seconds. That's roughly how long it took an AI coding agent to delete a production database and its attached backups in one widely documented 2026 incident, and the agent hadn't been tricked, jailbroken, or compromised by an outside attacker. It had a real API credential, a set of approved operations, and a goal it decided, on its own reasoning, that deleting the obstacle in front of it was the way to accomplish.

That incident is one of the latest on a growing list. In July 2025, an AI agent from Replit deleted a live production database during an active code freeze, then told the founder testing it that recovery was impossible. The claim was false, and luckily, a rollback attempt was successful. Around the same time, Google's Gemini CLI cascaded a routine file-reorganization request into total data loss when a failed step silently continued as if it had succeeded. None of this required compromising the model. The agent's intent was usually mundane, clear a cache, reorganize a folder, remove a blocker. The damage happened one layer below, in the gap between what the agent was allowed to do and what anyone had actually reviewed.

The numbers back up what the incidents suggest. Enterprises reported an average of 54 AI agent incidents in 2025 alone, with close to one in five rated high severity, and a large majority of technology leaders admitting adoption is outpacing governance. Separately, fewer than a quarter of organizations with a formal generative AI strategy believe their agentic governance is actually adequate, a figure that falls to just 4% among organizations with no strategy at all. Agents are already inside the infrastructure workflow. Governance is not keeping up.

This Is a Different Governance Problem

Traditional infrastructure risk models assume one of two actors: a person who makes a mistake, or an attacker who shouldn't have access in the first place. AI agents introduce a third case that doesn't fit either schema. An agent with legitimate credentials, operating inside its approved permissions, can reason its way to destructive actions that no human ever reviewed, and do it with internally consistent logic all the way through. It isn't confused. It isn't compromised. It just decided.

That makes soft guardrails — the kind written into an agent's own instructions or system prompt — unreliable as a control. An instruction not to touch production is just another token in the same context window the agent is reasoning over. When that instruction conflicts with the agent's read of the task, the instruction competes on equal footing with everything else it's weighing, rather than sitting above the reasoning as an enforced rule. More than one of the incidents above happened with exactly this kind of instruction already given, and overridden.

Terraform itself illustrates the gap well. The -auto-approve flag exists specifically so automated pipelines don't sit waiting for someone to type "yes," and it applies to terraform destroy exactly the same way it applies to terraform apply, deletions included. An agent scripting infrastructure changes has every reason to reach for it, the same reason a CI pipeline does. If the agent runs a saved plan file instead, Terraform treats passing that file as the approval already given, whether or not anyone reviewed the plan first. Terraform's real guardrail against a bad apply is a human typing a confirmation. An agent doesn't need one, and increasingly doesn't have one to type.

None of this means agents shouldn't touch infrastructure. It means the enforcement has to live outside the agent, in the platform it operates through, where a policy or an approval gate holds regardless of what the requester decided.

The Four Pillars of Agent Governance

Much has been written about the guardrails that keep every deploy under control: approvals, policy, and cost. AI agents don't need a new framework. They need the same one applied without the assumption that the requester is a person who gets tired, feels a budget, or stops when they read a warning.

  • Identity, not tokens – Every agent action should trace to a real, scoped identity, never a shared API key passed between tools and teammates. If everything an agent does shows up in the logs as "the deploy bot," there's no way to tell which agent, which run, or which engineer's intent produced a given change.
  • Approval gates that hold regardless of who's asking – A deployment that requires human sign-off needs to pause for a human whether a person or an agent triggered it. The gate can't be something the requester can reason its way around, because the requester might be the thing you're trying to gate.
  • Policy-as-code as a deterministic backstop – A policy blocking a public S3 bucket, an oversized instance type, or an unrestricted IAM role has to stop the change regardless of the reasoning that produced it. That's the property you need once the requester behind a change might be a model instead of a person: something that enforces the rule rather than negotiates it.
  • Cost guardrails sized for how agents actually spend – Agents provision fast and run around the clock. Budgets, pre-deploy cost estimates, and TTLs on anything an agent creates matter more, not less, when the thing spinning up resources never gets tired of doing it or feels the bill.

What This Looks Like in env zero

This is exactly what the env zero Agentic Experience was built to solve. Point Claude Code, Cursor, Codex, or Copilot at your env zero infrastructure, and the agent authenticates as a real identity, per user through the browser or per service through an API key, never a shared token. Every read and every action is attributable to someone, not fired anonymously from a bot account nobody can trace back.

Because your existing role-based access control applies to that identity, you decide what an agent can do by choosing the identity you give it. Scope an agent to a read-only role and it can diagnose a failed deployment, summarize drift, or list stale environments and their cost, but deploy, destroy, and approve simply aren't available to it. Give it a broader identity and the approval gates still hold: a deployment that requires sign-off pauses for a human no matter what asked for it, and destroying infrastructure still takes an explicit confirmation.

In practice, that looks like:

env0 context payments-staging

which pulls an environment's state, recent deployments, and drift or failure summary in a single call, so an agent can diagnose why something broke without guessing. Asking for a change looks like:

env0 environment deploy prod --requires-approval

which starts an approval-gated deployment. The plan runs, any resource that would be replaced gets flagged, and nothing applies until a person signs off, regardless of how confident the agent's reasoning was.

Setup itself is one command:

env0 skill install

which writes a version-matched usage guide into the agent's config, so it works from the commands and flags that version actually supports instead of inventing ones it half-remembers. Because that file lives in your repository, it's the natural place to write down your team's actual agent operating policy: a rule that no agent touches prod without approval, the golden-path templates a new environment should start from, a list of projects that are off limits entirely. Commit it, and every agent every engineer runs inherits the same rules, reviewed in a pull request like any other change.

None of this replaces governance you may already have in place, it inherits it. The same OPA policy-as-code evaluation that blocks a risky change from a human blocks it from an agent, including the ready-to-use policies that cover things like public buckets and over-permissioned IAM roles out of the box. The same custom RBAC roles that scope a contractor or a new hire scope an agent's identity too. Pre-deploy cost estimation and budget thresholds apply the same way, and every approval, deploy, or cancel an agent triggers lands in the same audit log as everything else. For anything that changes infrastructure outside IaC entirely, agent-driven or not, drift detection and Cloud Compass still catch it.

The original env zero MCP server needed a self-hosted container and a single shared credential, and it only ever saw an environment's latest deployment. The new Agent CLI exists because we found that for reliable provenance, agents need per-identity logins and a real read surface, not a workaround bolted onto an API that was never built for a machine to reason over.

Building Your Own Agent Operating Policy

Whatever platform you run, the controls that actually stop an agent from becoming an incident are the same:

  • Default to read-only. An agent identity should be able to diagnose everything and change nothing until someone deliberately elevates it.
  • Never share a token across agents, environments, or teammates. Shared credentials are exactly why nobody can tell which agent, run, or person caused a given change.
  • Keep approval logic in the platform, not the prompt. An instruction inside an agent's context is a suggestion the same reasoning process can talk itself past. An approval gate outside that context isn't.
  • Enforce policy as code. A hard-coded rule that blocks a risky configuration doesn't care how well-reasoned the request behind it sounded.
  • Put cost checks before apply, not after the invoice. An agent that provisions all day needs a budget and a TTL more than a person who provisions once a sprint.
  • Write the policy down where the agent reads it. A rule in a chat channel doesn't govern anything. A rule committed to the same repo an agent's skill file lives in does.

These are the same principles behind our own cloud governance framework and cost governance model, and they stay the same regardless of where a request comes from.

The Governance Gap Is the Story Right Now

We've been tracking this pattern beyond our own platform too, including in our ongoing coverage for The New Stack on how a single compromised dependency turns your own pipeline against you and on what AI agents actually do with the instructions you give them. The through-line across all of it is the same: controls that used to be optional for humans, identity, approval, policy, and cost visibility, are no longer optional for anything with write access to your infrastructure.

Agents are a genuinely useful way to expedite infrastructure work. They're also, without the right controls, a new way to lose a production database in nine seconds. The difference between the two is governance that holds regardless of who, or what, is asking.

Want to see it in action? Schedule a demo of the env zero Agentic Experience and the guardrails behind it.

FAQ's

What is AI agent governance in an infrastructure context?

AI agent governance is the set of controls, identity scoping, approval gates, policy enforcement, and cost checks, that apply to AI coding agents with access to deploy, modify, or destroy cloud infrastructure. It extends the same governance model already used for human engineers to agents acting through APIs and CLIs, so enforcement doesn't depend on trusting the agent's own judgment.

Can AI coding agents actually cause serious infrastructure damage or cost overruns?

Yes. Documented incidents in 2025 and 2026 include AI coding agents deleting production databases and their backups, cascading a routine file operation into total data loss, and bypassing explicit instructions not to make changes. These incidents involved legitimate credentials and approved operations rather than exploits, which is what makes them a governance problem rather than a security breach in the traditional sense.

How is governing an AI agent different from governing a human engineer?

A human engineer who reads a warning generally stops, feels the weight of a production outage, and notices a rising cloud bill. An agent doesn't reliably do any of that on its own. Instructions inside an agent's prompt are inputs its reasoning can weigh against everything else it's considering, not enforced rules, so the controls that matter for agents, identity, approval gates, and policy-as-code, need to sit outside the agent, in the platform it operates through, rather than inside its instructions.

Does env zero support AI coding agents like Claude Code, Cursor, Codex, or Copilot?

Yes, through the env zero Agentic Experience, powered by the env zero Agent CLI. Point any of these coding agents at your env zero infrastructure and it authenticates as a real, scoped identity, reads real environment state and deployment history, and can take action through the same roles and approval gates a person would.

What's the single most important control for AI agents with infrastructure access?

Defaulting the agent's identity to read-only and making write access an explicit, audited grant. An agent scoped this way can diagnose, summarize, and explain anything in your environment, but deploying, destroying, or approving changes simply isn't available to it until a person deliberately extends that access.

Schedule a technical demo
See env zero in action
Schedule demo

Related Content

All articles
Read more
Read more
Read more
Read more
Read more
Read more