What is Cortex Code?

Cortex Code is Snowflake’s autonomous, agent-driven AI assistant that plans, executes, and validates complex, multi step engineering workflows directly within the Snowflake environment. It goes far beyond basic code suggestions – Cortex Code writes, runs, tests, and iterates on workflows end to end until a complete, functioning solution is delivered.
The key architectural distinction: Cortex Code doesn’t just generate code – it executes it, validates the output, it operates on failures, and delivers working artifacts. It can read your files, write SQL and Python, run DBT commands, build notebooks, create Streamlit apps, manage Git operations, and query your account metadata – all within a single conversational session.

Architecture at a glance:

Key architectural properties

  • Session-scoped RBAC: Every action respects the user’s active role. Cortex Code cannot escalate privileges or access objects outside the session’s grants.
  • Agentic loop: Plan → execute → validate → iterate. The agent self-corrects on compilation errors, test failures, and logical issues.
  • Platform-native execution: All compute – including LLM inference, RAG retrieval, embedding, and SQL execution – runs inside Snowflake. No data leaves the platform boundary.
  • Workspace-native: Full read/write access to workspace files (SQL, Python, YAML, Notebooks, Markdown), with diff view for change review.

Agentic workflow

Core capabilities

Snowflake‑Native Intelligence and deep context awareness

Unlike generic coding assistants, Cortex Code is architected with first‑class awareness of Snowflake’s metadata, compute model, governance constructs, and operational semantics.

It understands:

  • Databases, schemas, tables, and semantic models
  • User roles, privileges, and resource configurations
  • Session context and UI position within Snowsight
  • Conversational history and task progression

This embedded knowledge allows Cortex Code to interpret natural language instructions with high semantic accuracy, generating SQL, Python, DBT models, governance policies, or agent workflows that are structurally aligned with Snowflake’s architecture and compliant with the user’s RBAC permissions.

Secure-by-design execution model

Cortex Code inherits the Snowflake identity and RBAC of the invoking user.
Every operation – whether reading metadata, creating pipelines, writing SQL, or deploying agents – executes within the exact permissions granted to that user.

Key governance design pillars include:

  • CORTEX_USER and COPILOT_USER roles for controlled access
  • Permission modes (Confirm, Plan, Bypass) that dictate operational risk posture
  • Model RBAC, enabling fine-grained allowlisting of models at account level
  • Sandboxed local execution, isolating filesystem and bash operations
  • Hooks for pre/post‑execution policy enforcement that cannot be bypassed
  • Managed settings that give IT control over configuration, history, model usage, connection profiles, and CLI behavior

These mechanisms enforce a zero‑trust operational pattern, ensuring high governance fidelity for regulated and enterprise environments.

AI‑accelerated development across the full data and AI lifecycle

Cortex Code is designed to accelerate the end‑to‑end Snowflake development ecosystem, supporting all major personas – from data engineers and solution architects to ML practitioners and app developers.

It streamlines:

  • Data engineering: Automatic pipeline creation (DBT, Dynamic Tables, Openflow CDC), SQL optimization, lineage analysis, debugging, and refactoring.
  • Machine learning and data science: Feature engineering, model training, deployment workflows, and ML evaluation directly within Snowflake.
  • AI and agents: Building semantic views, scaffolding Cortex Agents, optimizing agent guardrails, and generating synthetic data.
  • Governance and security: Automated masking and row‑access policies, PII classification, audit analysis, and compliance readiness.
  • Application development: End‑to‑end support for Streamlit apps, React/Next.js applications, and Snowpark‑powered microservices.

This makes Cortex Code a single unified interface for planning, generating, and deploying production‑ready assets across multiple disciplines.

Extensible skill architecture for domain-specific automation

At the core of Cortex Code’s extensibility is its skill framework – modular, declarative capabilities that encode domain expertise into reusable blueprints.

Each skill injects:

  • Domain-specific instructions
  • Best‑practice workflows
  • Tooling configurations
  • Validation patterns
  • Automation logic

Snowflake provides a wide range of bundled skills, spanning:

  • ML and AI
  • Data engineering
  • Migrations
  • Governance
  • Cost management
  • App development
  • Developer tooling

