Snowflake Cortex AI is a suite of AI features that use large language models (LLMs) to understand unstructured data, answer freeform questions, and provide intelligent assistance. Within this ecosystem, Snowflake has introduced Cortex Code, an AI-driven intelligent agent optimized for complex data engineering, analytics, machine learning, and agent-building tasks.
Snowflake Cortex Code represents a fundamental shift in how we interact with data platforms. Unlike generic AI coding assistants, Cortex Code is natively integrated into Snowflake and deeply understands your data context: schemas, governance policies, RBAC permissions, and the relationships between your data assets.
In this article, we'll explore what Cortex Code is, how it works, and see it in action through a practical example: automating dbt project creation.
What is Snowflake Cortex Code?
Cortex Code is an AI agent integrated into the Snowflake platform, designed specifically for data engineering, analytics, ML, and application development. It's an intelligent partner that knows your data platform as well as you do. What sets it apart is context awareness: it understands your databases, schemas, tables, and their relationships, governance policies and masking rules, RBAC permissions and access controls, query patterns and performance characteristics, and Snowflake-specific SQL dialect and best practices.
This means you can use natural language prompts like "Find all tables with PII tags" or "Optimize this query that's taking 5 minutes" and get responses that understand your specific environment, not just generic advice.
Cortex Code uses intelligent orchestration to plan and execute multi-step tasks autonomously: analyzing requirements, creating execution plans, selecting appropriate tools and context, executing steps across your Snowflake environment, and maintaining conversation context throughout the session.
Key Capabilities
Cortex Code excels across multiple key areas:
Data Engineering: SQL generation and optimization, dbt project automation, Apache Airflow DAG creation, pipeline development, and code explanation
Data Discovery: Natural language catalog search, metadata exploration, compliance queries (PII identification, access controls), and RBAC analysis
FinOps & Administration: Credit consumption tracking, performance monitoring, resource optimization recommendations, and usage pattern insights
Application Development: Streamlit app creation, Cortex Agent deployment, and tool integration
Ways to Use Cortex Code
Cortex Code is available through two complementary interfaces, each designed for different workflows and use cases. These interfaces are Snowsight and CLI.
Cortex Code in Snowsight
The web-based interface is integrated directly into Snowflake's UI.
Best for: Ad-hoc SQL development, data exploration, account administration, and quick prototyping.
Key advantages:
Zero setup required - instant access from your browser
Visual diff review for code changes
Integrated with Snowsight notebooks and worksheets
Context-aware of your current workspace
Limitations: Web-only interface with no local file system access
Cortex Code CLI
A command-line agent that bridges local development environments with Snowflake.
Best for: project development, Streamlit applications, DevOps workflows, and CI/CD pipelines
Key advantages:
Direct access to local files and git repositories
Seamless integration with IDEs (VS Code, Cursor)
Tool orchestration capabilities (bash, git, SQL)
Custom automation via AGENTS.md configuration
Limitations: Requires installation. However, you can install Cortex Code CLI with a single command: #bash
curl -LsS https://ai.snowflake.com/static/cc-scripts/install.sh | sh
Getting Started with Cortex Code
Availability and Prerequisites
Cortex Code is available on all Commercial Snowflake accounts (excluding Gov, VPS, and Sovereign deployments).
Cross-region inference must be enabled at the account level.
#sql
-- Requires ACCOUNTADMIN role
ALTER ACCOUNT SET CORTEX_ENABLED_CROSS_REGION = 'ANY_REGION';
Required Permissions
Users need two database roles to access Cortex Code:
SNOWFLAKE.COPILOT_USER: Required for all Cortex Code users. SNOWFLAKE.CORTEX_USER or SNOWFLAKE.CORTEX_AGENT_USER: At least one required. Use CORTEX_AGENT_USER for advanced agentic workflows.
Grant permissions:
#sql
-- As ACCOUNTADMIN
GRANT DATABASE ROLE SNOWFLAKE.COPILOT_USER TO ROLE your_role;
GRANT DATABASE ROLE SNOWFLAKE.CORTEX_USER TO ROLE your_role;
Pricing and Billing
The question that every organization will have is, “What is the cost of Cortex Code?” That answer depends, as Cortex Code uses different pricing models depending on the interface:
Snowsight: Currently free. Users will be notified before any charges are applied.
CLI: Token-based consumption billing.
Cost considerations: CLI charges are based on the complexity and length of prompts and generated code. Complex multi-step tasks (like generating full dbt projects) consume more tokens than simple queries. Monitor usage through Snowflake's standard metering views to track consumption.
Cortex Code in Action: Automating dbt Project Creation
Let's see Cortex Code's capabilities through a real-world scenario: creating a complete dbt project from existing Bronze tables.
The Scenario
You have a Bronze schema (ECOMMERCE_DB.BRONZE) with raw e-commerce data across 7 tables: SUPPLIERS, PRODUCTS, CUSTOMERS, ORDERS, ORDER_ITEMS, PRODUCT_REVIEWS, and SHIPPING_EVENTS.
Traditional approach: Days of manual work to analyze schemas, design transformations, write SQL, create tests, and document everything.
With Cortex Code: Minutes of conversation in natural language.
Step 1: Analysis
cortex
Prompt:
Analyze ECOMMERCE_DB.BRONZE and summarize the schema structure
and relationships between tables.
Cortex Code examines your metadata catalog and provides a comprehensive analysis of table structures, data types, and foreign key relationships.

