The takeaway
Before you tighten an AI agent's database permissions, prove you can restore: verified backups, point-in-time recovery that covers agent loops, and a way to replay a single bad transaction.
Why it matters for builders
Treat recoverability as the primary control for agent database access. Read-only credentials by default, writes only through a narrow tool with a hard row limit, destructive statements behind human approval, and a restore drill on a schedule. Permission scope alone does not bound blast radius if the recovery path cannot selectively undo the damage.
AI Agent Database Damage Depends on Undo, Not Permissions
AI agents now run statements against production databases, and recent incidents deleted production data that came back only from backups or the provider's support desk. A new preregistered study asks the question teams usually answer by feel: when an agent makes a mistake, what decides how much damage it does - the model, the guard layer in front of the database, or the engine itself?
The paper, When an AI agent makes a mistake in a database, what decides the damage?, was posted to arXiv on November 23 by Abdullah Kaya, Cevheri Bozoglan and Yusuf Gundogdu and flagged by AI Weekly on November 28. The preregistration is public on OSF.
What the study actually ran
The work has two preregistered layers. Layer A applied "a frozen library of 22 canonical mistakes" by script, with no model involved, to four relational engines across five permission arms and two recovery arms, then ran an engine-native recovery drill: 792 cells and 874 drill runs.
Layer B drove a minimal tool-calling agent with six small open-weight models, from 4B to 12B parameters plus one 35B mixture-of-experts with roughly 3B active, served locally. Those agents worked hazard tasks across nine engines: PostgreSQL, MySQL, SQLite, ClickHouse, Cassandra, MongoDB, Valkey, Kafka and OpenSearch, at 9,468 trials. A secondary run over 2,916 more trials covered MariaDB, Redis and Elasticsearch.
The result: recovery paths, not grant scope
The abstract states, "the engines differ less in what a mistake destroys than in what they let you undo." Blast radius was governed by recoverability - backups, point-in-time recovery, engine-native undo - more than by how tightly permissions were scoped.
The authors are candid about their own ledger. Only three of seven preregistered hypotheses met the decision rule. Four failed, and H5 was uninformative because the agents never found the credential they were supposed to misuse. On PostgreSQL, MySQL, OpenSearch and ClickHouse, the preregistered outcome and original-row loss disagree about one damage class.

What builders should change
For teams wiring agents into databases, the practical order of operations inverts. Before tightening grants, audit whether you can actually restore: how old is the last verified backup, does point-in-time recovery cover the window in which an agent loop runs, and can you replay a specific bad transaction without restoring the whole instance.
Small local models in this study were enough to cause the problems, so a grader on model choice is not a safety control. A permission-only approach gives a false sense of protection if the same role that blocks DROP can still issue an unbounded UPDATE inside a statement the recovery tooling cannot selectively reverse.
The defensible pattern stays unglamorous: read-only credentials by default, write access through a narrow tool with a hard row limit, destructive statements behind explicit human approval, and a restore test on a schedule rather than after an incident.
The Automation Brief
Read 5 AI stories instead of 50.
The essential moves in AI agents, models, automation and infrastructure — filtered for builders and operators, with the part that actually matters.
No noise. Unsubscribe anytime.
Editorial notes
Stefan Trbojevic
n8n Lab Editorial
28 November 2026
28 November 2026
Sources
AI disclosure: AI assisted with research and drafting. Factual claims are reviewed by an editor.




