What Is an AI Agent? The Loop That Makes It Different

Understand the observe-act-repeat loop that separates a true AI agent from a very good prompt, and know exactly when you need one.

I Used to Think a Great Prompt Was an Agent

When I first heard the word "agent" thrown around in AI circles, I nodded along like I understood. I figured it just meant a really long, really detailed prompt. Maybe one with a system prompt at the top. Maybe one that used a few tools.

I was wrong. And it took me embarrassingly long to figure out the actual difference.

Here's the honest version: a great prompt is a single shot. You ask, the model answers, done. An agent is something fundamentally different — it's a loop. And once you understand that loop, the whole concept of "AI agents" clicks into place in about five minutes.

The Single-Shot Model: What a Prompt Actually Is

Every time you type something into ChatGPT or Claude and hit send, you're running a single inference. The model looks at everything in its context window — your message, any system prompt, the conversation history — and produces one response. Then it stops.

That's it. One look, one output, done.

You can make that prompt incredibly sophisticated. You can give it a persona, step-by-step instructions, examples, constraints, output formats. You can chain multiple prompts together manually. But each individual call is still a single shot — the model doesn't go off and do things on its own. It answers and waits.

This is actually fine for most things. Summarizing a document? Single shot. Writing a first draft? Single shot. Explaining a concept? Single shot. The vast majority of AI use cases are genuinely just well-crafted prompts, and there's nothing wrong with that.

The Loop That Changes Everything

An agent is different because it runs in a loop. Specifically, the observe-act-repeat loop. Here's what that looks like broken down:

Observe: The agent looks at the current state of the world — a task description, tool results, previous actions, error messages, whatever is in context.

Think: The model reasons about what to do next. (Some agent frameworks make this explicit with a "chain of thought" step; others bake it into the response format.)

Act: The agent takes an action. This might mean calling a tool (running a web search, writing a file, executing code, calling an API), or producing an intermediate output, or deciding it's done.

Repeat: The result of that action gets fed back in as a new observation, and the loop runs again — until the agent decides the task is complete or hits a stopping condition.

agent-loop.txt
# The observe-act-repeat loop, simplified

Task: "Find the current price of three stocks and write a summary"

Loop iteration 1:
Observe → task received, no data yet
Act → call search_tool("AAPL stock price")
Result → "$182.50"

Loop iteration 2:
Observe → have AAPL, need GOOGL and MSFT
Act → call search_tool("GOOGL stock price")
Result → "$171.20"

Loop iteration 3:
Observe → have AAPL and GOOGL, need MSFT
Act → call search_tool("MSFT stock price")
Result → "$415.80"

Loop iteration 4:
Observe → have all three prices
Act → write_summary(AAPL, GOOGL, MSFT)
Result → task complete, output returned

Notice what's happening here: the model is making decisions based on what it already found. It's not just following a script — it's reacting to reality as it unfolds. That's the key thing a prompt alone can never do.

The Three Things That Make a True Agent

After reading a bunch of agent frameworks and actually building a few, I've landed on three things that have to be present for something to genuinely be an agent rather than a clever prompt chain:

1. It takes actions in the world. Not just producing text — actually doing things. Running code, calling APIs, reading files, writing files, sending requests. If the model's output only ever gets read by a human, it's not really acting.

2. Observations feed back in. The result of each action becomes the input for the next decision. This is the loop part. Without this feedback cycle, you just have a sequence of independent prompts.

3. It decides when it's done. An agent has some stopping condition it reasons about itself. "Have I completed the task? Do I have all the information I need? Did something go wrong that I should report?" A static prompt chain doesn't do this — a human or a fixed script decides when to stop.

The Autonomy Spectrum

Agents exist on a spectrum from "almost a prompt" to "fully autonomous." Most practical agents sit somewhere in the middle — they loop and act, but a human approves certain steps or sets clear boundaries. That's often the safest and most useful spot to be.

A Concrete Example: Research Task

Let me make this tangible. Say you want AI to research a topic and write a report. Here's the difference:

The prompt version: You paste in everything you already know, ask for a structured report, and get one response. It's only as good as what you already gave it. If something's missing, you go find it and try again manually.

The agent version: You give it the topic. It runs a search. It reads the results. It decides what's still missing. It runs more searches. It finds a relevant document and reads parts of it. It notices a contradiction and looks it up. It writes the report based on everything it actually found. You didn't do any of the intermediate steps — it did.

The agent version might take 10-15 loop iterations to finish. Each one is a new inference, a new decision, a new action. By the end, it's done something no single prompt could do: it gathered real information it didn't start with.

When You Actually Need an Agent (And When You Don't)

Here's where I see people overcomplicate things: they reach for agents when a good prompt would do the job in seconds. Agents are slower, more expensive, harder to debug, and occasionally go off the rails. You don't want one unless you need one.

Use a prompt when:

— The task has a single, well-defined answer you can provide all the context for
— You're doing one-shot generation: writing, summarizing, translating, explaining
— The task doesn't require gathering new information mid-stream
— Speed and cost matter more than thoroughness

Use an agent when:

— The task requires taking actions (not just producing text)
— You don't know in advance how many steps it'll take
— The model needs to react to what it actually finds, not what you predicted
— The work involves multiple tools that need to be coordinated
— You'd otherwise be the human doing the loop yourself, step by step

My Personal Rule of Thumb

If I find myself doing the same "copy result, adjust, paste back" sequence more than three times for a single task, that's a signal it could probably be an agent. The loop already exists — I'm just running it manually.

What "Agentic" Products Actually Are

When you see products marketed as "agentic AI" — Cursor's agent mode, Claude Code's subagent feature, various autonomous coding tools — now you know what they're actually doing. They're running that observe-act-repeat loop under the hood.

Cursor's agent mode, for example, doesn't just write code when you ask. It can read your files, write changes, run the code, observe the error output, adjust the code, run it again, and keep going until it works or decides it needs to ask you something. That loop is what makes it feel genuinely different from autocomplete.

The same is true for things like deep research modes in ChatGPT and Claude. They're not just generating a long answer — they're running many searches, reading results, deciding what to look for next, and synthesizing at the end. The loop is doing real work.

The Honest Limitations

Agents aren't magic. A few things worth knowing going in:

They can get stuck in loops. Without a good stopping condition, an agent can thrash — making small adjustments, failing, adjusting again, never quite finishing. Good agent design includes explicit exit conditions and maximum iteration limits.

Errors compound. If the agent takes a wrong action early, everything after it might be built on that mistake. Prompts fail cleanly; agents can fail in elaborate ways that are hard to trace.

They're more expensive. Each loop iteration is a new inference call. A 15-step agent run costs 15x what a single prompt costs, plus any tool calls. For simple tasks, that's rarely worth it.

Debugging is harder. When a prompt gives you a bad answer, the problem is usually visible. When an agent goes wrong, you might need to trace back through 10 steps of intermediate actions to find where it went off track.

None of this means avoid agents. It means use them intentionally — for the tasks where the loop is genuinely what you need.

The Takeaway

The thing that separates an agent from a prompt isn't sophistication or length or tool access by itself. It's the loop. Observe, act, feed the result back in, repeat until done.

When you need that loop — when the task requires reacting to real-world feedback, taking multiple actions, or adapting based on what it actually finds — an agent is the right tool. When you don't need it, a well-crafted prompt is faster, cheaper, and easier to debug.

Most AI use cases are still prompts. But knowing the difference means you'll recognize the moment when something genuinely needs to run in a loop — and you'll know exactly what you're building when you get there.

Keep going

More tutorials in this category, or explore the full field guide.

More Getting Started Guides Official Docs ↗