Partners can also build proprietary skills, transforming their delivery methodologies into scalable, repeatable assets. This enables firms to shift from manpower‑driven services to IP‑led, outcome‑based engagements, improving margins and reducing time‑to‑delivery.

Architecture for efficiency and performance

Cortex Code has been benchmarked for execution efficiency.

Its architecture emphasizes:

  • Targeted exploration rather than exhaustive scanning
  • An SQL‑native execution model that minimizes OS‑level operations
  • Fewer file reads, fewer bash commands, and reduced I/O overhead

This results in significant improvements in execution speed compared to generic coding agents, making it optimized for Snowflake‑centric workloads.

Multi-interface access for flexible development

Cortex Code can be used in:

  • Snowsight (web) for SQL, admin tasks, ML, and data exploration
  • CLI (local) for full‑stack development including repos, DBT, pipelines, and app scaffolding

Both interfaces are deeply integrated with Snowflake metadata, ensuring seamless transitions between ideation, development, and deployment.

Extensibility and external integrations

Cortex Code is architected for extensibility, enabling it to operate far beyond Snowflake while retaining secure, governed execution. It integrates with a rich ecosystem of external tools, allowing data teams to automate complex, cross‑system workflows.

  • Browser automation (Playwright via Cortex Browser): Automates UI-driven tasks such as logging into SaaS apps, retrieving reports, or navigating web consoles.
  • Web search and URL fetching: Pulls live information, documentation, and external context to enrich analysis and code generation.
  • DBT project exploration (DBT): Understands and modifies DBT models, tests, macros, and structures to accelerate analytics engineering.
  • Data diff for table comparisons: Performs automated dataset comparison for migrations, validation, and regression testing.
  • MCP protocol support: Connects securely to third‑party tool servers (e.g., GitHub, Jira, Confluence) and partner-built skills, extending Cortex Code into broader enterprise ecosystems.

Together, these capabilities extend Cortex Code’s reach beyond Snowflake – enabling teams to automate web tasks, validate data across environments, integrate external knowledge, and orchestrate end‑to‑end workflows with a single intelligent agent.

Practical use cases

DBT pipeline optimization

The problem: Complex data pipelines with 100+ models. Slow runs, silent cost accumulation, no visibility into bottlenecks.

What Cortex Code did: Analyzed the DBT dependency graph and runtime data, identified the slowest models, recommended specific optimizations (materialization changes, incremental strategies, join elimination), and packaged the workflow as a reusable Cortex Code skill for the team to invoke on future projects.

Result: Pipeline runtime dropped from 10 hours to under 2 hours. The optimization workflow is now a repeatable skill any team member can invoke.

Prompt: “Analyze our DBT project, identify the slowest-running models, suggest specific optimizations, and flag unused downstream models we could drop.”

RAG-powered data modeling assistant

The problem: Data modeling best practices were scattered across tribal knowledge and unread PDF reference guides. Onboarding new team members took months because there was no single, queryable source of truth.

What Cortex Code did: It built a complete RAG-based data modeling assistant as a React UI app hosted on Snowpark container services. The app uses Cortex PARSE_DOCUMENT to ingest data modeling PDFs, chunks and embeds them with snowflake-arctic-embed-m into a vector knowledge base, then uses vector cosine similarity search to retrieve relevant context for each question. Answers are generated by Mistral Large 2 and grounded in the uploaded reference material – covering dimensional modeling (star/snowflake schemas, fact tables, SCDs 1–6, bus matrices) and ER modeling (normalization, cardinality, referential).

Result: The team now gets instant, reference-grounded answers to modeling questions instead of interrupting senior engineers or guessing. Onboarding time for new data engineers dropped significantly because they can upload the team’s reference PDFs and ask the assistant directly. Design review debates are resolved faster since answers cite the actual source material.

Prompt: “Build a Streamlit app that lets users upload data modeling PDFs, indexes them into a vector knowledge base using Cortex, and provides a RAG-grounded chat interface.”

ECB credit risk reporting dashboard

The problem: Quarterly ECB regulatory reporting involved pulling together dozens of risk metrics – loan staging, concentration analysis, credit model back testing, and data quality scoring – a process that consumed weeks of manual effort each cycle.

