Pro · Lesson 12 of 13
AISQL functions, Cortex Search, Cortex Analyst, and Cortex Agents, with region and preview limits.
Sign in to save your place.
Cortex is a specialist sitting next to the warehouse. AISQL functions are sticky notes you can call from SQL, such as summarize this review. Cortex Search is a librarian for unstructured text. Cortex Analyst writes SQL from a question, using a semantic model you curate so it does not guess your column names. An agent is a coordinator that can ask the analyst and the librarian, then answer. None of them are available just because the account exists.
Snowflake Cortex AI Functions are SQL functions, also callable from Python, for tasks such as completing a prompt, summarizing, translating, sentiment, and embeddings. The AISQL page says they are available in select regions. Functions that are not marked Preview are generally available. Preview functions are Preview AI Features. Check each function before you put it in a pipeline.
The role needs the USE AI FUNCTIONS privilege and a database role such as CORTEX_USER or AI_FUNCTIONS_USER. The docs say the functions are built for throughput over many rows. For one interactive call, Snowflake points you at the REST API instead.
AI features bill AI Credits, which are separate from Platform Credits and do not follow the same edition discount. Warehouses, storage, and data transfer stay on Platform Credits. Read the current consumption table. Do not reuse an example price from the docs as your contract price.
SELECT SNOWFLAKE.CORTEX.SENTIMENT('The load finished and the dashboard matched.');
Cortex Search is a managed search service over text you already store in Snowflake. The edition matrix lists it for every edition, and the service still has to be available in your region. A search service has a target lag because it refreshes an index. It is not a result cache.
Cortex Analyst answers natural-language questions about structured data through a REST API. You give it a semantic model so table and column meaning is explicit. Snowflake's Analyst page says to move applications to Cortex Agents, which include Analyst's abilities. Analyst is natively available in a short region list that includes AWS us-east-1, us-west-2, eu-central-1, eu-west-1, ap-northeast-1, ap-southeast-2, AWS US East Commercial Gov, Azure East US 2, and Azure West Europe. Other regions need cross-region inference, which you turn on. The docs suggest AWS US regions when you have a choice.
Cortex Agents became generally available on 4 November 2025. An agent plans a task, calls tools, and answers. The documented tools include Cortex Analyst for structured data and Cortex Search for unstructured data. Agents are still subject to region availability and to the privileges above.
Analytical search is a separate agent capability for questions that need counts or trends across many documents. It is off unless you set it on that agent. The analytical-search page is the availability note to read before you enable it. Do not describe it as generally available unless that page currently says so.
If a function or an agent call fails with a region error, the lesson is the error. Cross-region inference is the documented switch for several Cortex features. It sends the request to a region where the model exists. Turn it on only if that data movement is allowed for the table you are querying.
A function without a Preview label can be used in production. A function, region, or agent option that the docs still mark as preview can change or disappear. This course will not list a model name as the one you should fine-tune. Model menus move.
Run a model on each row, search documents, or let an agent choose which of those to use.
Step 1 of 3AI SQL functions such as AI_CLASSIFY run a model on each row straight from SQL. You pay for the tokens processed.
SELECT AI_CLASSIFY(ticket_text, ['billing', 'bug', 'other']) FROM tickets;
Step 2 of 3Cortex Search builds an index over a text column and keeps it refreshed, so an app can fetch the most relevant passages for a question.
CREATE CORTEX SEARCH SERVICE docs_search ON chunk
WAREHOUSE = wh TARGET_LAG = '1 hour'
AS SELECT chunk FROM doc_chunks;
Step 3 of 3A Cortex Agent reads the question and picks a tool: Cortex Analyst for numbers in tables, Cortex Search for answers in documents.
“What was revenue last month?” → Cortex Analyst · “What is our refund policy?” → Cortex Search
Run this only after the role can use AI functions. If Snowflake returns a region or privilege error, stop. That is a real result. Do not route the column to another region until you know the data is allowed to move. There is nothing to install with pip for this statement.
USE WAREHOUSE LEARN_WH;
SELECT SNOWFLAKE.CORTEX.SENTIMENT(
'The warehouse suspended and the trial balance survived.'
) AS mood;
Checked against Snowflake documentation in October 2026. Product behavior still depends on your edition, cloud, and region.