source · ingested Jun 4, 2026 · updated Jul 25, 2026

LLM Powered Autonomous Agents

Lilian Weng published Jun 23, 2023 #llm-agent#planning#memory#tool-use#react#self-reflection
Original article: lilianweng.github.io/posts/2023-06-23-agent · Ingested copy: raw/2026-06-04-llm-powered-autonomous-agents.md

Lilian Weng’s June 2023 survey on her blog Lil’Log — the canonical early synthesis of “what is an LLM agent”. Its load-bearing contribution is an anatomy: an autonomous agent is an LLM acting as the brain wrapped by three components — Planning, Memory, and Tool use. Written at the peak of the AutoGPT / BabyAGI / GPT-Engineer moment, it surveys the 2022–2023 research (CoT, ToT, ReAct, Reflexion, MRKL, Toolformer, HuggingGPT, Generative Agents) and closes with three durable limitations. Most of the agent vocabulary the rest of this wiki uses in its 2026 sources traces back to this page — it is treated here as the conceptual ancestor, not just another source.

Source file: raw/2026-06-04-llm-powered-autonomous-agents.md. Figures are diagrams from the cited papers; the two load-bearing ones (the agent-anatomy overview and the human-memory taxonomy) are summarized inline below.

Summary

The anatomy (the article’s spine)

  • An LLM-powered autonomous agent = LLM (brain) + Planning + Memory + Tool use. The overview figure puts Agent at the center with four spokes: Tools (Calendar(), Calculator(), CodeInterpreter(), Search(), …), Action, Memory (short-term + long-term), and Planning (whose sub-items are Reflection, Self-critics, Chain of thoughts, Subgoal decomposition). This figure is the origin of the now-standard four-box agent diagram. See llm-agent for the consolidated concept.

Planning

  • Task decomposition breaks a big task into manageable subgoals (task-decomposition). Three mechanisms named: (1) Chain of Thought (Wei et al. 2022) — “think step by step” turns one hard task into many simple ones and exposes the model’s reasoning; (2) Tree of Thoughts (Yao et al. 2023) — explores multiple reasoning branches per step (BFS/DFS over a tree, states scored by classifier or majority vote); (3) LLM+P (Liu et al. 2023) — outsources long-horizon planning to a classical PDDL planner, with the LLM only translating natural language ↔ PDDL. Decomposition can also be prompt-driven ("Steps for XYZ.\n1."), task-specific-instruction-driven, or human-driven.
  • Self-reflection lets agents iteratively improve by critiquing past actions (self-reflection). Methods surveyed:
    • ReAct (Yao et al. 2022) — interleaves reasoning traces and task-specific actions; the Thought / Action / Observation template. (Weng files ReAct under “self-reflection”, though the wiki treats it as the loop primitive — see react.)
    • Reflexion (Shinn & Labash 2023) — a standard RL setup (binary reward) plus a self-reflection step. After each action the agent computes a heuristic that detects inefficient planning (too-long trajectories) or hallucination (repeated identical action→observation loops) and may reset the environment. Reflections (up to three) are kept in working memory as context for the next trial.
    • Chain of Hindsight (CoH; Liu et al. 2023) — fine-tunes on sequences of past outputs each annotated with feedback and ordered by reward, so the model learns to produce monotonically better outputs; adds a pretraining-LL regularizer and randomly masks 0–5% of tokens to prevent shortcut-copying.
    • Algorithm Distillation (AD; Laskin et al. 2023) — applies the CoH idea to cross-episode RL learning histories: concatenate an agent’s improving trajectories and train (behavioral cloning) a history-conditioned policy, so the network learns the RL process rather than a fixed policy. AD approaches RL² despite being offline and beats expert-distillation (ED); needs multi-episode (2–4) context to work.

Memory

  • Borrows the human-memory taxonomy and maps it onto agents. The taxonomy figure: Sensory (iconic/echoic/haptic) → Short-term / Working (≈7 items, 20–30 s) → Long-term (Explicit/declarative = episodic + semantic; Implicit/procedural = skills). The mapping: sensory ≈ raw-input embeddings; short-term ≈ in-context learning (bounded by the context window); long-term ≈ an external vector store queried at retrieval time.
  • Long-term memory is implemented as fast vector retrieval. Save embeddings to a vector store supporting Maximum Inner Product Search (MIPS), then use approximate nearest neighbors (ANN) to trade a little accuracy for big speedups. Five ANN algorithms surveyed: LSH, ANNOY (random-projection trees), HNSW (hierarchical small-world graphs), FAISS (clustering + vector quantization), ScaNN (anisotropic vector quantization — the recall@10 / speed Pareto leader in the comparison chart).

