Never let an agent experiment on production data. Give each agent run its own disposable copy of the database, so a bad migration or accidental delete only affects that copy. Options include snapshot or copy-on-write features in your database or filesystem, managed branching services, or a container started from a seed dataset.
Use anonymised or synthetic data rather than real customer records. Give the agent credentials limited to its own copy, and delete the copy when the task ends. Run your test suite against it before any change is merged, and apply migrations to real systems only through your normal reviewed process. Fast cloning matters, because slow setup tempts teams to share one database across runs.