AI Agents
LLM Applications vs AI Agents: What's the Difference?
The same refund question answered by an application and by an agent: where the boundary between them falls in real systems, why it can run between two decisions in the same workflow, and what changes when control moves from your code to the model.
On this page · 10 sections
Here are two support assistants. A customer asks each of them the same question:
Which of my invoices can still be refunded?
Both have a chat window and use a language model. A product page would call both an “AI assistant”, and plenty would call both agents.
The first is the assistant from “What Is an AI Agent? (opens in a new tab)”, originally built in “Function Calling and Tool Use in LLMs (opens in a new tab)”. Its code gives the model a tool that lists the customer’s invoices, a tool that searches the help center, and a loop: the model requests tools, reads the results, and decides what to do next, for up to five model calls. In Article #21, we read all 8 of its saved conversations on this question. None made both lookups, and no reply identified INV-1002 as the only refundable invoice.
The second assistant does the deciding in code, before the model sees anything:
from datetime import date
def refund_status(account: dict) -> list[dict]:
"""Refund status of each of the signed-in customer's invoices, decided in code."""
today = date.fromisoformat(account["today"])
window = account["refund_window_days"]
customer = account["customer"]["id"]
result = []
for invoice in account["invoices"]:
if invoice["customer"] != customer:
continue # only the signed-in customer's invoices
age = (today - date.fromisoformat(invoice["date"])).days
if age < 0:
raise ValueError(f"{invoice['id']} is dated after today")
status = "refundable" if age <= window else "outside the refund window"
result.append({"id": invoice["id"], "date": invoice["date"],
"days_old": age, "status": status})
return result
Run against the same data Article #8’s assistant used (today is 2026-11-12, and the window is 30 days), it returns:
[
{"id": "INV-1001", "date": "2026-09-28", "days_old": 45,
"status": "outside the refund window"},
{"id": "INV-1002", "date": "2026-10-28", "days_old": 15,
"status": "refundable"}
]
The application then hands that list to the model, and the model’s only job is to write the reply: INV-1002 can still be refunded, and INV-1001 is outside the 30-day window. Both facts are in what it was given; it doesn’t have to work either one out. That phrasing step wasn’t run for this article; the point is what the model no longer decides.
Implementation note: how the output above was produced
The function was run with Python 3.12.13 against data/account.json from the tool-calling demo, unchanged:
python3 refund_status.py tool-calling/data/account.json
refund_status.py is the function above plus two lines that load the file and print the result (line breaks adjusted above; the values are unchanged). The data’s third invoice, INV-2042, belongs to another customer. age <= window matches the demo’s refund tool, which refuses an invoice more than 30 days after its date. The output is deterministic: today’s date is fixed in the data, not read from the clock.
Lay the two assistants side by side, step by step:
application agent
1. code loads the customer's invoices 1. the model receives the question
2. code applies the 30-day rule 2. the model decides what it needs to know
3. code determines the result 3. the model requests tools; code runs them
4. the model phrases the answer 4. the model reads the results
5. the model decides whether to act again
6. the model writes the answer
Both could use the same model and the same tools. The difference is who owns the steps in the middle:
The difference between an LLM application and an AI agent is not how many tools it uses. It is who decides what happens next.
Try to Understand It This Way
Think of a recipe and a cook.
A recipe is a fixed path: chop, fry, simmer, season. A skilled cook can follow it, and their skill shows in every step. But the order was decided before they walked into the kitchen. Now hand the same cook an open fridge and say “dinner for four, please.” They look at what’s there, pick a dish, discover the milk has gone off, and change plans. Same cook, different job. Now they decide what happens next.
An LLM application uses the model the way a recipe uses a cook: for the steps that need skill, usually language, in an order your code decides. An agent hands the model the fridge.
A restaurant can use both at once: a fixed recipe for the sauce, an improvised special. And whoever decides the menu, the food-safety rules still apply.
The Test: Who Decides What Happens Next
Article #21 defined an agent as a system in which the model can choose actions, observe their results, and use those results to decide what to do next, within boundaries the application enforces. It turned that into three questions:
- Who chooses the actions: your code or the model?
- After the model sees a result, can it choose another action, or only answer?
- What can end the run?
Several common features look agentic and aren’t. None of these, on its own, makes a system an agent:
- Function calling. A model that requests one tool, after which code always produces the answer, has made one decision. That’s tool use.
- Retrieval. The RAG pipeline in “Designing a Production-Ready RAG Pipeline (opens in a new tab)” retrieves on every request because code says so.
- Several model calls. A chain of calls in a fixed order is a pipeline, however long.
- A chat interface. It decides how users talk to the system, not who controls its steps.
What makes a system an agent is the whole cycle: the model chooses an action, observes its result, and can use that result to choose what happens next. A model that classifies an input or picks a branch once has made a decision, but it doesn’t observe the result and use it to choose a subsequent action.
Where the Boundary Falls
Here are eight common patterns, run through those questions:
pattern who decides what happens next side
classification or extraction code; the model fills in one answer application
RAG pipeline (Article #14) code: retrieve, check, answer application
router the model picks a branch once; application, one
code runs it model decision
tool use with a forced answer the model picks one tool; application, one
code ends the run model decision
retrieval the model can repeat the model decides whether to agent
search again
generate and evaluate code fixes the steps; who decides workflow; one
whether to go round again depends agentic decision
on the design (below) if the model does
chat assistant between turns, the user; depends on
within a turn, see below the turn
agent with fixed-pipeline tools the model picks the pipeline agent
and what comes next
Four rows deserve a closer look, and the opening example adds a fifth case.
A router makes one decision
Anthropic’s “Building effective agents” describes routing as a workflow: “Routing classifies an input and directs it to a specialized followup task.” The model chooses the branch once and never sees what it produced. A router puts one model decision inside an application; it doesn’t make the application an agent.
Generate and evaluate: two honest descriptions
In the same guide’s evaluator-optimizer pattern, “one LLM call generates a response while another provides evaluation and feedback in a loop.” Anthropic classifies it as a workflow, and by its definition that’s right. The available steps and their order are predefined: generate, evaluate, and, if the loop condition says to continue, generate again.
Run it through Article #21’s questions, though, and the answer depends on what happens after each evaluation:
- The evaluator returns a score, and code compares it with a fixed threshold. Code decides whether to go round again. The control decision stays in code.
- The evaluator decides whether to continue or stop, and the orchestrator follows its verdict. Now the model chooses what happens next after observing a result, on a deliberately narrow choice. Anthropic’s own examples include this kind: search tasks “where the evaluator decides whether further searches are warranted.”
Both descriptions are useful. Anthropic’s label tells you the steps are fixed and testable. The control-flow test tells you whether a model decision needs a bound: in the second form, an evaluator can approve a weak draft too early or never be satisfied, so code must cap the iterations.
A chat assistant puts the user in the loop
In a chat assistant without tools, the next step is chosen every turn, but by the user. That is a person driving a loop, not an agent. Within a single turn, apply the test again: if the assistant can request a tool, read the result, and request another before replying, that turn runs an agent loop.
An agent with deterministic tools is still an agent
Imagine giving an agent Article #14’s entire RAG pipeline as one tool, answer_from_help_center(question), alongside the invoice tool. Every tool is deterministic, but the model still decides which to call, reads what comes back, and decides what to do next. Autonomy and deterministic execution coexist; the question is only who sequences them.
The refund workflow: a boundary between two decisions
There’s a complication with the opening example. OpenAI’s “A practical guide to building agents” lists three kinds of workflow that suit agents, and the first is “Complex decision-making: Workflows involving nuanced judgment, exceptions, or context-sensitive decisions, for example refund approval in customer service workflows.”
That isn’t a contradiction. It’s the boundary running through the middle of one workflow:
- Eligibility under a fixed rule is a decision for code. “Within 30 days of the invoice date” has exactly one right answer, and the function above computes it.
- Exceptions can need judgment. A mistaken charge found after 40 days, a week-long outage in the billing period, a request for a goodwill refund: these have no single rule, and that is where a model’s judgment might help.
- Even then, the hard limits stay in code. Which invoices the customer owns, the largest amount that can be refunded without review, and whether the customer actually asked for the refund are enforced by the application, never decided by the model.
The same guide gives the default for everything else: “Before committing to building an agent, validate that your use case can meet these criteria clearly. Otherwise, a deterministic solution may suffice.”
What Changes When Control Moves to the Model
Build the refund question both ways, and here is what changes:
application agent (Article #8's loop)
testing unit-test the rule; integration also check trajectories: which
and authorization tests; check tools, in what order, with which
the wording arguments, and whether the answer
follows from the results
failure handling explicit boundaries: each step is failures appear mid-run; the loop
a known place to catch and name needs stop conditions and a status
a failure for a failed run
model calls fixed in this implementation: variable: up to five allowed in
per request one, to write the reply this loop (one to three observed)
state orchestration state your code also the run's growing history:
defines every tool request and result
permissions code invokes the tools and the model requests tools; code
authorizes every call authorizes every request
observability a log line per step a trace of every decision in
the run
change prompts change wording; control prompts and tool descriptions can
management flow changes only when code does change the control flow itself
Every row is the same shift: a decision moved from code you can read to a model you have to evaluate. (Model calls aren’t the whole cost: tokens, response length, and pricing vary on both sides; Article #21 covers the costs of autonomy.) Two rows are easily missed.
Testing. A unit test pins the application’s rule down: INV-1002 refundable, INV-1001 not. The agent can’t be tested on its reply alone. Article #21’s 8 conversations took four different routes, none to the right answer, and a check on the final reply says nothing about the route.
Change management. Article #8 showed how directly a tool description steers an agent: the refund tool’s description gave “for example INV-1234”, and llama3.2:3b used INV-1234 in four conversations, for a customer whose invoices are INV-1001 and INV-1002. Review and test those edits like code.
Crossing the Boundary Only Where It’s Needed
The eight patterns point to one idea: an AI agent isn’t necessarily a different product. It can be a different execution model inside an existing application.
Here is one way a support application could be laid out, decision by decision:
step who decides
authenticate the customer code
fetch the customer's invoices code
check refund eligibility code (refund_status)
gather anything else the reply needs the model, in a small loop: search the help
center, or ask the customer a question; read
the result; then search again, ask again, or
stop (at most three model calls, set in code)
handle an exception request the model proposes; code enforces the limits;
the customer confirms the exact action
write the reply the model
Most of this system is an application. One step is a real agent loop: the model chooses between two actions, reads what comes back, and decides again, until it stops or code stops it. When it stops, control returns to fixed application logic. The exception path holds one more model decision. Each is small enough to test and bounded by code on both sides. That is usually more useful than turning the whole assistant into an agent because one part needs judgment.
It works from the other side too. When a task really does need an agent, keep moving known logic into its tools. refund_status is as useful as a tool an agent calls as it is in an application: either way, the model no longer has to work out a rule the code already knows.
What Breaks When the Boundary Is Unclear
These follow from the definitions, not from a measured study.
A loop the task didn’t need. Article #21’s assistant had a five-call loop for a question that a fifteen-line function answers correctly, for this data and this fixed rule, on every run. The loop added cost, variability, and new ways to fail, and the task gained nothing from it.
An agent tested like an application. A suite that checks only final replies, on inputs that happened to take short paths, passes while the trajectories go untested. The first different route in production is unchecked.
An application that quietly became an agent. Someone adds a step: “if the answer looks wrong, let the model try again with the tools.” Now the model chooses actions after seeing results, and the system needs what an agent needs: limits on model calls, a budget, authorization on every action, and traces. Because it’s still called “the support bot”, nobody adds them. The name didn’t change; the control flow did.
What to Take Away
- The test is who decides what happens next. Tools, retrieval, several model calls, and a chat window don’t make a system an agent. A model that sees a result and can choose another action does.
- “Agent” describes part of a system, not a product. An application can contain one agentic step; an agent can run deterministic tools.
- The boundary can run through one workflow. Fixed rules belong in code; judgment calls may belong to a model; hard limits and authorization stay in code either way.
- Crossing the boundary changes the engineering: testing, failure handling, cost, state, permissions, observability, and change management.
- Give the loop only to the decisions that need it. Everything around them can stay an application.
Think About These Use Cases
-
A meeting-notes summarizer: It summarizes a transcript and can create tickets. Which side of the boundary is it on, and what single change would move it across?
-
“Search again if the results look weak”: You add this to a RAG pipeline and let the model decide. What did you just build, and which tests and limits does it now need?
-
Refund exceptions: Design the exception path for a refund outside the 30-day window. What does code decide, what does the model propose, and who confirms?
-
A vendor’s “agent”: You’re evaluating a product sold as an AI agent. Which three questions would tell you what it actually is?
-
A chat assistant with tools: In which turns is it an agent, and what would you log to know?
If you want to talk one of these through, take it to GPT along with this article. Ask GPT ↗️
Related Sources
- Anthropic: Building effective agents (December 2024): Workflows (prompt chaining, routing, evaluator-optimizer, and others) versus agents, with when to use each. The page notes that the tooling it describes has changed since publication.
- OpenAI: A practical guide to building agents (PDF): When to build an agent (complex decisions, hard-to-maintain rules, unstructured data) and when a deterministic solution may suffice.
- tool-calling: Article #8’s companion demo. The function in this article was run against its
data/account.json; the agent version’s loop is inpython/agent.py.
What’s Next?
Both assistants used tools. In the application, code called them; in the agent, the model asked and code decided whether they ran. Either way, tools are where a decision becomes something that happens.
In the next article, we’ll look at Tools, Function Calling, and the Foundation of AI Agents: tools as the bridge between a model’s decision and an action, and how to design them so that decision is safe to hand over.