I killed an agent in production last week. Replaced it with 30 lines of Python. The script is faster, cheaper, never hallucinates, and I sleep better. This is a story about when not to use AI agents, told by someone who builds them for a living.
The agent hype has a blind spot. Everyone's writing about how to build agents. Almost nobody's writing about when an agent is the wrong tool — and that's the more useful skill, because reaching for a reasoning loop when you needed a for loop is the most expensive mistake in this whole space.
The tell: is the task deterministic?
Here's my first filter. If the same input should always produce the same output, you don't want an agent. You want code.
Parsing a CSV into JSON. Renaming files by a pattern. Calling an API and reshaping the response. Validating that every record has an email field. These are deterministic. An agent will do them, sure, but it'll do them slowly, expensively, and with a nonzero chance of deciding to "improve" your schema unprompted. A script does them in milliseconds for free, the same way every time.
The rule of thumb: agents are for tasks where the path is unknown. If you can write down the steps, write down the steps. Don't pay a model to rediscover them on every run.
Where agents actually earn it
Agents shine when the task has genuine ambiguity that needs judgment at runtime. "Look at this failing test, figure out why, fix it." "Read this messy support ticket and route it." "Given these three half-broken approaches, pick one and finish it." The path branches based on what the agent discovers. You can't pre-script it because you don't know what you'll find.
That's the dividing line. Unknown path, runtime judgment, fuzzy input. If your task has all three, agent. If it has none, script. The interesting cases are in the middle, and that's where people screw up — they see a little ambiguity and reach for the full reasoning loop when a script with one LLM call in the middle would've done it.
The hybrid is usually the answer
My favorite pattern isn't "agent" or "script." It's a script that makes one focused model call where the judgment actually lives.
# Not an agent. A pipeline with a brain in one spot.
rows = parse_csv(path) # deterministic
for r in rows:
r["category"] = classify(r) # one LLM call, structured output
write_json(rows) # deterministic
The classify call does the fuzzy part — reading freeform text and bucketing it. Everything around it is plain code. No multi-turn loop, no tool-use dance, no agent deciding to go explore your filesystem. You get the model's judgment exactly where you need it and nowhere you don't. This is cheaper than an agent by an order of magnitude and you can actually test it.
The cost of a loop you didn't need
Let's talk money, because the bills are real. An agent that loops — read, think, call tool, observe, think again — re-sends the growing context every single turn. A task that takes eight turns can re-process your whole conversation eight times. I've seen a "simple" agentic task burn more tokens than the entire codebase it was working on, because it kept re-reading files it had already read.
For a deterministic task, that's pure waste. You paid for reasoning the task didn't require. Multiply that across a cron job running hourly and you've built a money incinerator that a sed command would've replaced.
Latency and trust, the quieter costs
There's also the stuff that doesn't show up on the invoice. Agents are slow. A reasoning loop with tool calls takes seconds to minutes. If you're putting that in a user-facing hot path — say, validating a form submission — you've made your product feel broken to save yourself writing a regex.
And trust. A script that's wrong is wrong predictably; you fix the bug and it's fixed forever. An agent that's wrong is wrong creatively, differently each time, and "fixing" it means tweaking a prompt and praying. For anything where correctness is non-negotiable — money movement, auth, data deletion — I want code I can read and a test I can run, not a model I can only nudge.
My actual checklist
Before I let a task be an agent, it has to pass all of these:
- The path genuinely varies based on what we find at runtime.
- A human would need judgment, not just rule-following, to do it.
- The input is messy enough that code can't reliably parse it.
- Occasional weirdness in the output is survivable.
Fail any one? It's probably a script, or a script with a single LLM call bolted in.
The uncomfortable truth
The push to make everything an agent is partly tooling companies selling you agents. Of course the agent framework wants every problem to be an agent problem. That's the business model.
Your job is narrower and more honest: solve the problem with the least machinery that works. Sometimes that's a sophisticated multi-agent system. Often it's a Python file you could've written in 2015. The senior move is knowing which, and not being too proud to ship the boring one. My production script doesn't have a reasoning loop. It also hasn't paged me once.
