Lang.ai Native Snowflake application provides AI agents for product managers that leverage your existing Snowflake data (unstructured and structured data) to serve meaningful product recommendations —with context— directly in Slack.

This quickstart is a guide to installing and running your first Lang AI agent for data analysis in your own Snowflake infrastructure.

Snowflake and Lang logos

Prerequisites

What You'll Learn

What You'll Need

What You'll Build

In this step we will be creating a sample database and a sample view. We will be using this data in the following steps to create our first AI agent.

Sign in to your Snowflake account and create a new SQL Worksheet.

Creating a new SQL Worksheet

To start, copy the SQL Script and paste it into the SQL Worksheet, then click on the Run All button to execute the script.

Running the script

This script will:

After the script has successfully executed, you will see a LANG_AI_DEMO database with the following tables and one view:

Database created

The view created by the script already includes the required fields to create AI agents:

In this example, we are creating a simple view with the fields id, text, creation_date, user_id, and Customer_Spend.

The last column Customer_Spend is not mandatory, but it is included as we will configure the agent to use it to group the insights by the customer monthly spending.

You may include additional columns that may be used by the AI agent to aggregate the insights generated.

Log in to Snowsight as an ACCOUNTADMIN and follow these steps to install the Lang.ai Native App:

1. Install the application

Go to Data Products > Private Sharing > Shared With You and click on Get to install the app.

Once installed, click on the name of the application to open the app.

2. Grant privileges

Click Grant to grant the application the necessary privileges:

Account-level Privileges

Grant Account Level Privileges

Give access to the Snowflake View

Share data with your AI Agents by creating and sharing access to a view. Learn more here.

-- Customize if needed
SET LANGAI_APP_NAME = 'LANGAI_APP';

--- Give the application access to the view  
GRANT USAGE ON DATABASE "lang_ai_demo" TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);

GRANT USAGE ON SCHEMA "PUBLIC" TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);

GRANT SELECT ON VIEW "zoom_cancellations" TO APPLICATION IDENTIFIER($LANGAI_APP_NAME);

3. Launch the app

Click Activate to activate the application.

Navigate back to the Data Products > Apps page and wait for the spinner in the INSTALLED column to stop running. When it's done you'll see "1 minute ago" in that column. Then click Launch App to start the application.

Learn to run your fist AI agent on top of Snowflake data.

Select Your Goal

Begin by selecting the goal you want to achieve with your AI agent.

Select Your Goal

Select Your AI Agent

Choose the AI agent that aligns with your goal. Once selected, you will be prompted to choose the attributes that will be used to segment the insights. For example, selecting "subscription plan" will ensure insights are generated with this in mind, helping the AI agent identify patterns relevant to your business objectives.

Select Your AI Agent

Run Your AI Agent for the First Time

After completing the setup and creating your first agent, you're ready to run it for the first time.

To manually run your agent, click on Run Agent. The demo data has comments from July 2024, so make sure to select the entire month.

Run Your AI Agent

Navigate Your Agent Insights

Once the agent has finished processing, click on table to see the generated insights. In the insights view, you can navigate through the data by sorting and searching.

Navigate Your Agent Insights

Review the Data Associated with the Insights

To view the unstructured text that was analyzed to generate an insight, simply click on the specific insight.

Additionally, you have the option to download the data from your active filters by clicking on Download CSV.

Review Data Associated with Insights

By following this guide, you have successfully set up an AI Agent running on Snowflake to automate your data analysis tasks.

Related Resources

What You Learned