Step 2: Project Generation
Prompt:
Create a complete dbt project with:
1. Base configuration (dbt_project.yml, profiles.yml)
2. Staging models in SILVER schema (clean and standardize all 7 tables)
3. Analytics models in GOLD schema:
- Customer dimension with segmentation
- Product dimension with hierarchies
- Sales facts with metrics
4. Quality tests (uniqueness, referential integrity, not-null)
5. Complete documentation
Follow dbt and Snowflake best practices.

Step 3: Execution
Cortex Code generates the entire project structure with optimized SQL, configurations, tests, and documentation. You validate and run:
dbt run && dbt test
The Result
You now have a complete dbt project structure with SQL models, configurations, tests, and documentation. The generated code provides a solid starting point that would typically require significant manual effort, though validation and refinement are still necessary before production use.
Cortex AI vs Cortex Code: Understanding the Difference
Both Cortex AI and Cortex Code are part of Snowflake's AI ecosystem, but they serve fundamentally different purposes. Let’s break them down.
Cortex Code builds and governs the platform. Cortex AI activates intelligence within it. Both operate inside Snowflake’s security perimeter and respect RBAC, masking policies, and data governance controls.

Cortex AI: Intelligence for Your Data
Cortex AI is a suite of SQL functions and ML services that bring large language models and machine learning directly into your queries.
Best for: Data analysts, data scientists, and SQL developers who need to apply AI transformations to their data.
Example use case: "Analyze sentiment across 10 million customer reviews and identify trending concerns by product category.”
Cortex Code: Intelligence for Your Development
Cortex Code is an AI development agent that understands your complete Snowflake environment (schemas, tables, governance policies, RBAC permissions) and generates production-ready code through natural language. It creates dbt pipelines, Streamlit apps, Apache Airflow DAGs, and Cortex Agents based on conversational prompts.
Best for: Developers, data engineers, and architects who need to build data infrastructure and applications on Snowflake.
Example use case: "Create a dbt project with data quality tests for my Bronze schema" or "Generate an Airflow DAG to orchestrate my nightly ETL pipeline."
Working Together
Cortex AI and Cortex Code are complementary. Consider a data quality audit scenario:
- Cortex Code builds the audit infrastructure, creates the dbt project structure, generates test definitions, sets up monitoring workflows, and configures alerts.
- Cortex AI powers the intelligence layer, uses `AI_COMPLETE` to analyze anomalies, `AI_CLASSIFY` to categorize data quality issues, or `AI_SUMMARIZE` to create executive summaries of audit findings.
Think of it this way: Cortex AI is the intelligence engine for your data. Cortex Code is the development copilot for building on Snowflake.
Together, they form a governed AI stack inside Snowflake, where development acceleration and AI-powered insight operate within the same security and governance perimeter.
Cortex Code Benefits and Drawbacks
Cortex Code represents a paradigm shift: from writing code about data to conversing with an agent that understands your data. The implications are transformative.
Productivity: Tasks that took days now take minutes. Our dbt example showed how a multi-day project became a 10-minute conversation.
Consistency: Generated code follows established best practices and organizational standards, reducing the need for extensive code reviews.
Acceleration: Data teams can move faster from concept to implementation, asking questions and iterating through natural language rather than manual coding.
Focus: Data teams can spend time on strategic decisions, what to build, and why, rather than syntax and implementation details.
But most importantly, Cortex Code doesn't replace data engineers; it augments them. The strategic thinking, business understanding, and architectural decisions remain human. The repetitive implementation, optimization, and documentation become automated.
Limitations and Considerations
While Cortex Code delivers transformative capabilities, understanding its boundaries helps set realistic expectations.
Data Residency: Cortex Code requires cross-region inference to be enabled at the account level. This means your data and metadata may be processed in different geographic regions than where your Snowflake account is hosted. Organizations with strict data sovereignty requirements (GDPR, data localization laws) should carefully evaluate this before enabling.
Availability: Limited to commercial Snowflake accounts (excludes Government, VPS, and Sovereign deployments).
Cost: CLI usage incurs token-based consumption charges that scale with task complexity. Snowsight is currently free but subject to future pricing.
Human Oversight: Cortex Code operates within your RBAC permissions. As an evolving AI agent and like all LLM-based tools, generated code should be reviewed for accuracy, appropriate permissions, and alignment with your governance policies before production deployment. Test thoroughly and treat it as an accelerator, not a replacement for engineering judgment.
Conclusion
Snowflake Cortex Code is more than an AI coding assistant; it's a context-aware agent that understands your Snowflake environment at a deep level. Unlike generic AI assistants that provide pattern-based suggestions, Cortex Code natively understands your schemas, RBAC permissions, governance policies, and applies Snowflake-specific optimizations while operating within your security model. Whether you're exploring your data catalog, optimizing costs, or automating dbt development, Cortex Code brings intelligent assistance that respects your governance and works within your constraints.
Our dbt example demonstrated just one capability. The real power emerges when you have this AI partner across your entire development workflow: from discovery to deployment, from optimization to automation.
Keyrus & Snowflake
As a Premier Snowflake Partner, we help organizations adopt Cortex Code and Cortex AI in a coordinated manner, ensuring that productivity gains do not outpace governance maturity. Our approach aligns platform engineering, FinOps monitoring, and AI enablement to create sustainable enterprise AI architectures within Snowflake.
What is Snowflake Cortex Code?
Snowflake Cortex Code is a context-aware AI agent built natively into the Snowflake platform. Unlike generic AI coding assistants, it understands your specific environment — including schemas, RBAC permissions, governance policies, and data relationships — to generate production-ready code through natural language prompts.
What is the difference between Cortex AI and Cortex Code?
through natural language prompts. Q2: What is the difference between Cortex AI and Cortex Code? Cortex AI applies AI and machine learning directly to your data through SQL functions (such as sentiment analysis or classification). Cortex Code is a development agent that helps you build data infrastructure — generating dbt pipelines, Airflow DAGs, and Streamlit apps. Cortex AI powers intelligence within your data; Cortex Code accelerates how you build on Snowflake.
How much does Snowflake Cortex Code cost?
Cortex Code pricing depends on the interface used. The Snowsight web interface is currently free, with users notified before any charges apply. The CLI uses token-based consumption billing, where costs scale with the complexity and length of tasks performed.
What permissions are required to use Cortex Code?
Users need two database roles granted by an ACCOUNTADMIN: SNOWFLAKE.COPILOT_USER (required for all users) and either SNOWFLAKE.CORTEX_USER or SNOWFLAKE.CORTEX_AGENT_USER. The CORTEX_AGENT_USER role is recommended for advanced agentic workflows.
Is Snowflake Cortex Code available on all Snowflake accounts?
Cortex Code is available on all commercial Snowflake accounts, but is not supported on Government, VPS, or Sovereign deployments. It also requires cross-region inferenc
