LLMs vs AI agents: what actually changes
An agent is not a bigger model. It's a loop around one, with tools, memory and the authority to act. Learn where the line is and why it matters for reliability.
People call almost anything with a model in it an "agent". There is a real difference underneath, and it's worth being precise, because it changes how you build, test and secure what you make.
The mechanical difference
An LLM call is like a function: text in, text out, once. An agent is a loop around that function. Between rounds it can take real actions, and it decides for itself when to stop.
A plain LLM call
- —One request, one response
- —You decide every step in advance
- —No side effects — only text
- —Fails visibly and immediately
- —Cost is bounded and predictable
An agent
- —Loops until a goal is met
- —Chooses its own next step
- —Acts via tools — real side effects
- —Can fail quietly, mid-plan
- —Cost depends on how long it runs
The four ingredients
- A goal — an end result to reach ("book the cheapest flight"), rather than a single instruction.
- — function calling, from the previous lesson. Without tools, an "agent" is just a chatbot talking to itself.
- — observe the result, decide the next action, repeat.
- — the answer is reached, or a runs out. This one is not optional.
let history = [userGoal];
for (let step = 0; step < MAX_STEPS; step++) {
const decision = await model(history, tools);
if (!decision.functionCall) return decision.text; // done
const result = await runTool(decision.functionCall); // act
history.push(decision, result); // observe
}
throw new Error("Step budget exhausted");That is the entire pattern. Every agent framework you'll come across is this loop plus extras: ways to manage memory, planning prompts, retries and logging. Once you see the loop underneath, frameworks are much less mysterious, and it's clear you can write one yourself. You will, when you build the agent loop by hand.
What gets harder
Letting the model decide is both the benefit and the problem:
- Mistakes build on each other. A wrong turn at step two quietly shapes steps three through eight.
- Costs become unpredictable. You don't know in advance how many rounds it will take.
- Every tool is a new risk. Each one adds to your , and a now causes actions, not just text.
Going deeper — production agents are usually state machines
Tutorials present agents as free-form loops that decide everything themselves. Teams running them in production — banking, support, anything touching money or personal data — rarely do that, because a fully autonomous loop is impossible to audit and impossible to bound.
What they build instead is a : explicit states with defined transitions, where the model chooses between a small set of permitted next steps rather than anything it can imagine. Frameworks like LangGraph and durable-execution engines like Temporal exist largely to make this shape easy to express, resume and inspect.
The trade is real: you give up some flexibility and gain the ability to say exactly what your system can and cannot do. In a regulated domain that is not a limitation, it is the requirement.
Summary of key terms
- Model — the weights. Gemini, Claude, GPT.
- LLM application — a model call wrapped in a product. A summarizer, an autocomplete.
- Agent — an application that loops, chooses actions and calls tools to reach a goal.
- Multi-agent system — several agents with different roles passing work between them. Powerful, but much harder to debug.
Key takeaways
- An LLM call is one request and one response. An agent is a loop that chooses and takes actions.
- Every agent needs a goal, tools, a loop and a stopping condition.
- If you can list the steps in advance, write a plain workflow instead of an agent.
Sign in to run the exercise
Reading is free. Writing code here needs an account so we have somewhere to keep your Gemini key and the +20 XP you are about to earn.