An AI agent is an LLM in a loop in 20 lines of code: where complexity begins

"Build us an AI agent" today sounds like "build us a button"—but the word "agent" hides three different things: a prompt, a chatbot, and an actual agent. A Habr author shows an agent's anatomy with code (at its core: an LLM in a loop of 20 lines), breaks down five ways to accidentally burn your agent budget, and offers a simple filter to understand if you need one at all.

AI-processed from Habr AI; edited by Hamidun News
An AI agent is an LLM in a loop in 20 lines of code: where complexity begins
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1The basic architecture of an agent — an LLM in a loop, approximately 20 lines of code
Key metric #2The author identifies three different concepts confused under the word "agent": prompt, chatbot, agent
Key metric #3The article outlines five ways to accidentally burn through budget on an agent

The phrase "build us an AI agent" now sounds as simple as "build a button," even though the word "agent" in practice hides three different things — a prompt, a chatbot, and an actual agent, explains the author of an article on Habr dedicated to the anatomy of AI agents.

How an Agent Differs From a Prompt and Chatbot

According to the author, confusion around agents arises because three completely different things — a simple prompt, a dialogue chatbot, and a full-fledged agent — are called the same. The difference is fundamental: an agent does not simply answer a question, it acts in a loop, making decisions independently about the next step.

What Is the Anatomy of an Agent

At the core of a minimal AI agent, according to the author, lies an LLM running in a loop — such a construct can be implemented in literally twenty lines of code. This is where the real complexity begins: turning a minimal loop into a reliable system that does not waste budget and solves a real problem.

  • The basic architecture of an agent — an LLM in a loop, approximately 20 lines of code
  • The author identifies three different concepts confused under the word "agent": prompt, chatbot, agent
  • The article outlines five ways to accidentally burn through budget on an agent
  • A simple filter is given for checking whether a task really needs an agent

What This Means

Demand for "AI agents" outpaces understanding of what they actually are: while teams confuse a prompt, a chatbot, and an agent, budgets continue to be wasted on development. Clear separation of these concepts and a simple filter of "do we even need an agent" is a practical way to avoid overpaying for a trendy term.

Story

Key Questions Answered

How an Agent Differs From a Prompt and Chatbot?

According to the author, confusion around agents arises because three completely different things — a simple prompt, a dialogue chatbot, and a full-fledged agent — are called the same. The difference is fundamental: an agent does not simply answer a question, it acts in a loop, making decisions independently about the next step.

What Is the Anatomy of an Agent?

At the core of a minimal AI agent, according to the author, lies an LLM running in a loop — such a construct can be implemented in literally twenty lines of code. This is where the real complexity begins: turning a minimal loop into a reliable system that does not waste budget and solves a real problem. The basic architecture of an agent — an LLM in a loop, approximately 20 lines of code The author identifies three different concepts confused under the word "agent": prompt, chatbot, agent The article outlines five ways to accidentally burn through budget on an agent A simpl

What This Means?

Demand for "AI agents" outpaces understanding of what they actually are: while teams confuse a prompt, a chatbot, and an agent, budgets continue to be wasted on development. Clear separation of these concepts and a simple filter of "do we even need an agent" is a practical way to avoid overpaying for a trendy term.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Autonomous AI Agents

Delegate Deep Research, Coding & Workflows to an AI Agent

Deploy autonomous multi-step execution with NomadNet Agent (agent.nomadnet.ai) — automated web research, data synthesis, code generation, and complex task orchestration.

Launch NomadNet Agent →NomadNet AI Platform
What do you think?
Loading comments…