An agent in 100 lines
On 3 April 2023, a few days after AutoGPT’s publication, Yohei Nakajima — general partner at the fund Untapped Capital — published BabyAGI, an autonomous task-driven agent written in about 100 lines of Python. The intent was not to build a product, but to document the minimum pattern needed to implement an autonomous LLM-based agent. Its brevity makes it immediately didactic: BabyAGI is more read, forked and reshaped than used in production.
The task-driven loop
BabyAGI’s architecture consists of three functions:
- Task creation: starting from the objective and the last obtained result, the model generates new tasks to add to the queue
- Task prioritization: the list of pending tasks is reordered by priority based on the overall objective
- Task execution: the task at the top of the queue is executed by invoking the LLM with the available context
The loop iterates as long as tasks remain in the queue or until explicit termination. This simple structure clearly identifies the primitives of the task-driven agent: decomposition, prioritization, execution.
Integrations
BabyAGI uses OpenAI as the default LLM provider and Pinecone as external vector memory to preserve context between iterations, overcoming the context window limits. The licence is MIT, fully permissive.
Impact and evolutions
BabyAGI, despite its essential code, becomes a conceptual reference for a generation of agents: many subsequent frameworks (CrewAI, OpenAgents, LangChain variants) start from the decomposition-prioritization-execution idea formulated here. In 2024, Nakajima published BabyAGI 2.0, a revision that introduces richer features while maintaining the minimalist approach. BabyAGI’s historical importance does not lie in actual production, but in having condensed the conceptual core of the autonomous agent into a few readable lines.
