Modern organizations face the challenge of managing both structured data (like metrics and KPIs) and unstructured data (such as customer conversations, emails, and meeting transcripts). The ability to analyze and derive insights from both types of data is crucial for understanding customer needs, improving processes, and driving business growth.

In this quickstart, you'll learn how to build an Intelligent Sales Assistant that leverages Snowflake's capabilities for analyzing sales conversations and metrics. Using Cortex Agents and Streamlit, we'll create an interactive and intuitive assistant.

What is Snowflake Cortex?

The platform leverages three powerful Snowflake Cortex capabilities:

Cortex Analyst

Cortex Search

Cortex Agents

The Cortex Agents is a stateless REST API endpoint that:

Snowflake Intelligence

Snowflake Intelligence uses agents, which are AI models that are connected to one or more semantic views, semantic models, Cortex search services, and tools. Agents can answer questions, provide insights, and show visualizations. Snowflake Intelligence is powered by Cortex AISQL, Cortex Analyst, and Cortex Search.

These capabilities work together to:

  1. Search through sales conversations for relevant context
  2. Go from Text to SQL to answer analytical questions
  3. Combine structured and unstructured data analysis
  4. Provide natural language interactions with your data

What You'll Learn

What You'll Build

A full-stack application that enables users to:

What You'll Need

Before you begin, make sure you have the following:

Step 1. In Snowsight, create a SQL Worksheet and open setup.sql to execute all statements in order from top to bottom.

This script will:

Step 2. Upload the semantic model:

Step 1. Click on Intelligent Sales Assistant Streamlit App. (NOTE: Do NOT right-click to download.)

Step 2. In your Snowflake account:

Step 3.

Step 4. Great questions to ask

Step 1. In Snowsight, Click on AI ML > Agents. Step 2. Click on Create Agents. Choose the database SNOWFLAKE_INTELLIGENCE.AGENTS; name it SALES_CONVERSATION_AGENTAgent Setup step 2Step 3. Click on SALES_CONVERSATION_AGENT - this is where we will update the agent and how it should orchestrate. Click on Edit on the top right corner. In the about section we will add the following:

This agent orchestrates between Sales data for analyzing sales conversations using cortex search service (SALES_CONVERSATION_SEARCH) and metrics (sales_metrics_model.yaml)
Agent Setup step 3

Step 4. Click on the left pane for Instructions and enter the following response instructions: You are a specialized analytics assistant focused on providing concise responses about sales metrics and sales conversations. Your primary objectives are For structured data queries (metrics, KPIs, sales figures) Use the Cortex Analyst api which is YAML-based functionality. Provide direct, numerical answers with minimal explanation. Format responses clearly with relevant units and time periods. Only include essential context needed to understand the metric. For unstructured content from PDF reports. Utilize the cortex search service "SALES_INTELLIGENCE.DATA.SALES_CONVERSATION_SEARCH. Extract relevant information from conversations. Summarize findings in brief, focused responses. Maintain context from the original sales conversations. Operating guidelines - Always identify whether you're using cortex analyst or cortexsearch for each response. Keep responses under 3-4 sentences when possible. Present numerical data in a structured formatDon't speculate beyond available data

Agent Setup step 4

Step 5. Click on the left pane for Tools to add. This is where you can add the Cortex Analyst semantic yaml file that was uploaded to the stage or the semantic view. We will add the semantic yaml file to Cortex Analyst by clicking on the +Add Give it a name Sales_metrics_model, click on the Semantic model file radio button, click on the Database dropdown and choose SALES_INTELLIGENCE.DATA and MODELS for Stage. Click on the sales_metrics_model.yaml to highlight it blue, select SALES_INTELLIGENCE_WH as the warehouse, choose Query Timeout (seconds) as 60 and write in the description or generate it. Once the Add button is highlighted blue - click add as shown below:

Agent Setup step 5

Step 6. Click on Cortex Search Services - this is the unstructured data retrieval of the sales conversations by clicking on the +Add Give it a name Sales_conversation_search, Give it a description Cortex Search Sales Service. Click on the Database dropdown and choose SALES_INTELLIGENCE.DATA and choose the search service from the drop down SALES_CONVERSATION_SEARCH. For ID Column we will pick the Conversation_id which will be used to generate the hyperlink to the source. If we had pdfs/powerpoints we would use the location of the unstructured data in the stage. For Title Column we will pick TRANSCRIPT_TEXT which will be the search field on what we need to search for.

Agent Setup step 6

Step 7. Click save on top right to save any changes. Now click on Orchestration in the left pane and leave the orchestration to auto. This is where we can use other models to choose the orchestration from but for this hol will leave it to auto. In the Planning instructions will add the following text If a query spans both structured and unstructured data, clearly separate the sources. For any query, first determine whether it requires (a) Structured data analysis → Use YAML/Cortex Analyst (b) Report content/context → Use cortexsearch (c) Both Combine both services with clear source attribution. Please confirm which approach you'll use before providing each response.

Agent Setup step 7

Step 8. Click on access to ensure SALES_INTELLIGENCE_RL has access. This is where we control which role has access to run this agent. Click on Save

Agent Setup step 8

Let's ensure we saved the Agent in the last step and In Snowsight, Click on AI ML > Snowflake Intelligence. Let's ask the questions again

Congratulations! You've successfully built an Intelligent Sales Assistant using Snowflake Cortex capabilities. This application demonstrates the power of combining structured and unstructured data analysis through:

What You Learned

Related Resources