EarlyTerms

Agent Loop

Established · Emerged 2025-05-15 · 340 days old

An agent loop is the control-flow pattern at the center of every autonomous LLM agent: the model observes its context, reasons about what to do, calls a tool, reads the result, and loops — until it produces plain text with no more tool calls, or a budget rule cuts the cycle. In the canonical form, the whole mechanism is about nine lines of Python.

What's new in 2026 is canonicalization. OpenAI's Jan 23, 2026 "Unrolling the Codex agent loop" (456 HN points) used the phrase as a product-page title. Letta's "Rearchitecting Letta's Agent Loop" placed it alongside ReAct, MemGPT, and Claude Code. Every major platform voice — OpenAI, Anthropic, LangChain, Letta, IBM — converged on the same two-word label.

💡

Sketch.dev's "The unreasonable effectiveness of an LLM agent loop with tool use" (447 HN points, May 2025) published the reference nine-line implementation: `while True: output, tool_calls = llm(msg); if tool_calls: msg = [handle(tc) for tc in tool_calls] else: msg = user_input()`. Claude Code's master loop (codenamed nO) is the same pattern hardened with an async dual-buffer queue.

It's the REPL of the AI era — read-eval-print, except "eval" is a frontier model and "print" can touch your filesystem and production database.

Search Interest

peak ~5.2K/mo
updated 2026-04-19
~5.2K/mo ~2.6K/mo 0
2026-03-21 2026-04-05 2026-04-19
Term Lifecycle
  1. Nascent
    0–7 days
  2. Emergent
    8–30 days
  3. Validating
    31–90 days
  4. Rising
    91–180 days
  5. Established ← now
    180 days +

Why is it emerging now?

TL;DR

Three years after ReAct named the pattern, "agent loop" hit canonical status in 2026 when OpenAI, Letta, and PromptLayer all used the exact phrase in flagship posts within 12 months. A 2026 wave of cost-horror stories (one team going from $127/wk to $47k/wk) keeps the term sticky.

6 forces driving coverage — scroll →

Outlook

6-month signal projection and commercial timeline.

Signal high
Revenue moderate

Every major agent vendor converged on the same two-word label within a 12-month window, locking in the category name.

Risk · The term gets absorbed into "agent harness" as the broader noun and loses distinct SEO identity.

Analogs · ReAct · event loop · REPL · agent harness

Monetization timeline
  1. now
    Informational, paid one layer up

    Searchers are builders learning the pattern; paid products live on hosted harnesses and managed agents.

  2. 3-6mo
    Debuggers + runaway guards

    Agent-loop debuggers, runaway-loop guards, replay tools, and comparison posts ship as paid SaaS.

  3. 6-12mo
    Swallowed by harness?

    Either the noun holds or gets absorbed into "agent harness" like event loop under Node.js.

Competition & Opportunity for term “Agent Loop”

Three heuristic signals derived from the tracked queries, the term's monetization cards, and its cluster neighbors. Directional, not audited.

Content Gap
10 queries tracked
Led by General (9), Showcase (1)
10 Suggest-only tails — long-tail opening
Revenue Potential
0% commercial-intent queries
2 monetization angles mapped
Mostly informational — pre-commercial
Build Difficulty
Very High
Stage: established — category is settled
12 / 13 default TLDs taken · oldest incumbent agentloop.com (2003-10-07)
4 related terms already published
Heuristic · signals: tracked queries, term monetization cards, cluster neighbors

Ideas for term “Agent Loop”

Buildable pitches — turn this term into an article, site, product, post, newsletter, video, or course. Steal any card and run with it.

Article
The Agent Loop in 9 Lines of Python (And the 900 Lines That Make It Production-Ready)

The sketch.dev reference stops where it gets interesting. Walk through token ceilings, step limits, retry policy, tool timeouts, context compaction, structured logs.

Article
Agent Loop vs Event Loop vs REPL: What Programmers Already Know That Helps

Node.js/Python devs keep asking this. Crisp comparison naming the shared structure (read, act, yield) and the one big difference (nondeterministic eval).

Article
Five Agent Loop Patterns Every Builder Should Know (ReAct, Plan-and-Execute, Ralph, Reflect, Nested)

Listicle aggregating loop variants people are shipping. Ralph Loop, reflection loops, plan-and-execute, nested sub-agent loops, stateful heartbeats.