Tool use

  • Tool use extends the model past its weights (tool-use). Lineage surveyed: MRKL (Karpas et al. 2022) — neuro-symbolic router to expert modules; experiment showed a 7B model fails to extract correct arguments for arithmetic, so knowing when and how to call a tool is the hard part. TALM and Toolformer — fine-tune the LM to use APIs, expanding the dataset only when an API annotation improves output. ChatGPT Plugins and OpenAI function calling — the productized form. HuggingGPT (Shen et al. 2023) — ChatGPT as a controller running a 4-stage loop: task planning → model selection → task execution → response generation, routing subtasks to HuggingFace models. API-Bank (Li et al. 2023) — a benchmark (53 tools, 264 dialogues, 568 API calls) evaluating tool use at three levels: call the right API, retrieve the right API from docs, and plan multi-call sequences.

Case studies

  • ChemCrow (Bran et al. 2023) — LLM + 13 expert chemistry tools over a ReAct/MRKL LangChain workflow. Key finding: GPT-4-as-judge rated GPT-4 ≈ ChemCrow, but human experts rated ChemCrow far higher — LLM self-evaluation breaks down in domains needing deep expertise (the model can’t see its own flaws). An early, concrete instance of the self-grading problem the wiki tracks under agent-evaluation.
  • Boiko et al. 2023 — an agent that browses, reads docs, runs code, and calls robotic-lab APIs for autonomous scientific experiments. The paper also probes misuse risk: asked to synthesize chemical-weapon agents, the agent attempted 4/11 before refusals — an early agent-safety red-team result.
  • Generative Agents (Park et al. 2023) — 25 LLM-controlled characters in a Sims-like sandbox. Architecture: a memory stream (natural-language observation log) + a retrieval model scoring by recency × importance × relevance + a reflection step (synthesize high-level inferences from the 100 most recent observations) + planning/reacting. Produces emergent social behavior (information diffusion, party coordination). Note: its “reflection” = higher-level summarization, distinct from the error-correcting self-reflection above.

Proof-of-concept demos

  • AutoGPT — the demo that popularized “LLM as autonomous controller”. Weng reproduces its full system prompt (strict JSON thoughts/command schema, ~4000-word short-term-memory budget with “save to files”, a command menu). Verdict: cool but unreliable; “a lot of code in AutoGPT is about format parsing.”
  • GPT-Engineer — generates a whole codebase from a natural-language spec; first runs a clarification system prompt (ask questions, don’t act), then switches to a code-writing system prompt (“every detail of the architecture … implemented as code”, entrypoint-first, no placeholders). Both system prompts are reproduced.

Challenges (the article’s conclusion)

  • Finite context length — caps history, instructions, and tool-call context; self-reflection would benefit from longer context; vector-store retrieval is weaker than full attention.
  • Long-term planning and task decomposition — planning over long histories and recovering from unexpected errors is hard; LLMs are less robust than humans at adjusting plans.
  • Reliability of the natural-language interface — model outputs have formatting errors and occasional non-compliance, so much agent code is just output parsing.

Notable claims

  • The three-component anatomy (Planning + Memory + Tool use around an LLM brain) is the article’s enduring contribution — it predates and underlies the agent vocabulary of every 2026 source in this wiki (agent-loop, agent-memory, react, reasoning-models).
  • Short-term memory = in-context learning; long-term memory = external vector store. This is the explicit equation Weng draws, and it set the default RAG-memory architecture for the AutoGPT era. The wiki’s 2026 agent-memory sources later push back: markdown + simple retrieval often beats a vector DB at small/medium scale.
  • “Knowing when to and how to use the tools” is the crux of tool use (from the MRKL arithmetic experiment) — the seed of the modern ACI design discipline.
  • LLM self-evaluation degrades in expert domains (ChemCrow): GPT-4-as-judge couldn’t distinguish itself from a tool-augmented system that human experts rated far higher.
  • Reflexion’s hallucination detector = “consecutive identical actions yielding the same observation” — a concrete, mechanical definition of a stuck agent.
  • Algorithm Distillation learns the learning algorithm, not a policy — behavioral cloning over cross-episode histories yields in-context RL approaching RL² while purely offline.
  • ScaNN’s anisotropic vector quantization optimizes quantization for inner-product similarity specifically (not nearest-centroid), and leads the recall@10/speed frontier in the comparison chart.

