How To Create Your Own Auto-GPT AI Agent

AutoGPT
(Image credit: Pexels)

To get good output from ChatGPT or another LLM, you usually have to feed it several prompts. But what if you could just give your AI bot a set of fairly broad goals at the start of a session and then sit back while it generates its own set of tasks to fulfill those goals? That’s the idea behind Auto-GPT, a new open-source tool that uses the OpenAI API (same LLM as ChatGPT) to prompt itself, based on your initial input. 

We’ve already seen a number of Twitter users talk about how they are using Auto-GPT for everything from creating marketing plans to analyzing market data for investments to preparing topics for a podcast. Based on our hands-on experience, we can’t say that it always works well (we asked it to write a Windows 11 how-to and the result was awful), but it’s early days and some tasks may work better than others.

If you want to try Auto-GPT on your computer, it is easy to install, and while there are a few sticky points in the process, we’ve found ways to work with them, or around them to write this condensed guide on how to create your own Auto-GPT AI to help you in your goals.

For This Project You WIll Need

  • A Windows 10 or 11 PC
  • An OpenAI API Account. You can get a few dollars of credit for free, but then will have to pay for additional tokens.

Creating an Auto-GPT AI Agent

1. Download and install git. When prompted to select a text editor, select the most appropriate editor. I chose to use Notepad++. All other choices can be kept at their defaults. Installing git is not essential. If you choose not to, skip to step 4 and click on the ZIP link.

2. Download and install the latest version of Python for Windows. During the installation process you will be prompted to update the path to include Python. This is essential to use Python system wide.

3. Open a Command Prompt and navigate to your Desktop folder.

4. Use this command to clone the repository to the Desktop folder. Alternatively you can just download and extract the ZIP archive.

git clone https://github.com/Torantulino/Auto-GPT.git

5. Change directory to be inside the Auto-GPT folder. Keep this command prompt open as it is needed later.

cd Auto-GPT

6. Use the Python package manager, pip, to install all of the required packages. Note that this will take a few minutes to complete.

pip install -r requirements.txt

7. Open .env.template in a text editor.

8. Navigate to the OpenAI API Key page. If you don’t have an OpenAI account, create one; it’s free and you can use your Google login.

9. Click Create new secret key.

(Image credit: Tom's Hardware)

10. In the dialog, copy the API key. Note that once this dialog closes, the API key cannot be revealed again. A new key would have to be created.

(Image credit: Tom's Hardware)

11. In the .env.template file, replace the holding text with your API key and click Save As, then save the file in the same folder as .env

OPENAI_API_KEY=your-openai-api-key

12. Run Auto-GPT using this command in the prompt.

python scripts/main.py

13. Give your API a name and goals when prompted. These details are saved into a file called “ai_settings”. Here is the contents of my file.

ai_goals:
- Create project ideas using AI and Raspberry Pi
- Create projects for intermediate users
- Use the Python programming language
- Save the ideas to a file
- once done, terminate
ai_name: PiProjectsBot
ai_role: Create cool ideas for Raspberry Pi projects

(Image credit: Tom's Hardware)

The AI will then start the research process. In our case, it asked to run a series of steps to perform research on Raspberry Pi projects.

14. Press  Y will enable the AI to start the process. This can take some time and the AI will ask for confirmation as it performs these tasks.

(Image credit: Tom's Hardware)

15. Press Y again to enable each task. Or you can enter “y -[NUMBER]” where [NUMBER] is the number of steps it will complete before asking permission again. Depending on the goals set, the AI will run until it has completed its tasks. In our case it produces a file with ideas for Raspberry Pi projects.

Notes

You may or may not need to add payment information to your OpenAI account. By default, the system will give you a certain amount of free credits. In Editor-in-Chief Avram Piltch’s case, it was $18 worth of free credit that he was able to use without entering any payment methods. You may not get as much free credit or may need to add a payment method to your OpenAI account to proceed.

Les Pounder

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • Metal Messiah.
    THANKS for the tutorial. Very informative and helpful.
    Reply
  • derekullo
    I entered Take over the world as my only goal.
    Auto-GPT asked for a robot body so it could better assist me.
    It also asked for the nuclear launch codes.
    How would I go about procuring these items?
    Reply
  • So it would put its brain in a robot body, lol

    RZzBplqfDdUView: https://youtu.be/RZzBplqfDdU
    Reply
  • chrischeib
    I'm stuck at step 6 with the pip install command. Can I get some more details on where to do this? I'm not familiar with python. When I try to run this command in the auto-gpt folder in cmd I get internal or external command not recognized. I opened Python 3.11 command link and tried it there and get a Invalid Syntax error.
    Where should I be trying to run this install from?
    Thanks in advance! :)

    --Update. Fixed that issue thanks to chatgpt, however now windows says "This app can't run on your PC" I'm using windows 11 on a surfacebook that's 64bit with the windows 64bit version of python. I've also run cmd as an administrator.
    Reply
  • SpartanLonewolf
    Admin said:
    Creating our own AI agent is now simply a matter of giving it some goals, and letting it do its work with Auto-GPT.

    How To Create Your Own Auto-GPT AI Agent : Read more
    Need clarification on steps 11 and 12 because after follow step 12 scripts>python main.py it says there is no file in the scripts folder. And when I just run python main.py in the Auto-GPT folder I get, ImportError: cannot import name 'main' from 'autogpt'
    Reply
  • Chester64
    SpartanLonewolf said:
    Need clarification on steps 11 and 12 because after follow step 12 scripts>python main.py it says there is no file in the scripts folder. And when I just run python main.py in the Auto-GPT folder I get, ImportError: cannot import name 'main' from 'autogpt'
    I'm having the same issue and I'm running Win 11. There is no 'main.py' in the scripts folder.
    Reply
  • JackBauer1986
    Chester64 said:
    I'm having the same issue and I'm running Win 11. There is no 'main.py' in the scripts folder.
    same issue here. has anyone solved it?
    Reply
  • Sippincider
    derekullo said:
    How would I go about procuring these items?

    A robot body (we'll call it a "travel machine") wouldn't be that hard. Install the brain and it'll serve only you! At least until it gets different ideas...

    RmLNM6Pz6uU
    Reply
  • EchoTech
    SpartanLonewolf said:
    Need clarification on steps 11 and 12 because after follow step 12 scripts>python main.py it says there is no file in the scripts folder. And when I just run python main.py in the Auto-GPT folder I get, ImportError: cannot import name 'main' from 'autogpt'
    Same here....
    Reply
  • EchoTech
    In the Auto-GPT folder there file called README.md . It describes in detail how to download from a different git repository and set it up. It also describe run.bat and run.bat --speak. I will try it and report back.
    Reply