Snowflake Cortex Agents
Give Cortex Agents access to your enterprise data context in DataHub — business definitions, ownership, lineage, and quality signals — so they can generate better SQL and answer data questions accurately.
The integration works through UDFs created by the DataHub CLI. Once set up, your Cortex Agent calls DataHub tools alongside your Snowflake tables.
Prerequisites
pip install datahub-agent-context[snowflake]- A DataHub Cloud instance URL and personal access token
- A Snowflake user with the
ACCOUNTADMINrole (for initial setup)
Setup
You can either let the CLI execute the SQL directly, or generate the SQL files and run them yourself.
Option A: Execute directly
datahub agent create snowflake \
--sf-account YOUR_ACCOUNT \
--sf-user YOUR_USER \
--sf-password YOUR_PASSWORD \
--sf-role YOUR_ROLE \
--sf-warehouse YOUR_WAREHOUSE \
--sf-database YOUR_DATABASE \
--sf-schema YOUR_SCHEMA \
--datahub-url https://your-datahub.acryl.io \
--datahub-token YOUR_TOKEN \
--enable-mutations \
--execute
Use --sf-authenticator externalbrowser for SSO instead of --sf-password.

Option B: Generate SQL
Drop --execute and --sf-password to generate SQL files instead. Then run them in order in a Snowflake worksheet:
@00_configuration.sql;
@01_network_rules.sql;
@02_datahub_udfs.sql;
@03_stored_procedure.sql;
@04_cortex_agent.sql;
Configure and Use
Customize the agent's prompt, model, and tools in the Snowflake UI, then open Snowflake Intelligence and select the DataHub Agent.

Updating UDFs
When new tools are released, re-run the UDF and agent SQL:
@02_datahub_udfs.sql;
@04_cortex_agent.sql;
Troubleshooting
- Permission denied? Initial setup requires
ACCOUNTADMIN. After that,SNOWFLAKE_INTELLIGENCE_ADMINis sufficient. - UDFs not found? Run
SHOW USER FUNCTIONS LIKE 'datahub%';to verify. - Agent not using DataHub tools? Update the agent system prompt to explicitly mention DataHub tools.
- Connection errors? Verify the DataHub URL is reachable and the token hasn't expired (should start with
eyJ). - Empty results? Check token permissions and that entities exist in the DataHub UI.
Links: Cortex Agents Docs · Agent Context Kit · MCP Server Guide