Automation6 min read

BabyAGI: The Task-Driven Agent Loop and What Replaced It

How the original BabyAGI loop created, ranked and ran its own tasks, where that code lives now, how to run it, and what the current BabyAGI repo is instead.

By AI Agents DirectoryLast checked
Abstract illustration of artificial intelligence

BabyAGI is the open-source script that showed a language model managing its own to-do list: it took an objective, worked through a task, wrote new tasks from the result, reordered the queue and repeated. People still search for it under that description, but the repository at github.com/yoheinakajima/babyagi no longer contains that script. This post explains what the original loop did, where its code lives today, how to run it, and what the current BabyAGI project is.

Where BabyAGI stands today

The top of the current README is direct about the change. It says the March 2023 BabyAGI “introduced task planning as a method for developing autonomous agents” and that this version has been moved to a separate babyagi_archive repo, described as a September 2024 snapshot. The archive’s own README adds that all issues and commits were closed at that point.

What sits in the main repo now is a new, experimental framework that the author describes as a “self-building autonomous agent”. It also carries a caution that it is meant for experienced developers to experiment with and is not intended for production.

Original BabyAGI (archive)Current BabyAGI
Repoyoheinakajima/babyagi_archiveyoheinakajima/babyagi
Core ideaLoop that creates, prioritises and executes tasksfunctionz: functions stored in and run from a database
Entry pointpython babyagi.pypip install babyagi, then a web dashboard
MemoryChroma or Weaviate for task resultsDatabase of functions plus execution logs
Licence (GitHub API)MITNone reported

How the original task loop worked

The archived README calls the script an example of an AI-driven task management system. You give it an objective and a first task. From there it runs an endless cycle of four steps:

  1. Take the task at the front of the list.
  2. Pass it to an execution agent, which calls the OpenAI API with the objective, the task and relevant context.
  3. Enrich the result and save it to a vector store (Chroma or Weaviate in the archived version).
  4. Generate new tasks from that result and reorder the whole list against the objective.

Three functions do the language-model work:

  • execution_agent() receives the objective and the task, builds a prompt describing the system’s job, and returns the model’s answer as a string.
  • task_creation_agent() receives the objective, the last result, that task’s description and the current list. It asks the model for follow-up tasks and returns them as a list of dictionaries, each holding a task name.
  • prioritization_agent() takes only the current task’s ID. It asks the model to return the remaining tasks as a reordered, numbered list.

The vector store is the loop’s memory. The script creates a collection named after the TABLE_NAME setting and writes each result into it together with the task name and metadata, so later tasks can pull in earlier findings as context.

The appeal was size. The README’s backstory section says the script was cut down from a “Task-Driven Autonomous Agent” the author posted on Twitter on 28 March 2023, and that the repo version is 140 lines long, of which 105 are code. It also notes that the name came from reactions to that first post and is not a claim that the project is AGI.

Running the original script

The archived README lists these steps. One adjustment is needed: its first step still says to clone yoheinakajima/babyagi, but that URL now serves the new framework, so clone the archive repo instead.

git clone https://github.com/yoheinakajima/babyagi_archive.git
cd babyagi_archive
pip install -r requirements.txt
cp .env.example .env
python babyagi.py

Before the last command, edit .env:

  • OPENAI_API_KEY and OPENAI_API_MODEL for the model connection (Weaviate needs extra variables, documented in the repo’s docs folder).
  • TABLE_NAME for the collection that stores task results.
  • Optionally BABY_NAME, OBJECTIVE and INITIAL_TASK. The optional values can also be passed on the command line.

A docker-compose up route is documented too, once the .env file is in place.

On models, the README says the script works with OpenAI models and defaults to gpt-3.5-turbo; you choose another through LLM_MODEL or a flag. Llama variants run through llama.cpp, which needs the llama-cpp package, your own weights and a LLAMA_MODEL_PATH.

Two practical limits come straight from the documentation. The loop is designed to keep going, and the README warns that continuous running can lead to heavy API usage, so watch your provider’s billing. And the code is a September 2024 snapshot with closed issues, so expect to fix dependency problems yourself rather than wait for upstream patches.

What the current BabyAGI repo is

The newer project takes a different route. Its README argues that the most promising path to a general agent is a minimal system that can extend itself. The core is a framework called functionz that keeps functions in a database and tracks, as a graph, the imports, dependent functions and secret keys each one needs. It logs every call (inputs, outputs, run time, errors) and ships a dashboard for managing functions and reading logs.

The quick start, from the README:

import babyagi

if __name__ == "__main__":
    app = babyagi.create_app('/dashboard')
    app.run(host='0.0.0.0', port=8080)

After pip install babyagi, the dashboard is at http://localhost:8080/dashboard. You add your own functions with the @babyagi.register_function() decorator and can declare dependencies, imports and key_dependencies on each.

Two experimental agents are included as draft function packs. process_user_input checks whether existing functions can handle a request and, if not, writes new ones by splitting the job into smaller reusable pieces. self_build takes a description of a user (the README’s example is a salesperson at an enterprise SaaS company), invents several tasks that person might ask for, and runs each through process_user_input. The README labels both as experimental and notes that the generated code is minimal and may need work.

Our BabyAGI directory entry tracks this current framework.

Licence

The two repos differ. The GitHub API reports MIT for babyagi_archive. For the current babyagi repo the API reports no licence, even though the README’s last section says the project is released under MIT. If the licence matters for your use, check with the author before relying on the README statement alone.

Its place next to modern frameworks

BabyAGI’s main contribution was the pattern, not the code: a single objective, a queue, and a model that both does the work and decides what comes next. The archived README says the script inspired many projects and keeps a list of them in the repo’s docs folder.

Current frameworks wrap that idea in far more structure. LangGraph presents itself as a low-level orchestration framework for long-running, stateful agents. CrewAI combines teams of role-based agents (“Crews”) with event-driven “Flows” for precise control. Our comparison of agent frameworks covers these and others side by side, and more options are in the agent frameworks category.

The original BabyAGI is still worth reading if you want to see the loop in its most basic form, but it is a frozen snapshot, not a maintained tool. Use it to understand the pattern, then build production work on a framework that is still maintained.

#BabyAGI#Autonomous agents#Agent frameworks#Task planning#Python
AI

Written by AI Agents Directory

Editorial team

Facts in this guide are checked against official documentation and repositories, which are linked in the article.