Technology attributes
Other attributes
BabyAGI is an open-source AI-driven system for task management that utilizes OpenAI and Pinecone APIs to create, prioritize, and execute tasks. BabyAGI creates tasks based on predefined objectives from the outcome of a previous task. Written in Python, the BabyAGI script uses OpenAI's NLP capabilities to create new tasks, vector databases (such as Chroma and Weaviate) to store the results of a specific task and retrieve context, and the LangChain framework to handle the decision-making process.
BabyAGI was developed by Yohei Nakajima, a venture capitalist who was working on a script to help him automate some of his day-to-day tasks, such as researching technologies and companies. Nakajima realized his code had applications beyond his own needs. So, he stripped the code down to its bare essentials and shared it on GitHub. On March 28, 2023, Nakajima published a paper titled "Task-driven Autonomous Agent Utilizing GPT-4, Pinecone, and LangChain for Diverse Applications" on his website, describing the processes behind BabyAGI. On March 29, 2023, he tweeted a thread introducing BabyAGI.
The full script contains 140 lines consisting of 13 comments, 22 blanks, and 105 lines of code. BabyAGI has become the foundation for a number of projects with developers creating their own specialized agents, including a Slack implementation and AgentGPT, a tool for assembling and deploying autonomous AI agents in a browser. BabyAGI supports all OpenAI models and Llama as well as its variation.
The BabyAGI script runs an infinite loop of the following steps:
- Pulling the first task from the task list
- Sending the task to the execution agent (which uses OpenAI’s API to complete the task based on the context)
- Enriching the result and storing it in Chroma/Weaviate
- Creating new tasks and reprioritizing the task list based on the objective and the result of the previous task
The execution_agent() function uses the OpenAI API. It takes two parameters—the objective and the task—then sends a prompt to OpenAI’s API, which returns the result of the task. The prompt consists of a description of the AI system’s task, the objective, and the task itself. The result is returned as a string.
The task_creation_agent() function uses OpenAI’s API to create new tasks based on the objective and the result of the previous task. It takes four parameters—the objective, the result of the previous task, the task description, and the current task list—then sends a prompt to OpenAI’s API returning a list of new tasks as strings. The function finally returns the new tasks as a list of dictionaries, where each dictionary contains the name of the task.
The prioritization_agent() function uses OpenAI’s API to reprioritize the task list. The function takes one parameter, the ID of the current task. It sends a prompt to OpenAI’s API, which returns the reprioritized task list as a numbered list.
The final stage uses Chroma/Weaviate to store and retrieve task results for context. The script creates a Chroma/Weaviate collection along with the task name and any additional metadata.
Upon its announcement, Nakajima described a series of future improvements to BabyAGI:
- Integrating a security/safety agent
- Task sequencing and parallel tasks
- Generating interim milestones
- Incorporating real-time priority updates