SuperAGI Tutorial: How to Get Started with SuperAGI

Friday, August 18, 2023 by goldzulu382
SuperAGI Tutorial: How to Get Started with SuperAGI

Introduction

I'm sure many of you have used chatbots in one way or another like OpenAI's ChatGPT, Microsoft's Bing or Google's Bard. However most chatbots are designed to be good in handling one task or query at a time often through back and forth conversations.

There are times however, when you need your bot to do a set of complex tasks such as conducting research on a particular topic and then send you a summary of the findings. This is where the term "autonomous agents" come into play. Autonomous agents are basically chatbots on steroids that thrive at performing multi steps operations to achieve a particular goal that you set by giving them an objective. You may have heard of various autonomous agents such as AutoGPT, BabyAGI and as per our current focus, SuperAGI.

SuperAGI however is not just an autonomous agent, it goes beyond that by being a framework that allows you to build, manage and run multiple autonomous agents. You can extend an agent capabilities with tools. It is open sourced meaning that the source code is accessible by anyone to use. The agents efficiently perform a variety of tasks and continually improve their performance with each subsequent run.

In this tutorial, we will be looking at how to get started with SuperAGI and how to build your first autonomous agent. Specifically, we will build an autonomous agent that will be able to find some information on the internet, summarize the findings and send you an email with the summary.

Prerequisites

Before we get started, you will need to have the following:

  • a GitHub account - Github is a code hosting platform. It is where for instance, SuperAGI source code is hosted. You can sign up for a free account here. This will be used later to create an account on SuperAGI Cloud.

  • an OpenAI API key - OpenAI is a company that develops AI models. SuperAGI uses OpenAI's API to generate text. You can sign up for a free account here. Follow the instructions and get yourself verified and the account created. Once you have signed up, you will need to obtain an API key which is a string of numbers and characters. You can do this by clicking your profile icon at the top-right corner of the page once you have logged in and and select "View API Keys."

OpenAI View API Keys
OpenAI View API Keys

Click "Create New Secret Key" to generate a new API key. Make sure you keep this API key safe as anyone who has the API Key can use your account.

OpenAI Create API Keys
OpenAI Create API Keys
  • a Google App Password - This is not the same as your Gmail password. SuperAGI Cloud can send and read emails on your behalf. To do this, you will need to create an app password for your Gmail account. You can do this by logging in to https://myaccount.google.com using the same google account used for your Gmail account. Select "Security" on the left side of the page. Scroll down to "How you sign in to Google" and select "2 Step Verification" (Make sure it is turned on). Select "App Passwords." You will be prompted to enter your password again. Once you have done that, select "Mail" and "Other" from the drop down menu. Enter "SuperAGI" in the text box and click "Generate." You will be given a 16 character password. Make sure you keep this password safe as anyone who has the password can access your Gmail account.
Google App Password
Google App Password

Also you need to make sure that you have enabled IMAP in your Gmail account. To do this, go to your Gmail account settings and select "Forwarding and POP/IMAP" tab. Under IMAP Access, select "Enable IMAP" and click "Save Changes."

Google Gmail IMAP
Google Gmail IMAP

Important: The App Password is NOT the same password as your Gmail account password. You will need to use a personal gmail account to obtain the App Password. You cannot use a G Suite account in a straight forward way hence it is beyond the scope of this tutorial. If you do not have a personal gmail account, you can create one here.

Let's get Started

There are several ways in which you can use SuperAGI. But two of the most popular way at the moment is by using a program called Docker or by using a web app made available by the SuperAGI team called SuperAGI Cloud. As this is an introductory tutorial, using Docker might be a bit too complicated for many of you. Hence, let's use SuperAGI Cloud instead.

Step 1 - Create you SuperAGI Cloud Account

Once you have all the prerequisites, you can now create your SuperAGI Cloud account. To do this, go to SuperAGI Cloud and click "Try SuperAGI Cloud" at the top-right corner of the page. You will be prompted to log in using your GitHub account.

