Two words, two economics
"Automation" hides two very different animals. A script executes a fixed sequence: fetch, transform, write, done. An agent evaluates: look at what came back, decide the next step, retry differently, escalate when stuck. The script costs less to build and run. The agent survives change.
When a script is the right answer
If the input format is stable, the failure mode is harmless, and a human checks the output anyway - write a script. A nightly export, an invoice renamer, a report generator. I have written hundreds. Paying agent prices for script problems is how AI budgets die.
When only an agent survives
The moment the input is messy or the failure is expensive, the calculus flips. Reading supplier emails that free-text their orders. Reconciling data that three systems disagree on. Watching a process where "it silently did the wrong thing for three weeks" costs more than the build. A script meets the unexpected and either dies loudly or - worse - continues quietly wrong. An agent notices, retries with a different approach, and calls a human when it should.
The test I use
One question sorts almost every case: if the input changed shape tomorrow, what should happen? If the honest answer is "it should stop and tell someone", a script with good alerts is enough. If the answer is "it should figure it out and keep going, because stopping costs us money every hour" - that is an agent, and it needs state, evals and cost ceilings, which is engineering, not prompts.
I build both, and I will happily tell you your problem is a script - it is cheaper for you and faster for me. Describe the process and you will get a straight answer on one call.