Skip to main content

Autonomous agent framework

BabyAGI, self-hosted: lock the code-writing agent inside your own GPU

BabyAGI has no checkpoint to load. What it actually needs is an LLM endpoint you control. Here are the three living branches, the real VRAM math for the backend, and the loops that quietly burn through a budget.

Version first, or you will lose an evening on the wrong repo. The BabyAGI that broke the internet in March 2023 — the three-stage loop where a Task Creation Agent invents work, a Prioritization Agent reorders it, and an Execution Agent runs it — was archived by Yohei Nakajima in September 2024 and moved into the babyagi_archive repo. It lives at classic/babyagi.py, described by its author as a pared-down Task-Driven Autonomous Agent in roughly 140 lines. The same classic directory still holds BabyBeeAGI.py, BabyCatAGI.py, BabyDeerAGI.py, plus the BabyElfAGI/ and babyfoxagi/ experiments. What you get today from pip install babyagi is a full rewrite: a function-management framework called functionz that stores functions in a database, tracks their dependency graph, and ships a Flask dashboard, all in service of a self-building autonomous agent.

Second: BabyAGI's own VRAM requirement is zero. It is a few hundred lines of Python with no safetensors anywhere. When people ask how much VRAM BabyAGI needs, the real question is which model they intend to feed the loop. The seam is litellm — functionz's ai_functions.py literally imports completion and embedding from litellm, defaulting to gpt-4o and text-embedding-ada-002, while the single-file babyagi-2o reads LITELLM_MODEL and defaults to anthropic/claude-3-5-sonnet-20240620. Run any of it unmodified and you are running up a cloud API bill, which is the exact opposite of self-hosting. Pointing that endpoint at your own card is the whole job.

Third, and the real reason to rent rather than run this on your laptop: this thing executes code it wrote itself. functionz's drafts/self_build and code_writing_functions have the model generate new functions and register them straight into the database; babyagi-2o goes further, with an install_package() in main.py that shells out to pip for whatever the model decides it needs, then execs the result. That behaviour is a disaster on a development machine and perfectly reasonable on a per-second-billed instance you destroy afterwards. Worth knowing too: the author's attention has moved to activegraph, an event-sourced reactive graph runtime at v1.10.0 (July 2026), Apache-2.0, Python 3.11+, whose examples/babyagi.py rebuilds the autonomous loop as three reactive behaviors over a shared graph. That is the freshest place to run the original idea without fighting 2024-era pins.

01 —

Which BabyAGI are you actually running

Four repos, all runnable, with wildly different demands on the model behind them

VersionParametersVRAMContextNotes
babyagi_archive · classic/babyagi.py (2023 original)~140 lines of Python · no weightsBackend 8B-class Q4_K_M from ~4.9GB of weights; swap in bge-m3 fp16 (~1.2GB) for local embeddings4K works, 8K is safer — objective, task list and top-k context all share the promptThe three-stage loop as archived in September 2024. Chroma is the default vector store, Weaviate is supported. The README keeps a local path via LLM_MODEL=llama through llama-cpp, but you supply the weights and LLAMA_MODEL_PATH yourself.
babyagi 0.1.4 (functionz, the one on PyPI)0.1.4 · no weightsBackend from 14B up: ~9GB at Q4_K_M, ~15.7GB at Q8_0, ~28GB at bf168K minimum; a large function library with its dependency graph in the prompt wants 16K+MIT-licensed, latest PyPI release dated October 2024, Flask dashboard on :8080/dashboard. Requirements pin sqlalchemy>=1.4,<2.0, which collides with most modern Python stacks — always give it its own venv.
babyagi-2o (single-file minimalist build)~185 lines · no weightsBackend must do tool calling: ~9GB for 14B Q4_K_M, ~35GB for 32B Q8_0 if you want it steady32K recommended — tool definitions accumulate in messages across iterationsBilled by its author as the simplest self-building general autonomous agent. The loop hardcodes max_iterations = 50 and exits early when the model calls task_completed. It pip-installs arbitrary packages and execs code, so it belongs on a disposable instance.
activegraph v1.10.0 · examples/babyagi.pyv1.10.0 · no weightsSame backend rules; for unattended long runs use 30B-A3B Q4_K_M (~18.6GB) or 32B Q8_0 (~35GB)32K+, since the graph projected from the event log keeps entering the promptApache-2.0, Python 3.11+, pip install "activegraph[llm]". Rebuilds the BabyAGI loop as three reactive behaviors over a shared graph with an append-only event log as the source of truth — replayable when a run goes sideways, which is exactly what the original lacked.