Article
Debugging the Agent Loop: When Your Agent Runs Forever, Costs $47k, or Gives Up at Step Three

The cost-horror framing is begging for a definitive guide. Walks through actual failure modes with diagnostic code. Strong commercial intent.

Website
Agent Loop Playground: side-by-side executable ReAct / Ralph / Reflect / Plan-Execute

Interactive site (no login, BYO API key) running the same task through four canonical variants, showing cost, steps, and success. No such comparison exists.

Product
Loop ceiling / runaway guard as a one-line wrapper

npm / pypi package wrapping any agent loop with max-steps, max-tokens, max-wall-clock, max-dollar circuit breakers. $47k story makes this a paid B2B sell.

Product
Agent loop replay / time-travel debugger

Local-first debugger recording every iteration's messages, tool calls, token counts; scrub back and replay with modifications. Builders stitch this manually today.

Product
Cross-framework loop translator (LangChain loop → native while-loop)

CLI reading a LangGraph/LangChain agent definition and emitting a plain Python/TypeScript while-loop equivalent. Aligned with the "harness > framework" shift.

Post Newsletter / Stratechery-style long-read
How a Nine-Line While Loop Became the Foundation of AI Infrastructure

In May 2025, sketch.dev printed nine lines of Python and called it an agent. Three years of frameworks later, the nine lines are still the nine lines.

Post HN / r/programming
Every Agent Framework Is a Wrapper Around the Same While Loop. Here's the Proof.

I ripped the control-flow out of Claude Code, Codex, LangGraph, CrewAI, and OpenHarness. The core loop is literally identical.

Post LinkedIn / Enterprise newsletter
Your Agent Isn't Broken. Your Loop Is. A Checklist for CTOs.

One team's agent bill went from $127/week to $47,000/week. The model didn't change. The prompt didn't change. The loop did.

What People Search

Long-tail queries from Google Suggest + Trends. Volume and competition are heuristics — directional, not audited. Content Type comes from query shape.

Keyword
Competition
Content Type
agent loop
Very Low
General
agent loop diagram
Very Low
General
agent loop ai
Very Low
General
agent loop claude
Very Low
General
agent loop claude code
Very Low
General
agent loop architecture
Very Low
General
agent loop anthropic
Very Low
General
agent loop codex
Very Low
General
1–8 of 10
1 / 2
Updated 2026-04-19 · sources: Google Trends, Google Suggest · Competition is heuristic

SERP of term “Agent Loop”

What searchers see today — organic results on top, paid ads if anyone's bidding. Ad density is a real-time commercial signal.

Related Terms

Other terms in the same space — aliases, subtypes, competitors, and neighbors to explore next.

Explore next
Also mentioned
  • Also known as agentic loop·LLM loop·agent execution loop
  • Part of ReAct
  • Includes Ralph Loop
  • Related event loop·MemGPT·LangGraph

Sources

Primary URLs this report cites — open any to verify the claim yourself.

  1. 01 sketch.dev — The unreasonable effectiveness of an LLM agent loop with tool use (reference 9-line implementation) sketch.dev
  2. 02 OpenAI — Unrolling the Codex agent loop openai.com
  3. 03 Letta — Rearchitecting Letta's Agent Loop: Lessons from ReAct, MemGPT & Claude Code letta.com
  4. 04 PromptLayer — Claude Code: Behind-the-scenes of the master agent loop (nO) blog.promptlayer.com
  5. 05 Steve Kinney — The Anatomy of an Agent Loop stevekinney.com
  6. 06 Victor Dibia — The Agent Execution Loop: How to Build an AI Agent From Scratch newsletter.victordibia.com
  7. 07 TianPan.co — Agentic Engineering Patterns: The While Loop Is the Easy Part tianpan.co
  8. 08 Alibaba Cloud — From ReAct to Ralph Loop: A Continuous Iteration Paradigm for AI Agents alibabacloud.com
  9. 09 Hacker News — Unrolling the Codex agent loop (456 points) news.ycombinator.com
  10. 10 Hacker News — The unreasonable effectiveness of an LLM agent loop with tool use (447 points) news.ycombinator.com
  11. 11 snarktank/ralph — autonomous AI agent loop (17.1k stars) github.com