Yohei Nakajima pushed roughly 140 lines of Python to GitHub on a weekend in late March 2023. No interface. No real documentation. No safety rails. Within a week it had thousands of stars, and within a month people were calling it the spark that set off the autonomous agent gold rush.
The project was BabyAGI. And the strange part is that the code was never the point.
What made it matter was the loop. Give it an objective, walk away, and it keeps generating its own to-do list, reordering that list, and grinding through tasks until something stops it. That idea — an agent that decides what to do next rather than waiting to be told — is now baked into almost every agent framework you can name. Understanding how the original did it is still the fastest way to understand why modern agents behave the way they do.
What separates a BabyAGI agent from a chatbot
A chatbot answers one prompt and forgets. A BabyAGI-style agent holds state. It maintains a task list, tracks what’s finished, and uses the result of each task to invent new ones. The output of step four changes what step five even is.
That single design choice creates most of the upside and nearly all of the problems. An agent that writes its own tasks can chase a goal across dozens of steps without a human in the loop. It can also confidently march in the wrong direction for an hour while your token bill climbs. Both outcomes come from the same mechanism.
If you want the origin story in full, how a tiny open-source script became the template for autonomous agents is worth reading alongside this piece — the timeline explains a lot about why the design looks so stripped down.
The four moving parts
The original implementation is almost embarrassingly simple. Four components, one loop:
- Execution agent — takes the current task, calls an LLM, and produces a result.
- Task creation agent — looks at the objective plus the result just produced and asks, “what should come next?”
- Prioritization agent — takes the cleaned-up task list and reorders it, usually toward whatever unblocks the most work.
- Vector store — holds results and past tasks so the agent can retrieve context instead of stuffing everything into a single prompt.
That’s it. No planner graph, no tool registry, no reflection step. The whole thing fits on a couple of screens, which is exactly why it spread — you could read every line and understand it in twenty minutes.
A run, from the inside
Say the objective is “research three competitors and draft a positioning memo.”
Iteration one, the agent executes something like “identify the three main competitors.” The result comes back as three names. The task creation agent then spins out follow-ups: pull pricing pages, summarize each product’s stated positioning, check recent funding news. The prioritization agent bumps pricing research to the top because it’s cheap and concrete.
By iteration eight or nine, the list looks nothing like the original plan. Tasks have multiplied. Some are near-duplicates of work already finished. The agent starts writing meta-tasks like “review the research gathered so far,” which produces a summary of a summary.
This is the characteristic BabyAGI texture: productive for the first third, redundant for the second, and faintly confused for the third. Anyone who ran the original in 2023 remembers the exact moment the to-do list became the deliverable.
Where the loop breaks down
Task drift
Each new task is generated from the previous result, not from the original objective. Errors compound quietly. A wrong assumption in step three becomes a firm premise by step twelve, and nothing in the loop ever goes back to check it.
No verification step
The execution agent declares success the moment it produces text. There’s no critic, no test, no retrieval against a ground truth. An agent that can’t tell whether it did the job will happily do the wrong job thoroughly.
Cost scales with task count, not value
Every iteration fires at least two LLM calls — one to execute, one to create tasks — plus a prioritization call. A hundred-step run on a frontier model is not a rounding error. Two of the three calls are overhead, which is a rough ratio if you’re paying per token.
Memory is fuzzy
Vector similarity retrieval doesn’t understand task relevance. It returns things that read similarly, which isn’t the same as things that matter. Early results get buried under newer, wordier ones.
Most of these failures are architectural rather than model-related, and they map onto the architectural decisions that actually determine whether an agent works — feedback loops, state management, and how you define done.
What the frameworks kept, and what they threw out
Nearly every agent stack that appeared after mid-2023 is a BabyAGI descendant with guardrails bolted on. LangGraph replaced the free-floating task list with an explicit state machine, so you can’t wander into an unplanned step. AutoGPT added tool access and a human approval gate. CrewAI split the single agent into role-bound specialists that critique each other.
Open-source projects have pushed in a different direction: more visibility, more control. OpenManus gives you an open-source agent you can actually inspect and steer mid-run, which is precisely the oversight the original loop lacked.
Nakajima himself moved on to BabyAGI 2o, where the agent writes and registers its own tools rather than just its own tasks. Same instinct — self-direction — applied one level up the stack.
Running a BabyAGI agent without wasting money
If you’re building one for learning or for a narrow internal job, a few practical guardrails make the difference between a useful run and an expensive demo:
- Cap iterations hard. Fifteen to twenty-five is usually enough for a research task. Beyond that you’re funding repetition.
- Add a stop condition based on content, not count. Check whether the last three tasks produced anything new before continuing.
- Use a cheap model for task creation and prioritization, an expensive one only for execution. The planning calls don’t need a frontier model.
- Seed the task list yourself. Handing the agent three good starting tasks prevents the aimless opening ten.
- Log every task and result to disk. When the run goes sideways, the transcript is the only way to find out where.
Building the thing yourself teaches more than any framework will. A step-by-step walkthrough of building a BabyAGI-style agent from scratch gets you to a working loop in an afternoon, and you’ll feel exactly where the drift starts.
The version worth building now
The honest assessment of BabyAGI is that it’s a reference implementation, not a product. Nobody should ship the original loop to production. But the underlying bet — that an LLM with a task list and a memory store can make progress on a goal without constant prompting — turned out to be correct, and it’s the reason agents are now a genuine category rather than a demo genre.
The most useful thing you can take from it is the discipline of the loop itself. Write the task list down where you can read it. Give every task an execution step and a check. Decide in advance what “done” looks like and what happens when the agent hits it. Keep the memory small and deliberate. Do those four things and you’ll get more out of a lesser model than most people get out of a better one with a fancier graph.
Start small, cap the run, watch the transcript. The loop will tell you what it needs.

