What is an AI agent?
An AI agent pursues a goal by looping through decide, tool use, and observe until it stops or asks a human.
Published here · 9 sources · Resume reading
An AI agent is software that uses a model to pursue a goal by choosing steps and tools in a loop until it finishes or asks a human. A chatbot that only returns text is not an agent. NIST's AI glossary calls an agent a program that takes self-directed actions toward an externally specified goal [1].
Spot the decide-act-observe loop
Anthropic's 2024-12-19 guide separates workflows (fixed code paths) from agents (the model directs tool use from environmental feedback). Their short form: agents are typically large language models (LLMs, the text models behind chat tools) using tools based on feedback in a loop [2] [3]. OpenAI's practical guide says agents independently accomplish tasks on your behalf, and that apps which use an LLM without letting it control the workflow (simple chatbots, single-turn LLMs, sentiment classifiers) are not agents [5]. The developer track adds the same shape: instructions, guardrails, and tools [6].
OpenAI's running-agents docs describe the loop as: call the model, execute tool calls and continue, hand the job to another agent (a handoff), or return a final answer [7]. Anthropic's tool-use docs add that the model never runs tools itself. It emits structured requests; your client executes them and returns results in a loop that repeats while the reply's stop_reason is "tool_use" [4]. stop_reason is the field the model returns saying why it stopped, for example that it wants to call a tool or that it is done [4].
Run a tiny educational loop
This script is not a product agent. It only shows the shape: decide, act, observe, stop. Create the same demo tree used in the terminal commands part 1 post first, then run:
rm -rf /tmp/blog-demo
mkdir -p /tmp/blog-demo/{src,docs,.hidden}
cd /tmp/blog-demo
echo 'hello' > README.md
echo 'print(1)' > src/app.py
echo 'findme-unique-token' > src/needle.txt
echo 'note' > docs/note.txt
printf 'secret\n' > .hidden/key.txt
python3 - <<'PY'
observed = None
steps = []
for turn in range(5):
if observed is None:
action = ("list", "/tmp/blog-demo")
elif isinstance(observed, list):
action = ("count", len(observed))
else:
action = ("done", observed)
steps.append(action)
break
if action[0] == "list":
import os
observed = [n for n in os.listdir(action[1]) if not n.startswith('.')]
steps.append(("list", observed))
elif action[0] == "count":
observed = action[1]
steps.append(("count", observed))
print(steps)
print("goal_met", observed == 3)
PYYou should see a list step with README.md, docs, and src, then a count of 3, then goal_met True. A one-shot line like print("There are probably some files.") has no observe step, so it is the chatbot contrast, not an agent.
Keep the caveats in view
The Center for Democracy and Technology's 2025-05-14 brief notes that "AI agent" still lacks one clear policy definition and spans chatbots to action-oriented systems [9]. Say "more agentic" when a product sits in the middle. NIST's 2025-08-05 tool-use note places models inside surrounding software (scaffolding) so they can manipulate tools; that is the leading pattern, not a claim that every chat product with search is an agent [8].
Do not treat agents as unsupervised by default. Anthropic's agent guidance is about when to add that loop and how to keep it simple [2]. For concrete stop-rules when a coding agent expands scope, use how to stop an AI coding agent from over-engineering. For the related pattern of picking a fixed workflow before an agent, see choose an AI workflow before building an agent and five rules for building an AI agent that works.
Keep an agent within its task
Use Claude Code deny rules before granting tools, context commands when a task grows, and a 429 retry when a service asks the client to wait.
For a later Anthropic Labs pattern that splits long builds across planner, generator and evaluator roles, see Anthropic planner, generator, evaluator pattern.
Send this to the friend who calls every chatbot an AI agent.

Transcript: Agent loop animation
Short looping animation of the same four-card AI agent diagram. The Goal, Tools, and Observe cards highlight in turn to show the loop, while Done stays at the end of the row.
Keep this guide
Filed under AI agents, Dev explainers
Questions about this guide
Is a chatbot an AI agent?
Not if it only returns text. Vendor guides treat agents as systems that use tools or other systems toward a goal, with a loop that can observe results.
Does every product labeled agent fit one legal definition?
No. Policy groups note the term spans chatbots to action-taking systems. Prefer the loop definition and name the source you used.
Who runs the tools, the model or my app?
In Anthropic's tool-use contract the model emits structured tool requests. Your app or hosted tools execute them and return results.
Sources
- Anthropic: Building effective agents (2024-12-19)anthropic.com
- Anthropic: How tool use works, accessed 2026-11-12platform.claude.com
- OpenAI: Building agents, accessed 2026-11-12developers.openai.com
- OpenAI: Running agents, accessed 2026-11-12developers.openai.com