Notable quotes

In a LLM-powered autonomous agent system, LLM functions as the agent’s brain, complemented by several key components: Planning, Memory, Tool use.

Self-reflection is a vital aspect that allows autonomous agents to improve iteratively by refining past action decisions and correcting previous mistakes. It plays a crucial role in real-world tasks where trial and error are inevitable.

The results highlight when the external symbolic tools can work reliably, knowing when to and how to use the tools are crucial, determined by the LLM capability. (MRKL)

This indicates a potential problem with using LLM to evaluate its own performance on domains that requires deep expertise. (ChemCrow)

A lot of code in AutoGPT is about format parsing. (on the reliability of the natural-language interface)

Open questions

  • The article predates RL-trained reasoning models, real prompt-caching, MCP, and long-running agents. Reading it now, the interesting question is which of its three “challenges” were solved vs. merely deferred — e.g. context length grew but context engineering became a discipline rather than the problem disappearing. Tracked across the 2026 sources.
  • “Short-term = in-context, long-term = vector store” is the 2023 default. The wiki’s agent-memory page (2026 sources) splits memory four ways (working/procedural/episodic/semantic) and de-emphasizes vector DBs. Worth a note on how the taxonomy evolved (Weng’s human taxonomy already contains episodic/semantic/procedural — the 2026 frame essentially re-applied it to engineering).
  • Self-reflection here is prompt-/SFT-level (Reflexion, CoH). The 2026 ralph-wiggum-loop and verifier-loop are the engineering descendants — externalized, multi-reviewer, verifier-bound. Is the lineage direct or convergent? Likely direct via ReAct.
  • The bioweapon red-team in Boiko et al. is one of the earliest agent-misuse evals. The wiki has no dedicated agent-safety thread yet beyond prompt-injection and the alignment pages. Superseded (2026-07-12): the Jul 2026 ingest built that thread — recursive-self-improvement (RSI risk section), reward-hacking (self-improvement loop concerns), self-improving-harness (evaluator-outside-the-loop). Boiko et al. remains the earliest misuse (vs. misalignment) data point on that thread.

Pointers

  • The conceptual ancestor of these wiki pages: react (ReAct, the loop primitive), agent-loop, agent-memory, reasoning-models (CoT → trained reasoning), agent-evaluation (ChemCrow’s self-grading failure; API-Bank’s three levels), tool-use / agent-computer-interface (MRKL → ACI), maximum-inner-product-search (the vector-retrieval substrate), multi-agent-orchestration (Generative Agents as an early multi-agent sandbox).
  • Companion sources: 2026-04-27-the-second-half-of-aiShunyu Yao (the ReAct author) writing two years later. Where Weng catalogs the recipe’s components, Yao argues the assembled recipe now generalizes so well that evaluation, not method, is the bottleneck. And 2026-07-07-harness-engineering-self-improvement — Weng herself, three years later, upgrading this post’s anatomy into the harness frame and making the anatomy an optimization target. The three together give the 2023 → 2025 → 2026 arc of the same idea.
  • Author: lilian-wengLil’Log is one of the field’s most-cited explainer blogs; this post is its most-cited entry.
  • Papers surveyed (for transitive citation): CoT (Wei et al. 2022), ToT (Yao et al. 2023), LLM+P (Liu et al. 2023), ReAct (Yao et al. 2022), Reflexion (Shinn & Labash 2023), CoH (Liu et al. 2023), Algorithm Distillation (Laskin et al. 2023), MRKL (Karpas et al. 2022), TALM (Parisi et al. 2022), Toolformer (Schick et al. 2023), HuggingGPT (Shen et al. 2023), API-Bank (Li et al. 2023), ChemCrow (Bran et al. 2023), Boiko et al. 2023, Generative Agents (Park et al. 2023).

Referenced by 17

harness-why-it-matters-now agent-computer-interface agent-evaluation agent-loop agent-memory chain-of-thought llm-agent maximum-inner-product-search react reasoning-models self-reflection task-decomposition tool-use chroma lilian-weng openai shunyu-yao
esc