How to Install and Use the BabyAGI Autonomous AI Agent

The next big thing in generative AI is autonomous agents (bots) that take a given objective and use it to generate their own set of prompts. Instead of asking a chatbot to go through 10 different steps that lead to a business plan or a series of articles, just ask the end result and let the software figure out how to get there.
BabyAGI is one of the most popular of this new autonomous agent, although it is still in the experimental stage (much like current generative AI). If you feed it just an object and one initial task, it will try to do the rest.
Developed by developer Yohei Nakashima, Share on Github, the Python-powered tool runs on your PC, but uses OpenAI’s API and GPT 3.5 or GPT 4 models to do the actual “thinking”. Note that OpenAI’s API is priced per “token” (approximately 5 characters of data unit). You can get $18 in credits for free with OpenAI, but if you’re serious about AI, you’ll end up spending money. BabyAGI also requires a free account with Pinecone, a vector database server that stores AI output.
In my experience with BabyAGI, the results were interesting, but not always practical. Also, he has to manually stop the script by pressing CTRL+C when he thinks it’s done. This is because if you leave it to your own device, new tasks will be spawned forever (and you’ll end up doing API bili).
For example, I asked BabyAGI to generate a list of five tutorials on popular Windows topics, and I ended up repeating some of the same topics over and over again. One known bug is that BabyAGI doesn’t seem to follow its task list, changing task 1 multiple times without reaching task 2.
Despite its current limitations, BabyAGI is an interesting technology worth experimenting with. Below are instructions on how to install and use BabyAGI on your PC (the same steps may work on macOS or Linux).We also publish articles about How to install and use Auto-GPTanother popular autonomous agent.
How to set up and use BabyAGI
1. Install Python and Git If you haven’t installed it yet. The latest versions of programming languages can be downloaded from: python.org Also, if you are using Windows, Git for Windows (almost certainly on Linux). Make sure the Python and Python Scripts directories are in your Windows path. To do this, search for “environment variables” in Windows and click to edit the path variables.
2. Get your OpenAI API key If you don’t already have one.You can get it by going to OpenAI’s API key pagelog in to create a free account,[Create new secret key]Click the button. You will then be given the chance to copy the key, which you will never get again (although you can create a new one).
3. Get an API key from PineconePinecone is a vector database for storing AI data. There may be a waiting list, but you can get a free account.[API キー]Click the tab to copy button or[API キーの作成]Click to get your API key. Also note the “environment” location (eg us-central1-gcp).
Four. open command prompt Or (on Linux) go to a terminal window and navigate to the folder where BabyAGI is installed.
Five. Clone BabyAGI Enter the following command:
git clone https://github.com/yoheinakajima/babyagi
A new directory called babyagi will be created under the current directory.
6. enter the babyagi directory and Install required dependencies using pip.
cd babyagi
pip install -r requirements.txt
7. Copy the file .env.example to a new file named .env
copy .env.example .env
8. open .env for editing in a text editor such as notepad
9. Enter your OpenAI API key, Pinecone API key, and Pinecone environment variables. in the right place. Do not enclose the key in quotation marks.
Ten. Make option changes.
- Change the API_MODEL field If you want to use gpt-4 instead of the default gpt-3.5-turbo. GPT 4 may provide better results, but incurs higher API costs.
- Set TABLE_NAME Or leave the default baby-agi-test-table . This is the table name used in Pinecone.
- Change BABY_NAME If you want to name this instance something other than BabyAGI
11. Set OBJECTIVE and INITIAL_TASK. Do not enclose them in quotation marks. But use natural language. The goal should be something you want to achieve and INITIAL_TASK should be the first task to start. Subsequent tasks are planned by BabyAGI and cannot be specified.
12. save the .env file and exit.
13. input python babyagi.py Run it in a command prompt from within the babyagi directory.
python babyagi.py
14. see the output and Press CTRL+C Stop when you want the program to end.
Don’t walk away and leave BabyAGI running, as it can incur huge OpenAI API bills as it doesn’t stop itself, at least in the current version and implementation I’ve tried.