Expedition. Free, virtual, Nov 3–6.

Technical tracks for practitioners, outcomes for leaders.

Snowflake for Developers/Guides/Get Started with Snowflake CoCo CLI
Quickstart

Get Started with Snowflake CoCo CLI

Dash Desai

Overview

Snowflake CoCo is Snowflake's AI-powered coding agent. It is available in two interfaces: directly in Snowsight for web-based use, and as a command-line interface (CLI) for developers who prefer the terminal. This guide focuses on the CLI.

Snowflake CoCo CLI lets you query data, build applications, and manage Snowflake resources using plain English directly from your terminal. Behind the scenes it writes and runs SQL, orchestrates Snowflake-native skills, and connects to external tools through the Model Context Protocol (MCP).

In this guide you will install the CLI, connect it to a Snowflake account, and run a handful of queries to see what it can do.

What You'll Learn

  • How to install Snowflake CoCo CLI on macOS, Linux, or Windows
  • How to connect to a Snowflake account using browser-based SSO or a programmatic access token
  • How to ask natural-language questions and get SQL-backed answers
  • How to explore query results with the built-in table viewer
  • How to manage sessions so you can pause, resume, and restrict work

What You'll Build

A working Snowflake CoCo CLI environment connected to your Snowflake account, ready for day-to-day use.

Prerequisites

  • A paid Snowflake account, or sign up for a free Snowflake CoCo CLI trial
  • A terminal with bash, zsh, or fish (macOS / Linux) or PowerShell (Windows)
  • The SNOWFLAKE.CORTEX_USER or SNOWFLAKE.CORTEX_AGENT_USER database role. CORTEX_USER is granted to all users by default through the PUBLIC role, but your organization may have revoked it.

Note: Snowflake CoCo CLI is not available on standard Snowflake trial accounts (for example, accounts created at trial.snowflake.com). Use a paid account or the dedicated Snowflake CoCo CLI trial linked above.

Install the CLI

macOS and Linux (including WSL)

Open a terminal and run the installer:

curl -LsS https://ai.snowflake.com/static/cc-scripts/install.sh | sh

The script installs the cortex executable to ~/.local/bin and adds it to your PATH.

Tip: If the command fails because of custom options in your ~/.curlrc, add the -q flag so curl ignores that file: curl -qLsS https://ai.snowflake.com/static/cc-scripts/install.sh | sh

Windows (native)

Open PowerShell and run:

irm https://ai.snowflake.com/static/cc-scripts/install.ps1 | iex

The executable installs to %LOCALAPPDATA%\cortex and is added to your PATH automatically.

Verify the installation

cortex --version

You should see the installed version number printed to the terminal.

Connect to Snowflake

Launch Snowflake CoCo CLI by typing cortex in your terminal. A setup wizard walks you through connecting to Snowflake.

cortex

The wizard presents two options:

  • Use an existing connection -- If you already have connections defined in ~/.snowflake/connections.toml (for example from the Snowflake CLI), select one from the list and press Enter.
  • Create a new connection -- Select More options and follow the prompts to enter your account identifier, username, and authentication method.

Authentication methods

Snowflake CoCo CLI supports two authentication methods:

MethodWhen to use
Browser-based SSO (externalbrowser)Interactive use on a machine with a web browser
Programmatic access token (PAT)Headless environments or automation

You can generate a PAT from Snowsight or via SQL. See Using programmatic access tokens for authentication for details.

Verify the connection

Once connected, Snowflake CoCo CLI drops you into an interactive session. Type:

/status

This prints your active connection, role, warehouse, database, and schema.

Tip: Use /model to see the models available to your role or to switch the active model at any time. Besides specific models, you can pick Auto (Snowflake selects the model), Auto Intelligent (favors the most capable models), or Auto Efficient (optimizes for cost). To set the model for a single launch, pass --model, as in cortex --model auto. See Supported models for details.

Note: If your preferred model is not available in your region, an ACCOUNTADMIN can enable cross-region inference to access it from another region.

Run Your First Query

With the session running, type a plain-English question:

What databases do I have access to?

Snowflake CoCo CLI translates your request into SQL, runs it against Snowflake, and returns the results directly in the terminal.

More examples

Try a few more requests to get a feel for what is possible:

Show me the top 10 largest tables in my account by row count
Write a query for the 5 most recent orders and run it
Explain what the SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY view contains

Snowflake CoCo CLI displays its reasoning steps as it works. If it needs more information it will ask you a follow-up question.

Explore Results

Table viewer

When a query returns tabular data, press Ctrl+T to open the built-in table viewer. Inside the viewer you can scroll through results, cycle between tables with Tab, and press c to copy the query to your clipboard.

Direct SQL

You can also run SQL directly using the /sql slash command:

/sql SELECT CURRENT_ROLE(), CURRENT_WAREHOUSE(), CURRENT_DATABASE()

To limit the number of rows displayed:

/sql SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY --limit 50

Reference a table with

Prefix a fully qualified table name with # to pull its schema and sample rows into the conversation automatically:

Tell me about #SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY

Snowflake CoCo CLI fetches the column definitions and a sample of rows so it can answer questions about the table without you having to describe it.

Manage Sessions

Every conversation is saved automatically. You can pick up exactly where you left off.

Resume a session

/resume

This opens a list of previous sessions. Select one and press Enter, or use cortex --continue when launching to jump straight into the most recent session.

Start fresh

/new

Rename the current session

/rename my-first-session

Rewind

Made a wrong turn? Roll back to an earlier point in the conversation:

/rewind

Fork

Want to try a different approach without losing your current progress? Fork the session:

/fork

This creates a new session branched from the current point.

Restrict a session

To limit what Snowflake CoCo CLI can do in the current session, for example read-only access or only specific roles, apply a Restricted Session Scope:

/guardrails

Select Restrict this session, then apply an existing scope or choose read-only access. Run /guardrails status to see the active restriction. You can also apply a named scope at launch:

cortex --with-restricted-session-scope=READONLY_PM

Once a restriction is active you can switch to another scope, but you can't remove or relax it in the current session. Start a new session to run without it.

Conclusion And Resources

Congratulations! You've successfully installed Snowflake CoCo CLI, connected it to your Snowflake account, and run your first natural-language queries from the terminal.

From here you can:

  • Explore all slash commands with /help
  • Enable plan mode (/plan) to review and approve each action before it runs
  • Connect MCP servers for external tools like Slack, GitHub, Jira, and more
  • Add custom skills to tailor the assistant to your workflow
  • Schedule repeating tasks with CoCo automations
  • Run tools in a Snowflake-managed cloud sandbox with cortex --cloud

What You Learned

  • How to install Snowflake CoCo CLI on any supported platform
  • How to connect to Snowflake using SSO or a programmatic access token
  • How to ask natural-language questions and run SQL from the terminal
  • How to explore query results with the table viewer and # table references
  • How to manage, resume, fork, rewind, and restrict sessions

Related Resources

Documentation:

Guides:

Additional Reading:

Updated Oct 19, 2026

This content is provided as is, and is not maintained on an ongoing basis. It may be out of date with current Snowflake instances