How to Configure CrewAI Snowflake Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a crewai snowflake approval flow by pausing agent tasks for human review. You also pair that step with strict database roles and limited table permissions. Many teams start by giving an AI agent a broad service account. That choice lets the agent run any SQL query it writes on its own. If the agent makes a mistake, it can drop tables or read private rows. How a native crewai snowflake approval setup works In a standard CrewAI setup, an agent uses a tool to query data. The agent tak

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 a crewai snowflake approval flow by pausing agent tasks for human review. You also pair that step with strict database roles and limited table permissions. Many teams start by giving an AI agent a broad service account. That choice lets the agent run any SQL query it writes on its own. If the agent makes a mistake, it can drop tables or read private rows.

How a native crewai snowflake approval setup works

In a standard CrewAI setup, an agent uses a tool to query data. The agent takes a prompt, writes a SQL string, and runs the tool. To add a human check, engineers turn on human input in the task step. The agent writes the query first and then stops to wait for a person. A reviewer reads the draft query and types a reply to let it run.

On the data warehouse side, admins create a dedicated role for the agent session. They grant that role read permissions on a small set of views or tables. The agent authenticates with its assigned credentials and assumes that restricted role during work. This two-part design combines framework pauses with warehouse role permissions to control agent behavior.

Teams also build custom tool wrappers around the database driver in their Python code. The wrapper checks the query string and sends a message to a chat channel. The script waits until a manager clicks a button before it runs the SQL. This custom code must run inside every agent app that queries the warehouse.

What native roles solve and what they leave open

Native roles in Snowflake decide which user or service account can log in. They also control which schemas, tables, and views that role can read or change. If you give the agent a read-only role, it cannot delete production data. That step stops big accidents like dropped tables or bad writes from a prompt.

Still, static roles do not inspect what an individual query does in flight. Once the agent authenticates its session, it can query every row in allowed tables. A single select statement can pull thousands of customer emails or phone numbers. Static roles cannot tell a safe summary query from a full table dump.

Approval Chains & Escalation + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Framework pauses also have clear limits when teams run many agents at once. A human check inside CrewAI relies on the app developers keeping that setting enabled. If a developer turns off the prompt flag in code, the check vanishes. Database admins have no central place to see or approve queries across different apps.

Adding query checks and data masking

A safer design separates the approval step from the agent code itself. Instead of trusting every Python script, teams check queries at the database boundary. When an agent sends a query, the system pauses risky commands for review. Reviewers can approve or block the exact SQL statement from a shared chat tool.

Data masking also protects private columns during normal read queries. When a query runs, masking rewrites matched fields like card numbers or national IDs. This keeps sensitive strings out of the language model context window and logs. Teams keep their data safe while agents still get the summaries they need.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Why is a read-only role not enough for AI agents?

A read-only role stops data changes, but it still allows full table reads. An agent can pull emails, phone numbers, or card numbers into external model prompts. You need query checks and field masking to control what leaves the warehouse.

Where should human review happen in an agent workflow?

Human review works best right before the database runs the generated SQL statement. Checking inside agent code helps during tests, but code settings can change without notice. Enforcing reviews outside the app ensures every query follows the same team rules.

How do you keep sensitive fields out of agent prompts?

You apply dynamic masking rules to columns or patterns before results return. Masking rewrites matched fields like national IDs or phone numbers in the query output. The agent receives safe text and can still complete its task without raw strings.

The query runs. The emails stay hidden.