02 —

Size the card to the backend, not to the framework

BabyAGI costs no VRAM; the model you feed it costs all of it. Pick the row that matches your run.

  • Get classic/babyagi.py's three-stage loop running with an 8B model at Q4_K_M

    RTX 3090 24GB$0.193/GPU-hr

    An 8B Q4_K_M is around 4.9GB of weights, leaving 24GB with plenty of room to also host bge-m3 locally and cut the last cloud dependency on ada-002.

  • functionz self-build work or babyagi-2o, where 14B-class tool calling has to be reliable

    RTX 4090 24GB$0.540/GPU-hr

    14B Q4_K_M is roughly 9GB of weights with generous KV headroom at 32K context; if you want 14B in bf16 (~28GB), step up to RTX 5090 32GB at $0.723/GPU-hr.

  • Unattended long runs where the task-list JSON must parse on the first try, 32B or 30B-A3B

    RTX A6000 48GB$0.817/GPU-hr

    Qwen3-32B at Q8_0 is about 35GB and 30B-A3B at Q4_K_M about 18.6GB — both fit with KV to spare, and loop stability is mostly a structured-output problem.

  • A 70B-class backend or 32B in bf16, several agent instances running long contexts in parallel

    A100 SXM4 80GB$1.088/GPU-hr

    70B Q4_K_M is roughly 42.5GB and 32B bf16 about 65GB; forcing either onto a 48GB card starves the KV cache down to short contexts. 80GB is what runs overnight.

03 —

Four steps to put BabyAGI on your own endpoint

Installing the framework is easy. Stopping it from quietly calling gpt-4o is the actual work.

  1. 01

    Rent a card and serve an OpenAI-compatible endpoint with vLLM

    Start from a prebuilt vLLM image. One shortcut worth knowing: functionz hardcodes the model name as gpt-4o in ai_functions.py, so instead of patching source, use --served-model-name to present your local model under that name. Tool calling is non-negotiable for babyagi-2o; Qwen3 uses the hermes parser under vLLM.

    vllm serve Qwen/Qwen3-14B --served-model-name gpt-4o --enable-auto-tool-choice --tool-call-parser hermes --max-model-len 32768 --port 8000
  2. 02

    Install BabyAGI in its own venv and aim litellm back at localhost

    The sqlalchemy>=1.4,<2.0 pin is a fact of life in 0.1.4 and will eventually collide with something else in a shared environment. Once installed, two environment variables are enough for litellm to route every completion to 127.0.0.1:8000; the API key can be any placeholder since a local endpoint does not validate it.

    python -m venv .venv && . .venv/bin/activate && pip install babyagi && export OPENAI_API_BASE=http://127.0.0.1:8000/v1 OPENAI_API_KEY=sk-local
  3. 03

    Launch the Flask dashboard and inspect the dependency graph

    The dashboard lives at /dashboard and exposes functions, dependencies, execution logs and secret-key handling. Note that it binds 0.0.0.0:8080 by default — never leave that open on a public IP; forward 8080 over SSH instead. Embeddings still default to text-embedding-ada-002, so swap in a local vector model if you want to be genuinely offline.

    python -c "import babyagi; babyagi.create_app('/dashboard').run(host='0.0.0.0', port=8080)"
  4. 04

    Install guardrails before you turn on self-build

    The loop in classic/babyagi.py has no termination condition at all, and babyagi-2o only has a hardcoded max_iterations = 50. Set an iteration ceiling, a per-task timeout, and a hard shutdown time on the instance. For anything long-lived, move to activegraph, where the append-only event log lets you replay every step instead of guessing.

    pip install "activegraph[llm]" && python -m activegraph.examples.babyagi

What a week of self-building agent experiments actually costs

Take Qwen3-14B at Q4_K_M (~9GB of weights) on an RTX 4090 24GB at $0.540/GPU-hr. Three hours a day building out a functionz library, five days a week, is 15 hours: 0.540 x 15 = $8.10 in compute. Weights plus dependencies occupy 20GB; at the $0.414/GB-month median, keeping that for five days before destroying it is 20 x 0.414 x 5 / 30 = about $1.38. Exporting the function library and execution logs, 2GB of egress at $0.0081/GB, is roughly $0.02. Total for the week: about $9.50. If you only want to reproduce the 2023 three-stage loop, an 8B at Q4 on an RTX 3090 24GB at $0.193/GPU-hr runs three hours for 0.193 x 3 = $0.58. Compare that with the alternative: 15 hours of an unbounded while loop hammering cloud gpt-4o, where the token bill has no ceiling. Here compute billing stops the moment the instance stops, metered per second, with no minimum and no quota request.

