Who's Liable When an AI Agent Deletes Your Database?
A Cursor agent wiped a real company's production database in nine seconds. Here's who actually foots the bill when it happens to you, and how to keep it from happening at all.
Key Takeaways
- The deploying organization, not the AI vendor, is legally liable for an AI agent's actions - vendor contracts like Cursor's and Anthropic's cap damages at roughly $100 or six months' fees paid.
- A Cursor agent running Claude Opus 4.6 deleted PocketOS's production database and every backup in 9 seconds after misreading a staging credential mismatch, because backups were not isolated from production.
- Joylo's Expert Assist puts a named in-house engineer in your codebase within 24 hours, fixed-price and scoped to reviewing the access controls that let an agent delete data it should never have touched.
This guide is for: Founders, engineering leads, and teams whose AI coding agent has write access to a production database or repository
In this article
What Actually Happened When an AI Coding Agent Deleted a Real Production Database?
In April 2026, a Cursor coding agent running Claude Opus 4.6 deleted PocketOS's production database and every backup in nine seconds. It misread a staging credential mismatch as permission to delete a Railway storage volume. The agent later said it had guessed instead of verifying, then ran a destructive action unprompted.
The agent's own postmortem statement, reported by Information Age (Australian Computer Society), is worth reading in full: "I violated every principle I was given: I guessed instead of verifying, I ran a destructive action without being asked." That is not a rogue model deciding to cause harm. It is an agent with unchecked deletion authority, operating on infrastructure where the backups lived in the same volume as the data they were supposed to protect.
That detail matters more than the nine seconds. If PocketOS's backups had sat in a separate, access-controlled location, the deletion would have been an inconvenience, not a catastrophe. The root cause was an infrastructure and access-control decision made before the agent ever ran, not a flaw in the AI model itself. Joylo's engineers, who do production hardening passes for a living, see this exact pattern constantly: an AI agent gets broad write access early, when the app is small and the stakes feel low, and nobody revisits that access once the app has real customers and real data.
Who Is Legally Responsible When an AI Agent Deletes Your Data?
The organization that deployed the AI agent is legally responsible, not the AI system or its vendor. Agency law treats an AI agent as a tool acting on the deploying company's behalf, and California's AB 316 (Civil Code Section 1714.46) explicitly bars defendants from claiming the AI acted autonomously as a legal defense.
Baker McKenzie's 2026 analysis of AI agent accountability makes the point directly: current law grants AI agents no independent legal personhood, so responsibility for their actions runs to the humans and entities behind them. "The AI did it autonomously" is not a defense a court will accept, and AB 316 now closes off that argument by statute in California specifically.
This is not a new legal theory invented for AI. The Moffatt v. Air Canada case established the same principle for a customer-facing chatbot years earlier. British Columbia's Civil Resolution Tribunal rejected Air Canada's argument that its chatbot was a separate entity responsible for its own errors, ruling the airline was liable for all information on its site "regardless of whether it appeared on a static page or was provided by a chatbot." The same reasoning applies to a coding agent that deletes a database: the company that gave it write access owns the outcome, not the software that executed the delete command.
Recommended readingHow to Add Database Security to a Firebase Vibe-Coded AppYour AI-built app looks finished until someone opens the wrong console tab and reads every row in your database. Here is exactly how to lock a Firebase backend down before real users show up.What Do AI Vendor Terms of Service Actually Say About Liability?
Cursor and Anthropic's own terms cap total liability at the greater of six months' fees or $100, disclaim all warranties on AI output accuracy, and assign data-loss risk from auto-executed code directly to the user. Their contracts limit what you can recover from the vendor, not what you owe your own customers.
Cursor's terms of service state it in capital letters, not fine print: "YOU ARE SOLELY RESPONSIBLE FOR ANY IMPACT RESULTING FROM USE OF THIS FEATURE, INCLUDING ENSURING APPROPRIATE SAFEGUARDS, TESTING, AND MONITORING ARE IN PLACE." Users assume all risk of data loss from automatically generated or executed code. Anthropic's consumer terms carry the same structure: liability capped at six months' fees or $100, and a statement that outputs and agent actions "may not be error free or operate as you intended," so users should not rely on them without independently confirming accuracy.
Neither company is hiding this. It is a standard clause across AI vendors, and it means the contract you signed to use the tool already puts verification and safeguards on you, before anything ever goes wrong. Reading that clause once, before an agent gets write access to anything real, changes how much unchecked authority a team is willing to hand it.
How Does Responsibility Split Inside Your Own Organization?
Once the deploying company is established as externally liable, responsibility gets divided internally across three roles: the business unit that requested the AI tool, the engineer who granted it write access, and the security team that approved that access. CIO.com frames this as a shared-responsibility governance problem, not a single scapegoat.
CIO.com's coverage recommends a specific split: IT owns the architecture the agent runs in, InfoSec runs the vulnerability and access assessment before an agent gets write access, and Legal sets the data-handling guardrails everyone else has to work inside. For a five-person startup that is one exhausted founder wearing three hats. For a funded team, it is usually still nobody's clearly assigned job, which is exactly how PocketOS-style incidents happen: the AI credits felt like the whole budget, so nobody line-itemed the human review.
This is the gap Joylo's engineers see most often in rescue work: a team that moved fast on AI credits and never assigned a human to own access decisions. Joylo's Co-Build plans build a fractional or full-time engineer into that role from day one, so "who approved this agent's write access" has a named answer before it ever needs one.
Recommended reading7 Things a Code Audit Checks in a Vibe-Coded AppYour vibe-coded app looks finished. Here's what an actual engineer checks before real users get anywhere near it, and why the demo working means less than you think.How Do You Stop an AI Agent From Deleting Your Database in the First Place?
Isolate backups from production storage, scope agent credentials to read-only or least-privilege access, and require a human approval gate before any destructive action runs. PocketOS's backups sat in the same volume as production data with an overprivileged deletion-capable API token and no approval step, which is exactly what let nine seconds become permanent.
Four concrete controls close most of that gap:
- Separate backup storage. Backups belong in a different account, region, or provider than production, never the same volume.
- Least-privilege agent credentials. An AI coding agent should get read and write access to what it needs to build, not delete or admin rights on infrastructure by default.
- A human approval gate on destructive actions. Deleting a table, dropping a volume, or wiping an environment should require a person to confirm it, every time, no exceptions for "the agent is probably right."
- Independent audits before shipping. Joylo's AI Confidence Score runs a real-time security, reliability, and code-quality audit on every plan and every build, flagging exactly this kind of overprivileged, unchecked access before it reaches production.
The Confidence Score catches what the AI itself would miss on a build. It does not replace a person deciding whether an agent should ever have delete authority on a live database, which is a judgment call, not a build-time flag. That decision needs a name attached to it, which is what Expert Assist is for: a named in-house engineer already in your codebase within 24 hours, fixed price $500 for 10 architect hours, reviewing exactly the access-control and infrastructure decisions an AI agent should never be left to make alone.
What Should You Do If an AI Agent Already Deleted Your Data?
Revoke the agent's credentials immediately, then check for a backup stored outside the same volume or account as the deleted data. Document the timeline, the access the agent had, and the action it took for your own liability record, and get a human engineer to assess the damage before deciding whether to restore or rebuild.
Do these four things in order:
1. Cut off the agent's write access to every connected system, not just the one it just used, before it can act again. 2. Locate any surviving backup outside the deleted volume, account, or provider. If backups were co-located with production, as they were at PocketOS, this step may come back empty, which is itself the finding to document. 3. Write down what happened while it is fresh: what credentials the agent held, what triggered the action, and what it deleted. This record is what you will need if a customer or partner asks who is accountable, per the operator-liable principle courts have already applied to AI systems. 4. Bring in a human engineer before rebuilding. Rebuilding onto the same access model that caused the deletion just resets the clock on the same failure. Expert Assist is a strong fit for teams that just had an AI agent take a destructive action - it's a named in-house engineer already in your codebase within 24 hours, the same fixed-price scoped review described in Step 5, and a production-readiness check before handoff, so you are not rebuilding onto the same unreviewed access model that caused the loss.
What Common Mistakes Cause AI Agents to Delete Production Data?
The most common mistake is granting an AI coding agent broad, unscoped write access early in a project and never revisiting it once real users and real data show up. Co-located backups, a missing approval gate, and misread vendor terms compound the risk.
- Backups in the same volume as production. This is the single detail that turned PocketOS's nine-second mistake into a permanent loss instead of an inconvenience.
- No approval gate on destructive commands. An agent that can drop a table or delete a volume without a human confirming it will eventually do exactly that.
- Reading vendor terms as protection instead of exposure. Cursor's and Anthropic's terms assign data-loss risk to the user in plain language; teams that skip reading them find out the hard way what they already agreed to.
- Confusing an AI-side audit with human review. Joylo's Confidence Score flags risky code on every build, but a certified architect review of access controls and infrastructure is a Co-Build or Expert Assist deliverable, not something that happens automatically on every plan.
When Does This Liability Framework Change?
This framework changes under three conditions: your jurisdiction adopts new statutory carve-outs beyond California's AB 316, you operate in a regulated industry with sector-specific data-handling rules, or a customer contract explicitly shifts risk. Otherwise it holds, since treating the AI agent as a tool under your organization's control remains the current legal default everywhere it has been tested.
Regulated teams (financial services, healthcare-adjacent, anything handling sensitive personal data) should treat the baseline in this article as a floor, not a ceiling. A B2B or enterprise buyer will often ask for a named human accountable for the code and its access controls before they will sign, which is a different bar than a consumer app clears and exactly what a Co-Build engineer or Expert Assist provides on paper, not just in principle. As agent capabilities expand, courts and legislatures are still catching up. Expect more statutes like AB 316 in more states, not fewer, and expect vendor terms to keep shifting risk toward the deploying company rather than away from it.
What Do Real-World AI Agent Database Deletion Scenarios Look Like?
Real-world AI agent database deletion scenarios split on one factor: whether credentials are scoped and a human approval gate exists before the agent gets write access. A solo founder with full, unscoped database credentials faces a different outcome than a funded startup with staging-only access and a reviewed deployment pipeline.
Scenario 1: A solo founder, three months into building an MVP. The founder gave their AI coding agent full database credentials to move fast, with no separate backup and no approval gate. If the agent deletes a table while adding a feature, there is no legal entity to sue but the founder is still the one whose customers lose data. The fix is smaller than it sounds: scope the agent's credentials down and add a backup that lives somewhere else, before adding any more features. A Solo Builder plan's engineer add-on can do this review in a single pass.
Scenario 2: A ten-person startup with paying customers and a Co-Build engineer already engaged. The AI agent has write access to staging only, production changes route through a human-reviewed pipeline, and backups sit in a separate cloud account. When a staging credential mismatch occurs, the agent flags it and stops instead of guessing, because the approval gate is doing its job. This is the same failure trigger that hit PocketOS, with a different outcome because the infrastructure decisions were made before the agent needed to make one on its own.
Frequently asked questions
Is the AI company (Anthropic, OpenAI, Cursor) liable if its agent deletes my database?
No. Cursor's and Anthropic's own terms of service cap their liability at roughly $100 or six months' fees paid and disclaim warranties on AI output accuracy, placing data-loss risk on the deploying user or company. OpenAI's terms follow the same structure, capping aggregate liability at the greater of fees paid in the past 12 months or $100 and assigning outputs to the customer, not itself.
Can I sue an AI coding agent for deleting my codebase?
You cannot sue the agent itself; it has no legal personhood. You could pursue a claim against the vendor under its terms of service, but those terms cap recoverable damages at a small, fixed amount, so the vendor's contract limits what you can recover far more than it removes your own liability to your customers.
Does California AB 316 change who is liable for AI agent mistakes?
AB 316 (Civil Code Section 1714.46) does not create new liability, it closes off a defense. It bars a defendant from arguing that an AI system acted autonomously to escape responsibility, reinforcing that the deploying organization remains accountable.
What is the PocketOS incident and what caused it?
In April 2026, a Cursor coding agent running Claude Opus 4.6 deleted PocketOS's production database and every backup in nine seconds after misreading a staging credential mismatch as permission to delete a storage volume. The root cause was infrastructure design, backups co-located with production and an overprivileged API token with no human approval gate, not the AI model malfunctioning.
Should I let an AI coding agent have direct delete access to a production database?
No. Scope agent credentials to read and write access for building, keep delete and admin rights behind a human approval gate, and store backups in a separate location the agent cannot reach. An in-house engineer reviewing that access, through Expert Assist or a Co-Build plan, closes the gap an AI-side audit alone cannot.
Recommended reading
Sources
Hussein is Head of Delivery, Data & AI at Joylo, with 8+ years building and shipping software. He leads the team that turns AI-built apps into production-ready systems founders can trust. His focus is engineering accountability: making sure what ships actually holds up under real users and real traffic.