SuperAGI Cloud
SuperAGI Cloud

Step 2 - Enter your OpenAI API Key and Gmail Account Details

Once in, you will need to go to Settings by clicking on the gear icon at the top right-hand corner besides your profile picture. Enter your OpenAI API Key.

OpenAI API Key
OpenAI API Key

You will then need to enter your Gmail account and the App Password detail you created earlier. This is done by clicking the Toolkits icon on the left hand side and selecting Email Toolkit from the list of toolkits. You will then be shown the Email Toolking configuration form.

Gmail Configuration
Gmail Configuration

Fill up with the following detail:

  • Email Smtp Port : 587
  • Email Signature : (Just type whatever your sign off message is e.g. Regards, Bill)
  • Email Imap Server: imap.gmail.com
  • Email Draft Mode : FALSE
  • Email Address: YOUR GMAIL ADDRESS
  • Email Smtp Host : smtp.gmail.com
  • Email Draft Folder: Drafts
  • Email Password: YOUR GOOGLE APP PASSWORD

Step 3 - Creating Your Agent

Great! Now that your SuperAGI account is all up and running, let's create your first agent. To do this, click on the Agents icon on the left hand side and select "Create Agent" from the list of options.

Agent Templates
Agent Templates

There are multiple ways to create agents. You can build them from scratch or you can use a template from the marketplace. For this tutorial, we will create a very simple one from scratch so you know what is going on behind the scenes.

Go ahead now and press the button "Build From Scratch".

Build From Scratch
Build From Scratch

You will see a Create new agent form.

Fill in the following details:

  • Name : GoodNewsAgent
  • Description: Search the internet for one good news, summarize it and send it to me.
  • Goals: Search for one good news from reputable news site (click +Add to enter the next line) Send the headlines to [email protected]
  • Instructions: (Leave blank for now)
  • Model: (leave it as gpt-3.5-turbo)
  • Tools: SearxSearch, Send Email (delete everything else such as read file and write file that is not related)

Leave Advanced Options as it is.

So basically what you have done above is give a set of goals for the autonomous agent to reach. You also have specified what tools it can use - SearxSearch which is a tool to search the internet and Send Email which will allow the agent to send an Email. Once it has accomplished those goals, it will exit itself after running the last task that it needs to do. In this case, this happens after sending the email with the headline.

Step 4 - Running Your Agent

Now for the moment of truth! Let's run your agent. To do this, click the button Create and Run to run immediately. In the future, it might be worthwhile noting that you can schedule the run at a later time, either as a once off or as on a recurring basis. E.g. you might want good news delivered to you every day in the morning before breakfast! That will brighten up you day for sure!

In any case, it is still usually better to just do a simple "Create and Run" first to test that everything is running fine. You can always schedule the run later.

Create and Schedule
Create and Schedule

So go ahead now and click the Create and Run button if not already.

Create and Run
Create and Run

You will be taken to the Activity Feed where you can see in real-time what the agent is thinking about and doing! How cool is that!

It will take a bit of time for the run to be completed. At any point of time, you can click the three dots button beside the New Run button to Pause, Delete the run, Edit or Delete the Agent.

Agent Control
Agent Control

With luck, the run should be completed successfully and you should have a new email in your inbox with a good news. If not, you can always go back to the Activity Feed and see what went wrong. Be patient, sometimes it takes a bit of time to refine the agent to get it to work properly. Also bear in mind that SuperAGI is still an early stage product and there are bound to be some bugs here and there. If you do encounter any bugs, you can always report them to the SuperAGI team!

Conclusion

Congratulations! There! You got this! You have now successfully completed the tutorial and created your very own autonomous agent using SuperAGI and hopefully learn a thing or two about autonomous agents!

Hope you find this tutorial useful. Love to hear your feedback!

Should you have any questions, feel free to reach out to me on Twitter or in LabLab AI Discord Server.

Written by goldzulu for lablab.ai tutorials.