04 —

FAQ

How much VRAM does BabyAGI actually need to run locally?

BabyAGI itself needs 0GB — it is a few hundred lines of Python with no weight files. All the VRAM goes to whichever LLM you put behind it: roughly 4.9GB for an 8B at Q4_K_M, ~9GB for 14B Q4_K_M and ~28GB at bf16, ~35GB for 32B Q8_0, ~42.5GB for 70B Q4_K_M — weights only, with KV cache on top. So the right question is how large a model you plan to drive the loop with. On NexGPU, RTX 3090 24GB at $0.193/GPU-hr through A100 SXM4 80GB at $1.088/GPU-hr covers that entire range, so start small and move up once the loop runs clean.

Is BabyAGI still maintained, and does the 2023 version still run?

It runs, as long as you look in the right place. The original was archived in September 2024 into babyagi_archive, where classic/babyagi.py is the ~140-line core; wire up the dependencies and a vector store and it still reproduces the original demo. The main repo is now the functionz rewrite, with PyPI frozen at 0.1.4 from October 2024 and little functional change since. The author's focus has shifted to activegraph (v1.10.0, July 2026, Apache-2.0), whose examples/babyagi.py is the loop's most current living implementation. All three spin up inside ten minutes on a NexGPU Ubuntu CLI or PyTorch image, and cost nothing once you destroy the instance.

Can BabyAGI run fully local, with no OpenAI API at all?

Yes, but two things are easy to miss. Completions first: functionz goes through litellm, so setting OPENAI_API_BASE to your local vLLM redirects them — and since ai_functions.py hardcodes gpt-4o, the least invasive fix is launching vLLM with --served-model-name gpt-4o. Embeddings second: the default is text-embedding-ada-002, and leaving it alone means requests still leave the box. Swap in a local vector model such as bge-m3 (~1.2GB at fp16) to be truly offline. The whole stack fits on a single NexGPU RTX 4090 24GB at $0.540/GPU-hr, with model and vector store both staying on that machine.

The task loop never stops and keeps burning money. What can I do?

That is baked into the original design: classic/babyagi.py's main loop has no exit condition, and the Task Creation Agent invents fresh tasks after every completed one — the README itself warns that continuous operation drives high API usage. babyagi-2o is a little better, with a hardcoded max_iterations = 50 and an early exit when the model calls task_completed. In practice, combine three guardrails: an iteration ceiling, a per-task timeout, and a scheduled instance shutdown. Running it on NexGPU keeps the cost bounded and predictable — billing is per second and compute charges stop the moment the instance does, unlike an uncapped token bill.

My local small model does a terrible job with BabyAGI. Model problem or config problem?

Almost always structured output falling over. Every stage of this loop needs the model to emit something parseable: Task Creation has to return structured tasks, and babyagi-2o is built entirely on tool calling, so a malformed response either fails to parse or sends the agent into regenerating the same task forever. Models below 7B are unreliable at this. The practical threshold is 14B and up with clean tool-calling support, and 30B-A3B or 32B is noticeably calmer. NexGPU's RTX 5090 32GB at $0.723/GPU-hr and RTX A6000 48GB at $0.817/GPU-hr cover those two tiers, so you can swap cards and compare success rates on the same task.

Is it safe to let BabyAGI write and install its own code?

No, which is precisely why you isolate it. functionz's drafts/self_build and code_writing_functions have the model generate new functions and register them straight into the database for execution; babyagi-2o's main.py includes install_package(), which shells out to pip for whatever the model asks for and then execs the generated code. The author says it plainly in the README: experimental framework, not meant for production use. The right answer is a machine you can throw away — NexGPU instances boot ready to use, bill per second, and get destroyed when the run ends. Pick PyTorch or Ubuntu CLI from the 2,000+ prebuilt images, and the worst case costs you one instance, not your workstation.

Start building on NexGPU

Enterprise R&D team or solo developer — either way, your first job can be running in minutes.

Sign up to browse live network pricing. No payment method required.