Enable Slack-native analytics from structured and unstructured data with Cortex Agents
This hands-on lab shows you how to build a natural-language agent in Slack using Snowflake Cortex. You'll create a solution that analyzes structured CRM-style data and unstructured meeting transcripts—delivering fast, auditable insights directly in Slack, without writing SQL.
You’ll build a Python Slack bot that dynamically decides whether to run SQL, search a transcript, or summarize meeting outcomes—all using Snowflake-native capabilities.
By the end of this hands-on lab, you'll build a Cortex Agent that:
- Understands natural language questions
- Retrieves the right insights using Cortex Search and Cortex Analyst
- Delivers clear, auditable answers from Snowflake
This lab walks through a 3-phase agent orchestration flow:
- Load mock CRM-style data into Snowflake
- Define a semantic model with synonyms, filters, metrics, and joins
- Set up Slack integration for natural-language querying
- Run verified queries and see SQL + answers in Slack
- Upload mock meeting transcripts (PDFs) to a Snowflake stage
- Parse and chunk content using
PARSE_DOCUMENT+SPLIT_TEXT_RECURSIVE_CHARACTER - Analyze with Cortex Complete: extract sentiment, risk, next steps, key phrases
- Add transcript facts to the semantic model + verify queries across both data types
- Enable Dynamic Literal Retrieval for smarter question matching
- Deploy a Python-based Slack agent that:
- Selects the right tool (Search, Analyst, or both)
- Generates SQL, runs it, and summarizes results
- Handles ambiguity and open-ended questions
- Run the agent locally
| Path | Purpose |
|---|---|
notebooks/ |
Phase 1 & 2 setup notebooks |
data/ |
Mock CRM SQL DDL + six PDF transcripts |
semantic-model/ |
data_agent_semantic_model.yaml (P1) • data_agent_semantic_model2.yaml (P2) |
scripts/ |
slackapp.py Lightweight bot for Phases 1-2 • slackapp_agent.py Final Cortex Agent (Phase 3) |
config/ |
check_deps.py to verify Python packages • app_manifest.json Slack-app manifest • dataagent.env.sample template for Snowflake / Slack creds |
ℹ️ This repo ships mock data & code only. Internal Snowflake grading (DORA-xx) and Seismic links remain on the private enablement portal.
- Snowflake account with Cortex features enabled and warehouse with USAGE & OPERATE on Cortex
- Python 3.10+ environment
- Slack workspace with admin privileges
- Basic understanding of SQL and Python
- Clone
- Create & activate venv
- pip install -r requirements.txt
- Configure .env
- Load data & create model via notebook
- Run agent.py
![[HOL Workflow]](/sfc-gh-DShaw98/Cortex-Retrieval-Agent-Lab-for-Slack/raw/main/image/OverallFlow.jpg)