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.
BabyAGI · self-hosted
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
| Version | Parameters | VRAM | Context | Notes |
|---|---|---|---|---|
| babyagi_archive · classic/babyagi.py (2023 original) | ~140 lines of Python · no weights | Backend 8B-class Q4_K_M from ~4.9GB of weights; swap in bge-m3 fp16 (~1.2GB) for local embeddings | 4K works, 8K is safer — objective, task list and top-k context all share the prompt | The 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 weights | Backend from 14B up: ~9GB at Q4_K_M, ~15.7GB at Q8_0, ~28GB at bf16 | 8K 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 weights | Backend must do tool calling: ~9GB for 14B Q4_K_M, ~35GB for 32B Q8_0 if you want it steady | 32K recommended — tool definitions accumulate in messages across iterations | Billed 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.py | v1.10.0 · no weights | Same 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 prompt | Apache-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.
- 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 - 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 - 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)" - 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?
Is BabyAGI still maintained, and does the 2023 version still run?
Can BabyAGI run fully local, with no OpenAI API at all?
The task loop never stops and keeps burning money. What can I do?
My local small model does a terrible job with BabyAGI. Model problem or config problem?
Is it safe to let BabyAGI write and install its own code?
More in AI agents and workflows
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.