What Cortex Code did: Built a seven-page Streamlit dashboard covering portfolio quality, IFRS 9 and staging, concentrations and CCR, data quality and RDARR, underwriting, agent observability, and admin and governance. Queries structured Snowflake schemas with zero data egress.

Result: Two to three weeks of manual reporting replaced with on-demand, live dashboards. Concentration limit breaches trigger automatic warnings.

Prompt: “Build an ECB-compliant credit risk reporting dashboard in Streamlit covering portfolio quality, IFRS 9, concentration risk, RDARR scoring, underwriting metrics, and admin pages.”

House View GPT – Private banking pre-review engine

The problem: Relationship managers spend hours preparing client review packs – pulling portfolio data, computing attribution, cross-referencing house view research, and drafting compliant commentary.

What Cortex Code did: It built a Cortex agent on Snowflake Intelligence covering the full pre-review workflow: (1) portfolio data explorer showing positions, benchmark weights, and cash balances with sector composition charts, (2) Brinson-Fachler attribution engine that decomposes active return into allocation, selection, and interaction effects by sector – all computed via Snowflake views, (3) House View GPT chat powered by Cortex Search (RAG) over the bank’s internal research documents and Cortex Complete (Mistral Large 2) that answers RM questions grounded in both live attribution data and house view context, and (4) commentary generator that auto-drafts compliant client review commentary with built-in compliance checking (prohibited phrases, mandatory disclaimers) and export to text/markdown. Every LLM interaction is logged to an audit table with prompt hashes and token estimates.

Result: Client review preparation dropped from an afternoon to minutes. AI-generated commentary includes automatic compliance checking. Full audit trail of every LLM interaction is generated.

Prompt: “Build a Streamlit app for private banking with portfolio attribution, RAG-powered Q&A over house view documents, and compliant commentary generation.”

HIPAA compliance framework

The problem: Healthcare organizations need comprehensive data governance – classification, masking, row-level security, role hierarchies, audit trails, and continuous compliance monitoring.

What Cortex Code did: Produced a deployable governance framework: a five-role hierarchy, automated sensitivity classification, dynamic masking and row access policies, audit views with anomaly detection, and a six-tab Streamlit compliance dashboard – all generated and tested in a single session.

Result: Complete HIPAA-ready governance deployed from a single session. Masking, row-level security, classification, audit monitoring, and compliance reporting – all operational.

Prompt: “Build a complete HIPAA compliance framework with data classification, dynamic masking, row access policies, role hierarchy, audit monitoring, and a Streamlit compliance dashboard.”

Why this matters for architects

The shift from tool to teammate

DimensionTraditional CopilotCortex Code
ScopeSingle-file suggestionsMulti-file, multi-step workflows
ExecutionGenerates code for you to runPlans, executes, validates, iterates
ContextCurrent file + cursor positionMoves beyond generic code completion to provide data-native insights and actions
PersistenceNoneAGENTS.md + skills for project memory
Platform awarenessGeneric language modelDeep Snowflake-native: roles, grants, policies, Cortex functions
GovernanceN/AOperates within RBAC, no data movement outside Snowflake or governed/secured data. Data stays within Snowflake, audit-compatible

 Key design principles and benefits or strategic advantages

  • Rapid prototyping with production guardrails: Go from whiteboard to working Streamlit dashboard in a single session, with proper RBAC, masking, and audit trails baked in from day one.
  • Democratized data engineering: A business analyst can describe what they need in plain English. Cortex Code handles the DBT project scaffolding, SQL generation, testing, and documentation.
  • Governance-first AI: Every Cortex Code action respects your role. Masking policies apply to the agent’s queries just as they would to a human user.
  • Reusable institutional knowledge: Skills capture your team’s best workflows as code. An optimization pattern discovered once becomes a repeatable, one-command workflow.
  • Consolidation of the AI stack: RAG, LLM inference, document parsing, embeddings, classification, and app serving – all within the Snowflake boundary. No external API keys, no data movement.

The platform is your IDE. The agent is your engineering partner. Your job is the architecture.