How to Configure Mastra Snowflake Approval
You set up mastra snowflake approval by pausing agent workflows before database tools run. The agent waits for a human to review and approve the query first. Many teams start by giving their AI agents a shared database role. If that role has broad permissions, the agent can change or read too much data. AI agents build and run queries fast. A small mistake in a prompt can cause a huge problem in your warehouse. Putting a human check in permissions of risky actions keeps your production data saf
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up mastra snowflake approval by pausing agent workflows before database tools run. The agent waits for a human to review and approve the query first. Many teams start by giving their AI agents a shared database role. If that role has broad permissions, the agent can change or read too much data.
AI agents build and run queries fast. A small mistake in a prompt can cause a huge problem in your warehouse. Putting a human check in permissions of risky actions keeps your production data safe. It lets your team check the exact query before the warehouse runs it.
How mastra snowflake approval workflows work
Mastra lets you build AI agents that use tools and step-by-step workflows. You can wrap your warehouse query tool inside a workflow step that can pause. When the agent wants to run a query, the workflow stops at that step. It saves the state of the task and sends an alert to a reviewer.
On the warehouse side, you set up a specific role for the agent session. You limit permissions on this role to the exact tables the agent needs. The agent uses a key pair or user token to log in its warehouse session. Once the human reviewer approves the paused step, the workflow resumes and runs the query.
You can also split your agent tools into read and write groups. Read tools might run right away using a role with read-only permissions. Write tools trigger the pause step so an engineer can check the statement first. This setup keeps simple lookups fast while guarding table changes.
What native role checks solve and what they miss
Warehouse roles and workflow pauses solve basic permission problems. Role permissions stop an agent from reading tables outside its assigned schema. Workflow pauses let a human check a task before the agent calls a tool. Together, they give your team a solid first line of defense.
Still, static roles only decide who can log in and which tables they touch. They do not inspect what an individual statement does in flight. Once an agent authenticates a session, it holds those permissions for every query. If a human approves a broad tool call, the agent might still pull sensitive rows.
Approval Chains & Escalation + Snowflake Access Control: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Native roles also struggle with sensitive fields inside allowed tables. An agent might need a customer table to answer a support ticket. That same table might hold emails, phone numbers, card numbers, or national IDs. Without field-level masking that rewrites matched fields in results, raw data enters the agent prompt.
Designing safe human review steps for data agents
A good review step shows the reviewer the exact query and the agent goal. If reviewers only see a vague request, they cannot spot a bad filter. Send the planned SQL statement to your team chat channel for a clear check. Let the reviewer approve or reject the step with one click.
You should also set timeouts on every paused workflow step. If no one approves the query within an hour, the workflow should cancel itself. This stops old, stale queries from running days later when someone clicks an old button. Clear logs of who approved each query also help during security audits.
Finally, review the permissions on your agent roles every month. Remove table permissions that the agent no longer needs for its daily tasks. Keep your read and write roles separate so a read task never changes data. Combining tight roles with step pauses makes agent workflows much safer to run.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
How does Mastra pause a query for human review?
Mastra workflows include a suspend feature that stops execution before a tool runs. The workflow waits until an external system or human sends a resume signal.
Should my AI agent use a shared admin role in the warehouse?
No, you should create a dedicated role with minimal permissions for the agent. Grant only the specific schemas and tables needed for the task.
What happens to sensitive fields when an agent runs a read query?
Unless you apply data masking to rewrite emails or card numbers, the query returns raw values. Those values then flow into the model context and logs.
Related guides
In this post