What Is an "Agent"?
The jump from a chatbot that answers to a system that acts — reads files, runs commands, checks its own work.
Big idea
An agent is a model working in a loop — perceive, plan, act, verify — until the goal is met, and the verify step is what separates real usefulness from firing off actions blindly.
The idea
A plain chatbot's whole job is a single exchange: you write, it replies, done. An agent is given a goal instead of just a question, and it keeps working — taking an action, looking at the result, deciding what to do next — until the goal is actually met or it needs your input. The animation below shows the shape of that loop.
Think of it like
Think of a cook making soup without a recipe. They look into the pot, decide it needs salt, add a pinch, and taste. Still bland? Another pinch. Too thick? A splash of water, then taste again. They keep going until it is right, and only call you over when they genuinely need your opinion. Someone who adds salt once and walks away is just making a guess. An agent is the tasting cook: it perceives the current state, plans a change, acts on it, checks the result, and repeats until the goal is actually met.
The loop, concretely
- Perceive — read the current state: a file's contents, a command's output, an error message.
- Plan — decide what to do next given that state and the overall goal.
- Act — actually do it: edit a file, run a command, call an API.
- Verify — check whether that action worked, and whether the goal is now met.
A plain chatbot only ever does step 2 — it plans a reply and stops. An agent repeats all four steps, often dozens of times, without you re-prompting it at every step.
Why "checks its own work" is the important part
The verify step is what separates a genuinely useful agent from something that just fires off actions blindly. A coding agent that edits a file and stops has done half the job; one that then runs the tests, reads the failure, and fixes what's actually wrong is doing something closer to how a careful engineer works. This is also where a lot of an agent's real value comes from — not the individual action, but the willingness to check, and to try again if the check fails.
What this needs from the underlying model
None of this requires a fundamentally different kind of model — it requires the same LLM from the previous topic, given: a way to take actions (tools), a way to see the results (the tool's output fed back in), and enough instruction to actually use the loop instead of guessing and stopping after one step. The next tier gets into exactly how that tool-calling actually works.
The loop, in code
Every agent is some version of this:
messages = [{"role": "user", "content": task}]
while True:
reply = model(messages, tools=TOOLS) # the model decides
messages.append(reply)
if not reply.tool_calls: # no action requested: done
return reply.content
for call in reply.tool_calls: # the app acts
result = run_tool(call.name, call.arguments)
messages.append({"role": "tool", "tool_call_id": call.id, "content": result})
The model never runs anything itself. It returns requests ("call get_order with 5512"); your code runs them and feeds the results back. That split is where you add permissions, confirmations, and limits.
Watch one run
Key terms
- Agent — A model given a goal that keeps taking actions and checking results until the goal is reached.
- Agent loop — The repeating cycle of perceive, plan, act, and verify that an agent runs through.
- Verify step — The point where an agent checks whether its last action worked and whether the goal is done.
- Tools — The abilities an agent is given to take real actions, like editing files or running commands.