Connecting Snowflake to Private AI Without Copying the Warehouse
How to wire Snowflake into private AI with the user's own role grants, parameterized SQL, and query-in-place patterns that leave governed rows inside the warehouse.

"Query-in-place" is often read as a guarantee that running an LLM on Snowflake data keeps everything private by default. It describes where the compute runs, not who checked whether the caller was allowed to see the rows the model summarized.
Cortex AI SQL and in-warehouse agents still enforce access through RBAC, row access policies, and masking, but only when the agent's SQL carries the end user's identity to the warehouse. Identity propagation, policy enforcement at query time, and warehouse-level cost attribution are the three surfaces that make the rest of this architecture hold together.
Cortex Privileges Are a Floor, Not a Ceiling
Snowflake Cortex refuses to run an AI function unless the caller holds both the account-level USE AI FUNCTIONS privilege and either the CORTEX_USER or AI_FUNCTIONS_USER database role, per Snowflake's privileges and model access reference. Model-level access is controlled the same way, through grants on model objects in the SNOWFLAKE.MODELS schema or the legacy CORTEX_MODELS_ALLOWLIST parameter.
That pair of controls is a floor. It decides whether a caller may invoke any model at all. The row filter, the masking policy, and the warehouse grant still decide what the model gets to read. If the agent calls Cortex under a shared service account, every one of those checks evaluates against that account's role, which is why access control cannot live in the prompt.
Run SQL Under the User's Identity
The cleanest way to keep Snowflake's governance intact is to run every agent query as the user who asked the question. OAuth with an external identity provider gives the agent a session token scoped to that user's role; USE ROLE on the session takes whatever role the user holds by default or by just-in-time grant.
Row access policies evaluate against the active role when the query parses. Masking policies evaluate when the column is projected. Neither cares whether an LLM called the SELECT or a BI tool did. QUERY_TAG, query ID, and ACCESS_HISTORY all land with the user's name on them, which is what lets Data.co Control attach an audit record to the exact person whose request produced it.
Service accounts are acceptable for workloads that read nothing sensitive, such as embeddings over public documentation or scheduled summaries of non-regulated tables. For anything that touches governed data, identity propagation is not optional.
Three Patterns, Three Governance Surfaces
There are three dominant patterns for putting Snowflake data in front of an AI agent. They differ most on where the data crosses a trust boundary and which governance layer evaluates when it does. The primitives Snowflake itself exposes are the ceiling on what any of these patterns can enforce once the query leaves the warehouse.
Cortex AI SQL runs model inference inside the Snowflake account; row access policies and masking apply before the completion is returned. An external agent calling Snowflake through a driver can achieve the same effect when it authenticates as the user and issues parameterized SQL, which is roughly the architecture in the MCP server for enterprise databases piece. Copying tables into an external vector database breaks that chain. Policies are evaluated once, at copy time, against whichever account did the copying.
| Primitive | Scope | Evaluated When |
|---|---|---|
| Dynamic data masking | Column | At query runtime |
| Row access policies | Row | At query runtime |
| Object tagging | Object hierarchy | On tag application, propagates to policies |
| Data classification | Column | During analyze and apply phases |
| Access history | Query and DML | Recorded post-execution |

Where the Credits Go in a Cortex Call
Cortex AI functions bill in AI Credits per million tokens, with input and output priced separately. For workloads that generate long completions, such as chat agents or synthesis over retrieved rows, output dominates the bill.
The split matters for how you design the agent. Retrieval-heavy architectures that stream tens of thousands of context tokens into a model and expect a short answer behave very differently, cost-wise, from a workflow that asks the model to write a long report. The chart below shows input vs output pricing for six models exposed through Cortex AISQL. The price difference between a small open-weight model and a frontier proprietary one is more than an order of magnitude on input and closer to two on output.
Account-level routing through the model allowlist is the main lever to keep a cost-sensitive team on the cheaper model. Per-query budget enforcement is harder to reason about when the model is chosen by the agent at runtime.
Warehouse Size Is a Governance Decision
Every Cortex call pulls from a Snowflake warehouse the DBA chose. Warehouse credits double at each step from X-Small to 6X-Large, so the warehouse an agent runs on is a cost lever as much as a performance lever. It is also a governance lever: a resource monitor on that warehouse caps the blast radius of a prompt that asks for "everything."
Tie the agent warehouse to a dedicated role, attach a QUERY_TAG the auditor can filter on, and give the warehouse a resource monitor with hard-stop behavior. The result is a per-agent credit ceiling the agent cannot override, and a ledger the finance team can reconcile against the AI budget set in your private AI infrastructure plan.
Role Hierarchy Decides What the Agent Can Read
Snowflake's system role hierarchy decides which caller can inherit which privileges. ACCOUNTADMIN inherits SYSADMIN and SECURITYADMIN. SECURITYADMIN inherits USERADMIN. PUBLIC is granted to every user. An AI agent that runs as ACCOUNTADMIN therefore reads every table in the account, which is almost never the intent.
A sound deployment grants the agent a dedicated functional role that inherits from a narrow set of data access roles, and nothing wider. The EU's general-purpose AI rules, which began applying on 2 August 2025, add obligations on top, including technical documentation, downstream information-sharing, and a summary of training data. They do not override Snowflake's RBAC, but the audit evidence they require has to come from somewhere, and ACCESS_HISTORY is a reasonable place for it to start.
When to Pick Each Pattern
Choose Cortex AI SQL when the data cannot leave the Snowflake account for regulatory reasons, the agent's prompts are bounded enough that model selection can be controlled centrally, and warehouse credit accounting is already how your platform team charges back AI spend.
Choose an external agent that runs query-in-place SQL when you need open-weight models Snowflake has not exposed, the agent must join Snowflake data with other sources, or your identity provider already issues the OAuth tokens that would let the agent assume the user's role.
Copy tables to an external vector store only when the data is genuinely public, the retrieval latency budget is well under what a warehouse cold-start can meet, and you have accepted that governance in the destination store is now your problem rather than Snowflake's.
Timothy Carter is Chief Revenue Officer and has spent over two decades in SEO and digital marketing. At Data.co his focus is the buyer's side of private AI: what a security or data team needs to see before an AI project leaves the pilot stage, and why the hardest question is usually not which model to run but which data it is allowed to touch. He has written for Forbes, Entrepreneur, Marketing Land, Search Engine Journal and ReadWrite, and tends to start from what the buyer already knows is broken rather than from the feature list.