Making Sonnet 5 the CoCo default

Cortex Code's model default? Turns out it's just a CREATE AGENT statement away.

Share
Making Sonnet 5 the CoCo default

TL/DR: Sonnet 5 is now the account-wide default model in CoCo. Setting it took a few SQL statements.


This is a really short one: I went looking for an option to not have ❄️ Snowflake automatically select the most capable (aka most expensive) model for CoCo. One, I find it quite annoying to always select a cheaper model from the dropdown (particularly in Snowsight where I forget it all the time), and two, I can't other users expect to even be aware of the cost factor at all. Then I stumbled upon this:

Configure default model settings | Snowflake Documentation
How Snowflake account administrators can configure a default model for all Cortex Code users in an account.

So I need a CORTEX_CODE database on my account, expecting a provisioning request to Snowflake support... at least that's what the docs implied. Turns out it's completely self-service: a database, a schema, and an agent object.

It's just a database

CORTEX_CODE wasn't provisioned yet on my account. No ticket needed though, CREATE DATABASE works like it does for any other object.

use role accountadmin;

create database if not exists cortex_code;
grant usage on database cortex_code to role public;

create schema if not exists cortex_code.config;
grant usage on schema cortex_code.config to role public;

Setting the default model

CoCo's default model lives on an agent object, cortex_code.config.default, specified the same way any Cortex Agent is: a YAML block passed to CREATE AGENT ... FROM SPECIFICATION.

create or replace agent cortex_code.config.default
from specification
$$
models:
  orchestration: claude-sonnet-5
$$;

grant usage on agent cortex_code.config.default to role public;

Settings are read at session startup, so the verification is just opening a fresh CoCo chat: the model selector lands on Sonnet 5 without anyone touching a dropdown now 🥳

Not quite sure if this could also set the default to "Auto Efficient" as that option is not GA as of this writing.

Changing the default later is the same statement with alter instead of create or replace:

alter agent cortex_code.config.default
from specification
$$
models:
  orchestration: <model_name>
$$;