AI engineering / Core / 02.20
Where agents pay off
Which jobs are worth letting a model act on, which are better as a fixed list of steps, and where a person must still say yes.
13 min readFree
Letting a model act, on purpose
The last lesson, RAG vs Fine-tuning, ended with a promise: next, agent use cases, where letting a model act is worth it. Here they are.
An agent is a model that does not only answer. It acts. It looks things up, runs tools and changes things, one step after another. That sounds exciting, and it is also slower, more costly and harder to predict than a plain answer. So the real skill is knowing when it is worth it.
Think of two ways to get a cake. You can follow a recipe card, where every step is written down. Or you can hand a friend a kitchen and say "make something good for the party". The card is safe and the same each time. The friend can handle surprises, such as a missing egg, but you must trust them.
Key words
- Workflow
- A job where code decides the steps. The model may do some steps, but the order is fixed in advance.
- Agent
- A job where the model decides the next step, over and over, until it thinks it is done.
- Tool
- Something the model can ask your code to do, such as search, read a file or send a message.
- Human checkpoint
- A place where the work stops and a person looks before anything goes on.
Workflow or agent
Anthropic's engineering post, Building effective agents, draws one clear line. It says that workflows are "systems where LLMs and tools are orchestrated through predefined code paths". Agents, on the other hand, are "systems where LLMs dynamically direct their own processes and tool usage".
In daily words: in a workflow, your code holds the map. In an agent, the model holds the map and may change its mind on the way. Wikipedia describes an intelligent agent in general as an entity that "perceives its environment, takes actions autonomously to achieve goals". An agent in our sense looks at what happened, then picks the next move.
The same post gives advice that is easy to forget. It recommends "finding the simplest solution possible, and only increasing complexity when needed", and says this might mean not building agentic systems at all. It also says: "Agentic systems often trade latency and cost for better task performance". Latency means waiting time. So an agent can do harder jobs, but you pay in time and money.
Tip
Start every idea with one plain question: can I write the steps on a card today? If yes, build the card. Reach for an agent only when you cannot.
Five workflow patterns to know
The same post lists five ways to build a workflow before you reach for a full agent. They are worth knowing by name, because a good number of jobs fit one of them. Here they are in the post's words, shortened.
Key words
- Prompt chaining
- Split a task into a sequence of steps, where each model call works on the output of the one before. You can add a programmatic check, called a gate, between steps.
- Routing
- Classify an input and send it to a specialised follow-up task, such as general questions, refund requests and technical support going to different paths.
- Parallelization
- Run model calls at the same time and combine the results. The post names two kinds: sectioning (independent parts in parallel) and voting (the same task run several times).
- Orchestrator-workers
- A central model breaks a task into parts as it goes, hands them to worker models and puts the results together. The post says the subtasks are not pre-defined.
- Evaluator-optimizer
- One model call writes an answer and another gives feedback, in a loop, until the answer is good.
Notice the difference. The first four patterns still sit inside code that you wrote. A true agent goes one step further. The post describes agents as "typically just LLMs using tools based on environmental feedback in a loop".
Where agents earn their cost
The post says agents can be used "for open-ended problems where it's difficult or impossible to predict the required number of steps, and where you can't hardcode a fixed path". It warns that this autonomy means "higher costs, and the potential for compounding errors". A compounding error is a small mistake early on that grows, because later steps build on it.
So the test is simple. If you cannot say the steps in advance, and a mistake can be caught and fixed, an agent may pay for itself. Below are five jobs that pass. Support and coding come from the post, and research echoes its search examples. Data clean-up and scheduling are our own examples.
Research
You ask: "Find out how three rival shops price delivery." You cannot know how many pages you will need. The post names search as an example for orchestrator-workers and for evaluator-optimizer, where the evaluator decides whether more searching is warranted.
Tools needed
Web search, a page reader, and a notes file where the agent keeps what it found.
Risks
It may trust a weak page, quote something wrongly, or wander for ever. Cap the number of turns.
Human checkpoint
A person reads the sources behind the summary before anyone acts on it, and checks any number that matters.
Coding with tests
You ask: "Fix the bug where the cart total is wrong." Which files change depends on what the agent finds. The post says coding is a good fit because "code solutions are verifiable through automated tests" and agents "can iterate on solutions using test results as feedback".
That second point is the secret. The tests give the agent real feedback at every turn, instead of a guess. But the post adds: "human review remains crucial for ensuring solutions align with broader system requirements".
Tools needed
Read and edit files, run the test suite, search the project.
Risks
It may change tests to make them pass, edit files it should not touch, or fix the symptom but not the cause.
Human checkpoint
A person reviews the whole change before it is merged. Work on a copy, never the live project.
Customer support that needs actions
A customer writes: "My order never came." The agent must read the order, check delivery, read the shop rules and maybe act. The post calls support "a natural fit for more open-ended agents", with tools to pull customer data and run actions, and success "clearly measured through user-defined resolutions".
Tools needed
Look up an order, read help articles, update a ticket, and (with limits) start a refund.
Risks
It may promise something the shop cannot give, show one customer's data to another, or refund by mistake.
Human checkpoint
Money moves only after a person approves, and the agent hands over to a human when it is stuck or the customer is upset.
Data clean-up
Our own example, not from the post. A customer list has typos, missing emails and doubles. You only learn the kinds of mess by looking, and one fix may show another. The second program below does this: look, fix, look again.
Tools needed
Read rows, change a row, count the problems left, and save a copy.
Risks
A "fix" can be wrong and quietly spoil good data. Deleted rows are hard to bring back.
Human checkpoint
The agent works on a copy, lists every change, and a person approves before the original is replaced.
Scheduling
Our own example too. "Find a time for five people next week." If Tuesday fails, try Wednesday. What to do next depends on what the calendars say.
Tools needed
Read calendars, check free times, draft an invite.
Risks
It may book over something important, or invite the wrong people.
Human checkpoint
It proposes times and a person presses send. Sending invites to other people is not something to undo quietly.
When a fixed workflow is better
Now the other side. Some jobs should never be an agent, even if you could build one. Three signs point to a workflow.
- 1
The steps are known
Turn an invoice into a receipt. Read it, fill in a template, save it. The post says workflows offer "predictability and consistency for well-defined tasks". A card beats a friend when the cake never changes.
- 2
The rules are strict
Tax rules, safety checks and legal wording must come out the same every time. A model that can give a different answer each run is the wrong tool for the rule itself. It may still help with a step, such as drafting a sentence, inside code that holds the rule.
- 3
The action is high-risk
Paying money, deleting records, sending to thousands of people. Let code run the fixed steps and put a person at the gate. If the action cannot be undone, do not let a loop decide it alone.
Tip
A good middle road: a workflow where one step is an agent. For example, a fixed refund process (check order, check rules, ask a person) where only "find out what went wrong" is left to an agent.
Quick check
A shop wants to approve refunds over a set amount. Which is the best fit?
Try it: a router and two traces
Time to see the difference. First, a router. It reads six made-up requests and decides: workflow or agent. It uses plain rules, said simply. If a request has a risky word (refund, delete, pay, transfer), it is a workflow with a person signing off. If it has an open-ended word (why, find out, research, clean up, investigate), it is an agent. Anything else is a workflow.
This is a stand-in router made of keywords, so it runs free. A real router could be a model or a trained classifier, which is slower, costs money, and can be wrong or give different answers. Keyword rules are crude, but enough to show the idea.
# A router stand-in: plain rules, no model. A real router could be a model.
HIGH_RISK = ["refund", "delete", "pay", "transfer"]
OPEN_ENDED = ["why", "find out", "research", "clean up", "investigate"]
def route(request):
text = request.lower()
for word in HIGH_RISK:
if word in text:
return "workflow", "risky action (" + word + "): fixed steps and a person signs off"
for word in OPEN_ENDED:
if word in text:
return "agent", "open-ended (" + word + "): steps not known up front"
return "workflow", "steps are known"
requests = [
"Turn invoice 7 into a PDF receipt",
"Send the monthly newsletter",
"Find out why checkout fails on phones",
"Research three rival shops",
"Refund order 1042",
"Clean up this messy customer list",
]
for r in requests:
kind, why = route(r)
print(kind.ljust(8), "|", r, "->", why)Output
workflow | Turn invoice 7 into a PDF receipt -> steps are known workflow | Send the monthly newsletter -> steps are known agent | Find out why checkout fails on phones -> open-ended (why): steps not known up front agent | Research three rival shops -> open-ended (research): steps not known up front workflow | Refund order 1042 -> risky action (refund): fixed steps and a person signs off agent | Clean up this messy customer list -> open-ended (clean up): steps not known up front
Now run one job each way. The first is a three-step workflow for the receipt. The second is an agent loop for the messy customer list, with a cap of 5 turns.
Notice the stand-in. `fake_model` is a few lines that return fixed text, so the code runs free with no keys and no network. It does not think. A real model is slower, costs money for every token, can give a different answer each run, and can fail or refuse. The agent trace below is scripted to look the way a good run would.
# Stand-in for a model: fixed text so this runs free.
def fake_model(messages):
last = messages[-1]
if last.startswith("Write a thank-you line"):
return "Thanks for your order, Mina!"
if last.startswith("Observation: 3 rows look wrong"):
return "ACTION fix_rows"
if last.startswith("Observation: fixed 3 rows"):
return "ACTION find_problems"
if last.startswith("Observation: 0 rows look wrong"):
return "ACTION ask_person"
return "ACTION find_problems"
# Fixed workflow: three steps, always in this order.
def run_workflow(invoice):
print("WORKFLOW trace")
fields = {"name": invoice["name"], "total": invoice["total"]}
print(" step 1 read invoice ->", fields)
line = fake_model(["Write a thank-you line for " + fields["name"]])
print(" step 2 model writes ->", line)
ok = len(line) < 60 # gate: a plain check, not a model
print(" step 3 gate (line is short):", ok)
return "receipt saved" if ok else "stopped at gate"
# Agent loop: the "model" picks the next action. Capped at 5 turns.
def run_agent(rows, max_turns=5):
print("AGENT trace")
messages = ["Goal: clean the customer list"]
for turn in range(1, max_turns + 1):
action = fake_model(messages).replace("ACTION ", "")
if action == "find_problems":
bad = [r for r in rows if "@" not in r]
result = str(len(bad)) + " rows look wrong"
elif action == "fix_rows":
rows = [r if "@" in r else r + "@example.com" for r in rows]
result = "fixed 3 rows"
else:
print(" turn", turn, action, "-> stop, a person checks the result")
return rows
print(" turn", turn, action, "->", result)
messages.append("Observation: " + result)
print(" hit the cap of", max_turns, "turns, stopping")
return rows
print(run_workflow({"name": "Mina", "total": 40}))
rows = ["a@x.com", "bob", "cy", "dee", "e@x.com"]
print(run_agent(rows))Output
WORKFLOW trace
step 1 read invoice -> {'name': 'Mina', 'total': 40}
step 2 model writes -> Thanks for your order, Mina!
step 3 gate (line is short): True
receipt saved
AGENT trace
turn 1 find_problems -> 3 rows look wrong
turn 2 fix_rows -> fixed 3 rows
turn 3 find_problems -> 0 rows look wrong
turn 4 ask_person -> stop, a person checks the result
['a@x.com', 'bob@example.com', 'cy@example.com', 'dee@example.com', 'e@x.com']The workflow ran steps 1, 2, 3 in order. The agent took four turns: it found 3 bad rows, fixed them, looked again, then handed over to a person. It never knew in advance it needed two looks. The loop has a cap, so it cannot spin for ever, as the post says agents often include "stopping conditions (such as a maximum number of iterations)" to keep control..
Before you build one
Run this short check on any idea. Each answer points the same way.
- 1
Can I write the steps?
If yes, build a workflow. If the number of steps changes with every input, an agent may fit.
- 2
Can the agent tell if it is right?
Tests, a lookup or a measurable result give it real feedback. Without that, it is guessing in a loop.
- 3
What is the worst mistake?
If it is small and can be undone, an agent can try. If it is big or permanent, use fixed steps and a person.
- 4
How will it stop?
Set a turn cap and a budget. The post warns about compounding errors, so a loop that runs on is a risk, not a feature.
Quick check
Which job suits an agent best?
Quick check
What should a loop always have?
What to remember
Agents earn their cost on open-ended jobs where the steps are not known, the work gives feedback, and a mistake can be caught. Workflows win when the steps are known, the rules are strict or the action is risky. Either way, decide where a person looks before you build.
Next: multi-agent systems, several helpers working on one job.
Sources
Last updated on 16 November 2026
Learn with me
Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.