Agent versus chat: the goal → plan → act loop
A chat answers and stops. An agent takes a goal — and works: plans steps, calls tools, checks results and continues until done. We dissect the agent loop turn by turn, trace a real task, and see why there is no new magic inside an agent — the same model, but in a loop.
Everything you've studied so far has been a dialogue: you ask → it answers → you decide what's next. An agent takes the "what's next" for itself. In the previous lesson we agreed on a working definition of an agent; now let's take apart the mechanism the whole course rests on — the loop.
The agent loop
- Goal: "find 10 suitable advertising venues and collect their prices in a table".
- Plan: the agent breaks the goal into steps: search for venues → open each → find the rate card → write it down.
- Action: it calls a tool — an external operation available to the model: search, read a page, write to a sheet. Tools are the "hands" the 2022 chat lacked.
- Observation: it gets the action's result and evaluates: did it work? is there enough data? The result of each action is literally called an observation.
- Repeat — from step 2, until the goal is met (or the turn limit trips — a safeguard against endless loops, covered in the reliability module).
The key difference from chat: the model makes the decisions inside the loop, not you. You set the goal, boundaries and tools — the agent builds the route itself.
A mini-trace: three turns through the agent's eyes
Here is what the loop looks like from inside — on our venues task:
- Turn 1. Thought: I need a list of venues. Action: search "advertising in cooking blogs". Observation: 12 links, 7 look like blogs.
- Turn 2. Thought: open the first one. Action: open link #1. Observation: the page failed to load — error.
- Turn 3. Thought: dead link — mark it, take the next. Action: open link #2. Observation: there is an "Advertise" page with a price. Writing it to the table.
Look at turn 2: the tool returned an error — and the agent revised the plan instead of stubbornly pushing on. Observation is what makes the loop alive. Remember AutoGPT from the previous lesson? It failed exactly here: it convinced itself the step succeeded and dragged the invented "success" into the next turns.
An agent is not a new model
Let's remove the magic: inside an agent runs the same language model as in chat. The difference is the harness around it: the loop, the tools and the memory (what the agent keeps between turns — a separate lesson ahead). So the agent inherits all the model's weaknesses: it can err, it can "see" things that aren't there. And the loop amplifies both skills and mistakes: a wrong observation on turn 2 becomes the input of turn 3.
If it's the same model inside, why does an agent handle tasks a chat can't? Think before reading on.
The answer: a chat must deliver everything in one shot, while an agent can try, look at the result and correct itself. Not more intelligence — more attempts, and each next one leans on reality (observations), not on a guess.
You've already seen agents
- Deep research — a search agent: it plans queries, reads sources, assembles a report. Its loop: query → read → "what's missing?" → new query.
- Coding agents (Claude Code, Replit and others) — they write code, run it, see the error, fix it. Running the code is their "observation".
- The agent node in n8n — the automation builder our platform covers in a separate course: the node itself decides whether to check the sheet or run a search.
Same pattern every time — now you know its name and can see its loop.
When you need an agent, and when a chat or a workflow will do
- A one-step answer → a chat.
- A fixed chain of steps → a workflow (arrows in n8n): a human wrote the route in advance — cheaper and more predictable.
- Steps unknown in advance, depending on findings → an agent.
The classic rookie mistake is an agent where a workflow would do. An agent isn't "cooler" — it's "more flexible at a price": every turn is a separate model call, so it's costlier, slower, less predictable. A whole lesson is devoted to this choice — right after the map of applications.
Sandbox: feel the difference with your hands
Send two prompts one after another and compare. First a regular chat:
Answer in one paragraph: how do I plan a new product launch?
Now make the model act out an agent:
Act as an autonomous agent. GOAL: plan a new product launch. Work in a loop: Thought → Action (tool call) → Observation. Tools are imaginary only: search(query), calendar_add(event), send_email(to, text). Show 5 turns of the loop, invent plausible observations. After turn 5 — STOP and a brief summary: done vs remaining.
The contrast between the first and the second answer is the definition of an agent: not "an answer" but "work in a loop".
Do it now
Run both sandbox prompts. In the second answer find a turn where an observation changed the plan. If there isn't one — add the line "on turn 3 the tool returns an error" to the prompt and watch the model reroute.
Short questions on the lesson — with an explanation for every answer.