-
Couldn't load subscription status.
- Fork 13
Supabase guide #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supabase guide #169
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| --- | ||
| title: Using Supabase with Hypermode | ||
| sidebarTitle: Supabase | ||
| description: | ||
| Connect your Hypermode agent to Supabase for real-time database operations | ||
| --- | ||
|
|
||
| <div className="flex items-center gap-3 mb-6"> | ||
| <img | ||
| src="/images/agents/connections/icons/supabase.svg" | ||
| alt="Supabase" | ||
| width={48} | ||
| height={48} | ||
| /> | ||
| <div> | ||
| <h2 className="text-2xl font-bold m-0">Supabase</h2> | ||
| <p className="text-gray-600 m-0"> | ||
| Supabase is the PostgresSQL development platform. | ||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| ## Overview | ||
|
|
||
| In this document you will learn how to connect your Hypermode agent to Supabase, | ||
| enabling real-time database operations and interactions. | ||
|
|
||
| Bwfore getting started you need to make an account with supabase, you can do | ||
|
Check failure on line 28 in agents/connections/supabase.mdx
|
||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| that here: [Supabase](https://supabase.com/) | ||
|
|
||
|  | ||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Then you need to make a database and go to the settings to make a new API key. | ||
|
|
||
|  | ||
|
|
||
| This key will become the service key when you connect using Hypermode Agents and | ||
| the subdomain will be the projeect id in the URL: | ||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Examples: https://supabase.com/dashboard/project/my-project-id/settings/api-keys | ||
|
|
||
| Subdomain ID: my-project-id Service Key: --key-from-supabase-- | ||
|
Check failure on line 42 in agents/connections/supabase.mdx
|
||
|
|
||
| Now you have got all you need setup with supabase we can now make our agent in | ||
| hypermode. | ||
|
|
||
| Creating your supabase agent. | ||
|
|
||
| Firslty ensure you have signed up and created a workspace on | ||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [Hypermode](https://hypermode.com/). | ||
|
|
||
| Now frmo the threads interfaces, lets manually create a new agent to streamline | ||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| the process. | ||
|
|
||
| You can create agets with either conciege or manually, we will do this manually, | ||
|
Check failure on line 55 in agents/connections/supabase.mdx
|
||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| from the UI find the create agent dropdown: ]\ | ||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|  | ||
|
|
||
| Then select the "Create new Agent" option, this will open a modal to create your | ||
| agent: | ||
|
|
||
|  | ||
|
|
||
| To streanline this process we will use the following settings: | ||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Agent Name: SupaAgent Agent Title: Connects to Supabase Description: SupaAgent | ||
|
Check failure on line 67 in agents/connections/supabase.mdx
|
||
| issues queries Instructions: You have a connection to Supabase and various other | ||
| developer tools to streamline data access and awareness. Model: GPT 4.1 | ||
|
|
||
| Once created you will see the agent in the sidebar living and breathing ready to | ||
| interact with, take yourself to the agents setting page via the agents icon and | ||
| see the profile: | ||
|
|
||
|  | ||
|
|
||
| Now navgiate to the connections tab, this is where we will add our supabase | ||
|
Check failure on line 77 in agents/connections/supabase.mdx
|
||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| connection. | ||
|
|
||
|  | ||
|
|
||
| This is where we need to add our supabase connection, click the dropdown and | ||
| select "Supabase" from the list, then you will be presented with a Modal, from | ||
| here we should take the Domain ID and Service Key we created earlier and paste | ||
| them into the relevant fields: | ||
|
|
||
|  | ||
|
|
||
| Great now you Agent is connected to Supabase, you can now use it to issue | ||
| queries and interact with your database. | ||
|
|
||
| You can learn more about this supabase connector here: | ||
| https://mcp.pipedream.com/app/supabase | ||
|
|
||
| <Note> | ||
| The supabase connector does not let you modify the schema, for this reason | ||
|
Check failure on line 96 in agents/connections/supabase.mdx
|
||
| lets manually create the schema for interaction. | ||
| </Note> | ||
|
|
||
| Lets migrate our database with some movie data, to do this we will need to | ||
| navigate back to the supabase workspace and find the query editor, this is where | ||
| we can run SQL queries to create our schema and insert data, here is the schema | ||
| we will work with: | ||
|
|
||
| ```sql | ||
| -- 1. Movies Table | ||
| CREATE TABLE IF NOT EXISTS public."Movies" ( | ||
| id SERIAL PRIMARY KEY, | ||
| title VARCHAR(255) NOT NULL, | ||
| year INTEGER | ||
| ); | ||
|
|
||
| -- 2. Actors Table | ||
| CREATE TABLE IF NOT EXISTS public."Actors" ( | ||
| id SERIAL PRIMARY KEY, | ||
| name VARCHAR(255) NOT NULL | ||
| ); | ||
|
|
||
| -- 3. MovieActors Join Table | ||
| CREATE TABLE IF NOT EXISTS public."MovieActors" ( | ||
| movie_id INTEGER NOT NULL REFERENCES public."Movies"(id) ON DELETE CASCADE, | ||
| actor_id INTEGER NOT NULL REFERENCES public."Actors"(id) ON DELETE CASCADE, | ||
| PRIMARY KEY (movie_id, actor_id) | ||
| ); | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
|  | ||
|
|
||
| <Note> | ||
| The supabase connector does not let you modify the schema, for this reason | ||
|
Check failure on line 132 in agents/connections/supabase.mdx
|
||
| lets manually create the schema for interaction - you can ask your Agent to | ||
| help you build the schema. | ||
| </Note> | ||
|
|
||
| Finnaly one last step before our agent can understand our db we need to modify | ||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| the system prompt of the agent to include the schema, you can do this by copying | ||
| the schema and navigtaing the the agents page pasting in the schema into the | ||
|
Check failure on line 139 in agents/connections/supabase.mdx
|
||
johnymontana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| system prompt, this will allow the agent to understand the schema and issue | ||
| queries against it. | ||
|
|
||
|  | ||
|
|
||
| Now we are ready to work with our agent and ou supabase database. | ||
|
Check failure on line 145 in agents/connections/supabase.mdx
|
||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Testing the connection, its always best to test the connection first, lets ask | ||
| it to fetch a list of Movies, note we will have empty mooives but you are | ||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| looking for success tool call in the chat history. | ||
|
|
||
| Try asking in a new thread: | ||
|
|
||
| ```text | ||
| Can you list the movies ? | ||
| ``` | ||
|
|
||
| You will see the Supabase select row tool call in the chat history, this is a | ||
| good sign that the connection is working and the agent can issue queries against | ||
| the database. | ||
|
|
||
|  | ||
|
|
||
| Now we have all we need to start inserting movies and actors in our database. | ||
|
|
||
| Adding a movie: | ||
|
|
||
| Try asking in a new thread: | ||
|
|
||
| ```text | ||
| Can you Add the Matrix 1999 and Neo the actor into my Supabase database? | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
| Thats it your connected, try adding more data, scheming a new schema and reading | ||
| the data in your instace, finally supabase can be paird well with other | ||
|
Check failure on line 176 in agents/connections/supabase.mdx
|
||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| connections such as Gthub and Slack and Stripe. | ||
danstarns marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.