Should an AI Agent Have Write Access to Your Warehouse? Approval Gates, Audit Trail and Rollback
Five layers that decide which writes an agent can make alone, which need a human, and how you undo them
Yes, an AI agent can have write access to a warehouse, but only if the writes are tiered by risk, gated by approval where the risk is high, logged, and reversible. The MCP specification for tools says there SHOULD always be a human in the loop with the ability to deny tool invocations. It does not say a human must approve every call, and treating it that way is how teams end up with an agent nobody uses.
Key Takeaways
- •Write access is a per-action risk decision, not a yes/no switch: a row-level backfill in a sandbox schema and a DROP COLUMN on a gold table should not share a policy.
- •Approve by risk tier, not by action count. Low-risk, reversible writes can run alone; destructive or wide-blast-radius writes wait for a named human.
- •Every write needs three records: who (an agent identity, not a shared key), what (the exact statement and its blast radius), and who approved it.
- •Rollback is a design input, not an afterthought: Snowflake Time Travel, BigQuery time travel and Delta Lake RESTORE all have retention windows that define how long a mistake stays cheap to undo.
- •Start read-only, then widen the autonomy dial one domain at a time as the audit trail shows the agent's proposals match what a human would have approved.
Why the write path is a different question from read-only access
Most teams start with read-only access, and that is the right place to start. A read-only agent can be wrong, but being wrong costs a bad answer, not a bad table. We have written before about giving each agent its own identity and least-privilege access over MCP, and that work is the foundation here. The write path adds a new failure class: the agent is right about the diagnosis, wrong about the fix, and the fix is applied to production data before anyone looks.
The write question also arrives from the other direction. Once a read-only agent has diagnosed a stale table, a schema drift or a slow query, the engineer is left to copy the suggested fix into a console and run it by hand. That copy-and-paste step is the integration layer we keep describing, and it is where most of the time goes between knowing something is wrong and having it fixed.
So the real decision is not whether to allow writes. It is which writes, under which identity, with which approval, and with what way back. The five layers below answer those four questions in order. Each layer is independent: you can adopt the first two and still be safer than a shared service-account key, and each one you add shrinks the set of things that can go wrong without anyone noticing.
Layer 1: give the agent its own identity and a task-scoped role
The first control is boring and does most of the work. The agent connects as a named identity with a role that can only touch the objects its job requires. In Snowflake that is a dedicated role granted INSERT on one schema rather than OWNERSHIP on a database. In BigQuery it is a service account with a dataset-level role rather than a project-level editor role. In Databricks it is a principal with privileges on one catalog and schema.
Scope the role to the action class as well as the object. An agent that fixes freshness problems needs to run a pipeline and write to a staging schema. It does not need DROP, GRANT or the ability to alter a masking policy. Splitting a read role, a staging-write role and a production-write role gives you three distinct trust levels, and the approval gates in the next layer can then map onto them cleanly.
Avoid the shortcut of reusing an engineer's credentials. The audit log then shows a human did the work, the human cannot say which actions were theirs, and revoking the agent means revoking a person. A separate identity per agent, and ideally per task type, makes every later layer simpler because the question of who did this has a one-line answer.
Layer 2: tier approvals by risk instead of approving everything
Approving every action sounds safe and fails in practice. Reviewers see the fortieth identical request of the day, start clicking through, and the gate becomes a rubber stamp that records consent without providing review. A better design sorts writes into tiers. Tier one is reversible and contained, such as a rebuild of a staging table, and runs without approval. Tier two is production-affecting but reversible, such as a backfill, and needs one approval.
Tier three is destructive or wide, such as dropping a column, changing a retention setting, altering access policy or touching a table with many downstream consumers. These need a named approver, and for some actions two. The tier is computed from facts the system can check: the statement type, the object's classification, the number of downstream dependents, and whether a recovery path exists inside its retention window.
This is what we mean by an autonomy dial per domain. A team might let the agent act alone on quality-rule updates, require approval on pipeline changes, and keep schema and access changes proposal-only. The dial moves as trust is earned, and the audit trail is the evidence you use to move it. Our approval-gate write-up for MCP tool calls covers what each gate must capture so the decision can be reviewed later.
Layer 3: dry-run every write and compute the blast radius first
An approval is only as good as what the approver sees. A gate that says the agent wants to run an ALTER statement gives a human nothing to judge. A gate that says this statement drops a column read by 14 downstream models and 3 dashboards, and none of them has been migrated, lets the approver decide in seconds. The agent should attach that evidence to every request, not wait to be asked.
Dry runs differ by platform but the principle is shared. BigQuery supports a dry-run flag that validates a query and reports bytes processed without running it. For DML you can run the statement against a clone or a copy of the affected rows and compare counts. For schema changes, lineage gives you the dependents, which is why a blast-radius question such as what breaks if I drop this column belongs in the same system that proposes the change.
The output of this layer is a diff the reviewer can read: rows expected to change, objects affected, consumers downstream, estimated cost, and the rollback path. If the agent cannot produce that diff, the write should not be eligible for autonomous execution. We treat a missing or low-confidence diff as an automatic promotion to the next approval tier, which keeps the failure mode on the safe side.
Layer 4: record who, what and who approved, in a trail you can read
Warehouses already log a lot. Snowflake retains QUERY_HISTORY in its ACCOUNT_USAGE schema for 365 days, and the same retention applies to ACCESS_HISTORY. That tells you which statement ran under which user and role. It does not tell you why the agent ran it, which prompt or finding triggered it, or which human approved it. The warehouse log is necessary and insufficient.
The agent-side record has to fill that gap. For each write we log the agent identity, the triggering request or finding, the exact statement, the computed blast radius, the approval tier, the approver and their decision, and the outcome. Join that to the warehouse log on the query ID and you can reconstruct an incident end to end. Tamper-evidence matters here: an audit trail the agent can edit is not an audit trail.
This is also the layer compliance teams ask about first. Regulators and auditors want to know who accessed what and under which authority, and a trail built this way answers it without a spreadsheet exercise. The Governance Agent generates the audit trail and maps it to SOC2, GDPR and HIPAA controls, so the evidence exists before the question arrives.
Layer 5: know your rollback window before you grant the write
Rollback is where the platforms differ most, and the retention window defines how long a mistake stays cheap to fix. Snowflake documents that Time Travel retention defaults to 1 day and can be set up to 90 days on Enterprise Edition or higher. Inside that window you can query or restore a table, schema or database as it was. After it, recovery depends on a separate fail-safe period that only Snowflake can use.
BigQuery keeps it simple. Its documentation says time travel lets you access data from any point within the time travel window, which defaults to 7 days and can be configured between 2 and 7 days. On Databricks, the Delta Lake docs on table history and RESTORE show that a table can be restored to an earlier version, and that the log retention setting delta.logRetentionDuration defaults to 30 days. A restore also fails if the underlying data files were already removed by VACUUM.
Turn these facts into policy. A write whose recovery path is a restore inside a known window can sit in a lower tier. A write that cannot be undone, such as an external side effect or an operation after the window has closed, goes to the top tier regardless of size. Also snapshot or clone before a tier-two write so the rollback is a deliberate step the agent has already prepared, not a scramble after the fact.
Putting the layers together in a real workflow
Take a concrete case. Overnight, row counts on an orders table drop 40%. The Incidents Agent traces it to a connector that started delivering a renamed column. The proposed fix is a mapping change in the pipeline plus a backfill of the missing rows. Under the layers above, the mapping change is tier two and the backfill is tier two, both reversible, both inside the retention window.
The agent runs under its own pipeline-write role, produces a dry-run diff listing the rows to be added and the models that read them, snapshots the target, and files one approval request that bundles the two steps. A data engineer reads a ten-line summary instead of a stack trace, approves, and the agent executes and logs the outcome. The engineer made one decision instead of doing an hour of diagnosis and typing.
Now change one detail: the proposed fix includes dropping the old column. That is tier three. The agent still prepares the evidence, but the request goes to the table owner, and the system will not run it on a single approval from someone outside that domain. The workflow has the same shape in both cases. Only the gate changes, and it changes because the risk changed, not because someone remembered to be careful.
Where Data Workers fits
The open-source edition of Data Workers, dw-claw, is Apache 2.0, runs locally and is read-only by default. That is deliberate: you can point fifteen MCP-native agents at your stack, ask what changed in the orders schema since the last deploy, and see what they would have done, without granting a single write. Most teams run in that mode for a while and learn what the agents actually propose.
Pro adds writes, 25 enterprise connectors, approval workflows and audit trails, which are the layers described above. The Connectors Agent holds the warehouse connections and scopes each one to a role, and the approval workflow applies the risk tiers. Enterprise adds SSO/SAML, multi-tenant isolation and VPC or on-prem deployment, so data and credentials stay inside your own infrastructure.
The commitment we make is about direction, not speed. Autonomy is a per-domain dial that starts at proposal-only and moves toward autonomous operation as the trail earns it. The agents work from inside Claude Code, Cursor or any MCP-compatible client your engineers already use, so approvals and diffs appear where the work happens rather than in another dashboard to check.
Frequently Asked Questions
Should an AI agent have write access to Snowflake, BigQuery or Databricks?
Yes, with limits. Give it a dedicated identity, a role scoped to the objects and statement types its job needs, approval gates tiered by risk, and a rollback path inside the platform's retention window. Begin read-only, review what the agent proposes for a few weeks, and enable autonomous writes only for low-risk reversible actions. Keep destructive and access-policy changes behind a named human approver.
Do I need to approve every action the agent takes?
No, and trying to makes the process worse. Approving everything trains reviewers to click through, so the gate stops catching real problems. Tier actions by statement type, object sensitivity, downstream dependents and reversibility. Run tier-one writes alone, require one approval for tier two and a named approver for tier three. The MCP specification asks for a human able to deny invocations, which a tiered design satisfies.
What happens if an approved write turns out to be wrong?
You roll it back using the platform's history: Time Travel in Snowflake, time travel in BigQuery or RESTORE on a Delta table in Databricks, as long as you are inside the retention window. The audit trail tells you which statement, which agent and which approver were involved, so the review that follows is about the policy rather than the blame. Take a snapshot before tier-two writes so rollback is prepared in advance.
Is the warehouse's own query log enough as an audit trail?
It is necessary but not sufficient. The warehouse log records which statement ran under which user and role. It does not record why an agent ran it, what evidence it showed the approver, or who approved it. Keep an agent-side record of the request, statement, blast radius, tier, approver and outcome, and join it to the warehouse log on the query ID.