Baby AGI: The Birth of a Fully Autonomous AI
Introducing the new fully autonomous task manager that can create, track and prioritize your company's projects using artificial intelligence.
Image by Author
Task management is a very important element to every business. It is used in marketing pipelines, to tech and fashion. It is the process of monitoring tasks in a project from start to finish.
With the continuous boom of artificial intelligence, we are seeing more applications get released that can help specific processes such as task management.Â
What is Baby AGI?
Baby AGI is a python script which uses OpenAI and Pinecone APIs, and the LangChain framework to create, organize, prioritize as well as the executing of tasks. The process behind Baby AGI is that it will create a task using predefined objectives that are based on the outcome out a previous task.
This is achieved by using OpenAI’s natural language processing (NLP) capabilities, which allows the system to create new tasks based on objectives. It uses Pinecone to store the results of that specific task and retrieve context, and the LangChain framework to handle the decision making process.Â
For example, you put out an objective to the system and the system will continuously prioritize the tasks that need to be achieved or completed in order to meet the objective. Once these tasks are completed, they will be stored in the memory.
The system runs on an infinite loop and is executed using 4 steps:
- The first task is pulled from the task list
- The task is sent to the execution agent and completes the task, based on context using OpenAI API
- The result is stored into Pinecone
- New tasks are created and prioritized based on the objective and the result of the previous task.Â
Execution Agent
execution_agent
The execution agent, which is the core of the system which utilizes OpenAI’s API to process the tasks. The function takes two parameters: the objective and the task which is used to send a prompt to OpenAI's API. This in turn will return the result of the task as a string.Â
Task Creation Agent
task_creation_agent()
The task creation agent function uses OpenAI’s API to create new tasks based on current objects and the outcome of previous tasks. The function takes four parameters: objective, outcome of the previous task, task description, and the current task list.Â
A prompt is then sent to OpenAI’s API which will return a list of new tasks as strings. The function will then return these new tasks as a list of dictionaries, where each dictionary contains the name of the task.
Prioritization Agent
prioritization_agent()
The last step is the ordering and prioritization of the list of tasks. This is where the prioritization agent function gets involved and uses OpenAI’s API to reprioritize the task list. The function takes one parameter which is the ID of the current task. It will then send a prompt to OpenAI's API and return the new task list which has been reprioritized as a numbered list.
Image by Yohei (Creator of Baby AGI)
The above flow shows how the Baby AGI system works. It is based on the above three agents we discussed: execution, creation and prioritization.Â
You start off the task based on the objective that you have, and then move onto the query which takes context from the memory. This then sends it to the creation agent, which takes the data and sends it to the memory. It will then go through a queue which goes through the prioritization of tasks.Â
Baby AGI has the ability to complete tasks, generate new tasks based on previous results, and prioritize tasks in real-time. This system is exploring and demonstrating to us the potential of large language models, such as GPT and how it can autonomously perform tasks.
How to Use Baby AGI?
These are the following steps to use Baby AGI:
- First you will need to clone the repository via git clone https://github.com/yoheinakajima/babyagi.git and cd into the cloned repository.
- The second step includes installing the required packages: pip install -r requirements.txt
- The third step is to copy the .env.example file to .env: cp .env.example .env. This is where you will set the required variables.
- The fourth step is to set your API keys in their respective variables, such as OpenAI in OPENAI_API_KEY and OPENAPI_API_MODEL, and Pinecone in the PINECONE_API_KEY variable.
- The fifth step is to set the Pinecone environment in the PINECONE_ENVIRONMENT variable.
- The sixth step is to set the name of the table in the TABLE_NAME variable. This is where the task results will be stored.
- If you already have an objective, you can set the objective of the task management system in the OBJECTIVE variable. (Optional)
- If you already have your first task, you can set this in the INITIAL_TASK variable. (Optional)
- Run the script.
Baby AGI is a task management system, therefore the script has been designed to continuously run. This can result in high API usage, memory and funding. Monitoring the system's behavior as well as ensuring the application is effective is important.Â
Future of Baby AGI
Yohei (the creator of BabyAGI) stated that they have plans for future improvements in the system, which include an integrated security/safety agent, parallel tasks, and more.
The image below defines these future plans:
Image by Yohei (Creator of Baby AGI)
Wrapping it up
Autonomous AI alone can provide assistance with menial tasks for example data entry, project management, and more. This will allow employees to focus more on tasks that require more time and energy, and not have to worry about the smaller tasks that can be done using systems such as Baby AGI.
If you would like to see a walk through of the installation and testing of Baby AGI, have a look at this video by Matthew Berman: NEW BabyAGI
Nisha Arya is a Data Scientist, Freelance Technical Writer and Community Manager at KDnuggets. She is particularly interested in providing Data Science career advice or tutorials and theory based knowledge around Data Science. She also wishes to explore the different ways Artificial Intelligence is/can benefit the longevity of human life. A keen learner, seeking to broaden her tech knowledge and writing skills, whilst helping guide others.