Cortex Agents for Slack¶
Introduction¶
Snowflake for Slack brings Cortex Agents into your workspace so teams can ask questions in natural language and get answers from Snowflake data without leaving Slack.
- CoWork — Query structured data through pre-built Cortex Agents. Get tables, charts, and narrative answers in direct messages and channels.
- CoCo (Cortex Code) — Run deeper, multi-step analysis with AI-powered investigation, SQL exploration, and generated reports.
For the per-user setup, each person signs in as their own Snowflake user, and requests run as that user, including that user’s masking and row access policies. An administrator can limit the primary role and the secondary roles those requests use. See Limit the roles Slack can use. In a multiplayer channel, requests instead run as the channel’s bound service user. For more information, see multiplayer channels in Cortex Agents for Slack.
Important
When you use this integration, you are directing Snowflake to send or receive data between the Snowflake Service and Slack. Snowflake is not responsible for the privacy, security, or integrity of data once it leaves the Snowflake Service boundary. Your use of Slack, and any data you process with it, is governed solely by the terms between you and Slack.
AI-generated content
AI can make mistakes. CoWork and CoCo are powered by large language models (LLMs). AI-generated responses — including text, SQL, tables, charts, and generated reports — may be inaccurate, incomplete, inappropriate, or biased. Review and verify outputs before relying on them, and apply human oversight to any decisions based on them.
For more information, see the Legal notices at the bottom of this page.
Install¶
Before you install, make sure that you have the following:
- A Snowflake account that is enabled for this preview. To request access, contact your Snowflake account team.
- A role with the
CREATE INTEGRATIONprivilege. The ACCOUNTADMIN role has this privilege by default. - Permission to add apps to your Slack workspace. If your workspace restricts app installation, a Slack workspace administrator must approve the request before the app is available.
- A default Cortex Code (CoCo) settings agent configured for the account. Before you change account-level settings for
the Slack integration, create the
CORTEX_CODE.CONFIG.DEFAULTagent. For instructions, see Configure default model settings.
Important
Snowsight is the only supported way to install the app. The Snowsight flow is what links your Slack workspace to your Snowflake account, so don’t start the installation from Slack. If you install the app from Slack, it isn’t connected to your Snowflake account.
To install the app from Snowsight, do the following:
- Sign in to Snowsight.
- Select Settings » Account » Agent settings » Integrations.
- On the Snowflake AI for Slack tile, select Connect to Slack Workspace. Slack opens an authorization window.
- In the authorization window, confirm the Slack workspace that is selected in the dropdown at the upper right, then select Allow.
Important
If you belong to more than one Slack workspace, the authorization window might preselect a workspace other than the one you want. Check the workspace in the dropdown before you select Allow. If you authorize the wrong workspace, repeat the installation and select the correct workspace.
After you install¶
The integration owner grants the USAGE privilege on the integration to each role that needs access to the app:
Until a user’s role has this privilege, that user can’t use the app from Slack.
Each user then does the following:
- Open a direct message with Snowflake in Slack.
- Select Authenticate with Snowflake and sign in to your Snowflake account.
- Ask a question in plain language, or
@mentionthe app in a channel to ask a question there.
Limit the roles Slack can use¶
A direct message or a personal @mention runs as the Snowflake user who authenticated. The session’s primary
role is that user’s default role. Secondary roles follow that user’s default secondary roles
(DEFAULT_SECONDARY_ROLES).
A multiplayer channel runs only as the bound role, with secondary roles disabled.
You can limit the primary role, and you can choose how secondary roles are set, on the SNOWFLAKE_SLACK_APP
security integration. Store the limits in ACCESS_CONFIGURATION. This control isn’t enabled for all accounts
yet. On an account where it isn’t enabled, Snowflake rejects ACCESS_CONFIGURATION. To request access,
contact your Snowflake account team.
Secondary roles¶
Set USE_SECONDARY_ROLES inside ACCESS_CONFIGURATION to one of these values:
NONE: the Slack session has no secondary roles. The request can use only the privileges of the primary role.IMPLICIT: secondary roles follow the user’sDEFAULT_SECONDARY_ROLES.
ALL isn’t valid on the integration. To activate every role granted to the user, leave USE_SECONDARY_ROLES
unset and set the account parameter instead:
SLACK_INGRESS_SECONDARY_ROLE_MODE accepts NONE, IMPLICIT, and ALL. Its default is IMPLICIT.
Snowflake uses it when USE_SECONDARY_ROLES isn’t set on the integration. When USE_SECONDARY_ROLES is
set, that value overrides the account parameter.
A multiplayer channel keeps secondary roles disabled. USE_SECONDARY_ROLES applies to direct messages and
personal @mentions.
To run personal Slack sessions with no secondary roles:
To follow each user’s default secondary roles:
Primary role¶
ALLOWED_PRIMARY_ROLES is the list of primary roles Slack may use. Each name must be an existing role. An
unknown name fails the statement.
Slack uses the user’s default primary role. In a multiplayer channel, Slack uses the bound role. A role in
ALLOWED_PRIMARY_ROLES is used only when it is that default role or that bound role. If the default role or
the bound role is outside the list:
- A direct message or personal
@mentionis refused. Slack tells the user that their Snowflake role doesn’t have access to this Slack integration. The same message appears when the role is missingUSAGEon the integration. - A multiplayer channel whose bound role is outside the list can’t answer.
The role that runs the request still needs USAGE on SNOWFLAKE_SLACK_APP.
Omit ALLOWED_PRIMARY_ROLES, or set it to an empty list, to leave the primary role unrestricted.
Replace ANALYST with a role that exists in your account. You can list more than one role. Setting
ALLOWED_PRIMARY_ROLES keeps a USE_SECONDARY_ROLES value that’s already stored. To set both in one
statement:
To clear only the primary-role list:
To remove ACCESS_CONFIGURATION and return secondary roles to SLACK_INGRESS_SECONDARY_ROLE_MODE:
DESC SECURITY INTEGRATION SNOWFLAKE_SLACK_APP shows the stored ACCESS_CONFIGURATION.
How it works in Slack¶
The following sections describe the main workflows after installation, with screenshots for each.
Ask CoCo in a direct message¶
Ask questions in a DM to run CoCo (Cortex Code) for deeper analysis, including charts and multi-step reasoning over your Snowflake data.
Each message that you send in the DM starts its own conversation. To continue a line of questioning, reply in the thread that the app creates under your message rather than sending a new message in the DM.
Because CoCo can run tools on your behalf, it asks for your approval before it takes an action such as running a shell command. Approve the individual action, or choose to allow that tool for the rest of the session.
Use CoWork in a channel¶
@mention the app in a channel or thread to run CoWork Cortex Agents against your Snowflake data.
The answer is visible only to you, so an @mention in a busy channel doesn’t post results to everyone. To make an
answer visible to the channel, select Share in thread. You can also select the option to continue the conversation
in a DM with the app, which moves your follow-up questions out of the channel.
Manage settings¶
To open settings, send a DM to the app, then select the overflow menu (…) on any of its answers and select Settings. In settings, you can choose your default run mode (CoCo or CoWork), manage connected Snowflake accounts, and adjust preferences.
Multiplayer channels¶
An administrator can bind a Slack channel to a Snowflake service user and a CoCo agent, so that every member of the
channel can @mention the app without being a Snowflake user in your account. For more information, see
multiplayer channels in Cortex Agents for Slack.
Slack activity in your account¶
Every request that the app sends to Cortex Agents records where in Slack it came from. Use these records to tie monitoring data and conversation threads back to a Slack workspace, channel, thread, and user. The records contain Slack IDs, not message text.
Slack metadata in monitoring events¶
Each agent request from Slack writes a CORTEX_AGENT_REQUEST event to SNOWFLAKE.LOCAL.AI_OBSERVABILITY_EVENTS. The
event’s VALUE column holds the Slack details as a JSON string under the
snow.ai.observability.client_metadata key. The following query reads them:
The querying role needs access to the event table. For the access model, see AI_OBSERVABILITY_EVENTS table and Query Cortex Agent logs with SQL.
The slack_bot object has the following fields:
| Field | Description |
|---|---|
conversation.team_id | ID of the Slack workspace. |
conversation.channel_id | ID of the Slack conversation that the answer belongs to: a DM, a channel, or a private channel. |
conversation.thread_ts | Timestamp of the Slack thread that the answer belongs to. |
conversation.channel_type | Slack’s channel type for the triggering message (im, channel, group, or mpim). Omitted when Slack doesn’t send one, for example for an @mention. |
trigger.source | What started the request: event for a Slack message or @mention, interaction_resume when a button click resumes a request (for example an approval), or dm_task for a background task in a DM. |
trigger.event_type | Slack event type of the triggering message: message or app_mention. |
trigger.message_ts | Timestamp of the Slack message that started the request. |
trigger.actor.user_id | ID of the Slack user who sent that message. |
execution.run_kind | Where the request ran: dm_tool or dm for a DM, mention for an @mention in a channel, tag for a multiplayer channel, or dm_worker for a background task started from a DM. |
execution.continuation | none, or interaction_resume when the request continues after an approval or other interaction. |
One Slack message can lead to several agent requests, for example when CoCo calls a tool and then answers. Each of those requests writes its own event, and every event carries the same Slack metadata.
Direct message:
@mention in a channel: when the app continues the conversation in your DM, conversation identifies that DM
thread rather than the channel.
@mention in a multiplayer channel: the request runs as the channel’s service user, and
trigger.actor.user_id identifies the Slack user who mentioned the app.
The RESOURCE_ATTRIBUTES column of each event identifies the Snowflake user and role that the request ran as.
Slack metadata on conversation threads¶
The first message in a Slack thread creates a Cortex Agents conversation thread. Later messages in the same Slack thread
continue it. The app creates the conversation thread with origin_application set to slack_bot and stores the Slack
location in the thread’s metadata. To read a thread, use the Threads API.
Only the Snowflake user that the thread belongs to can read it: the connected user for a DM or @mention, or the
service user for a multiplayer channel.
| Field | Description |
|---|---|
metadata.slack.team_id | ID of the Slack workspace. |
metadata.slack.channel_id | ID of the Slack conversation: a DM, a channel, or a private channel. |
metadata.slack.thread_ts | Timestamp of the Slack thread. |
metadata.restricted_session_scope | Restricted session scope that the thread’s requests run under. Present only for multiplayer channels whose binding sets one. |
The app writes this metadata when it creates the thread and doesn’t update it afterward. The thread’s thread_id
matches snow.ai.observability.agent.thread_id in the monitoring events for the same conversation.
Limitations¶
During the preview, the integration has the following limitations:
- No outbound internet access. CoCo runs in a sandbox that can’t reach the public internet, so it can’t clone an external repository or fetch a page or package from the web. To give CoCo code or other files to work with, upload them to your Snowflake workspace, or paste the contents into your message.
- Answers in channels are per-user. When you
@mentionthe app in a channel, only you see the answer until you select Share in thread. A thread doesn’t yet act as a shared session where every member can continue the same conversation. - One Snowflake account per Slack workspace. A Slack workspace can connect to only one Snowflake account.
Troubleshooting¶
Settings fail to save¶
When you save account-level Slack settings in Snowsight, the save can fail. Snowsight reports that it could not save the settings. This happens when the account doesn’t have a default Cortex Code (CoCo) settings agent.
Before you change those settings, create the CORTEX_CODE.CONFIG.DEFAULT agent, then try again. For instructions, see
Configure default model settings.
Support and privacy¶
- Support: Snowflake Support
- Privacy policy: Snowflake Privacy Policy
For questions about this integration, contact your Snowflake account team or Snowflake Support.
Related documentation¶
Legal notices¶
Where your configuration of Cortex Code uses a model provided on the Model and Service Pass-Through Terms, your use of that model is further subject to the terms for that model on that page.
The data classification of inputs and outputs are as set forth in the following table.
| Input data classification | Output data classification | Designation |
|---|---|---|
| Usage Data | Customer Data | Covered AI Features [1] |
For additional information, refer to Snowflake AI and ML.