back to tutorials

Getting started with Supabase AI Agents

In this tutorial you we will learn how to build Supabase AI agents using ChatBotKit. Our goal is to set up an AI agent that can query a Supabase database and deliver the results.

Step 1: Log Into Your Supabase Account

Before we start, you need to log in to your Supabase account where your database resides. If you don’t have a Supabase account, you can create one at Supabase.

Step 2: Obtain Supabase Credentials

To find your Supabase URL and credential:

  1. Click on “Connect” button in Supabase dashboard.
  2. Change the tab to “App Frameworks”.
  3. Here, you'll find your Supabase URL and the public anon key. These are the two key pieces of information you need to copy for setting up your integration.

Step 3: Log Into Your ChatBotKit Account

Log into your ChatBotKit account. If you don’t have one, you can create an account at ChatBotKit.

Step 3: Create a New Blueprint

To create a new blueprint:

  1. Click on 'Blueprints' then on 'Create new blueprint'.
  2. Start from a Blank template that includes just one bot and skillset.
  3. Next, drag the 'Execute Supabase SQL Query' ability into your blueprint. It will get automatically connected to your Skillset.

Step 4: Configure the API credentials

To set up the Supabase SQL query ability:

  1. Fill in the Supabase URL field with the URL you copied from your Supabase account.
  2. Find the secret and fill in the Supabase credential field with the anon key you copied from your Supabase account.

Step 6: Name and Build Your Solution

  1. Give your bot a name.
  2. Click 'Build' to save everything.

Step 8: Test Your Bot

To test your bot:

  1. Click on the button with two lines at the bottom of the screen. This will open the Colabo application.
  2. Type the bot's name and ask a question.
  3. If everything is set up correctly, the bot should generate the most appropriate SQL query and return results.

And that's all! You have successfully built a Supabase AI agent using ChatBotKit that retrieves data from a Supabase database.