Blog · Engineering

Sometimes the answer is a script, not an agent

Every tedious process starts to look like it needs a language model when agentic AI is the only tool in your belt. Most of the time it doesn’t. Here is the test we run before we reach for an agent.

Key takeaways

  • If the inputs are structured and the rules can be written down, write a script. Agents earn their cost on ambiguity.
  • Scripts are cheaper per run, faster, consistent and easy to test. Agents add per-call cost, latency and variation.
  • The best systems are hybrids: scripts do the repetitive spine, a model handles the one messy step, and a person handles exceptions.
  • Measure cost per run, latency and error rate before you commit. Let the numbers choose the tool.

Why an AI agent is not always the answer

Agentic AI is the loudest idea in automation right now, and for good reason: agents can read messy input, choose between tools and carry a multi-step job through on their own. But each of those abilities has a price tag, and a lot of the work businesses want automated needs none of them.

A language model call costs money every time it runs, takes seconds rather than milliseconds, and can give a slightly different answer to the same input. A script does the same job for a fraction of the cost, finishes almost instantly, and behaves identically on run one and run one million. If a task is deterministic (same input, same rule, same output), paying for reasoning you don’t need is just a more expensive way to get a less predictable result.

That is the core of business process automation done properly: use the cheapest, most reliable tool that fully solves the problem, and save the expensive one for the part that genuinely needs it.

The four-question test: script or agent?

Before we reach for an agent, we ask four questions about the process. They take about ten minutes and settle most debates.

  1. Are the inputs structured?Rows in a spreadsheet, fields from an API or a fixed form point to a script. Free-form emails, scanned documents and chat messages point to a model.
  2. Can you write the rules down?If you could hand a new hire a checklist and they could follow it without asking questions, you can write it in code. If the honest answer is “it depends, I just know when I see it”, that is judgment.
  3. What does a wrong answer cost?An invoice posted to the wrong account is expensive. A draft reply that a person reviews is cheap. The higher the cost of an error, the more you want deterministic logic, tests and a human check.
  4. How often does it run?A small per-call cost is trivial once a day and a real line item at tens of thousands of runs a month. Volume turns small per-run costs into big ones.

Rule of thumb

Use AI agents for judgment and scripts for repetition. If a step is repetitive and rule-based, make it code. If it needs interpretation, give only that step to a model.

Script vs AI agent, side by side

Deterministic script vs LLM-based AI agent
CriteriaPython scriptAI agent (LLM-based)
Best forStructured, rule-based, repetitive workAmbiguous input, language and judgment calls
Cost per runClose to zero, plus fixed hostingPay per token or call; grows with volume
SpeedMilliseconds to secondsSeconds, and longer for multi-step reasoning
ConsistencySame input, same outputCan vary between runs
TestingStandard unit and integration testsNeeds evaluation sets and spot checks
Typical failureLoud: it errors and stopsQuiet: a confident but wrong answer
MaintenanceChanges when rules or APIs changeAlso revisited when prompts or models change

Where each one wins in practice

Scripts are the right call for

  • Moving records between two systems that use fixed fields
  • Nightly or weekly reports, reconciliations and data pulls
  • Validating, cleaning and de-duplicating data against clear rules
  • Filing, renaming and routing documents by a known pattern
  • Anything that must be auditable and identical every time

Agents earn their cost when you need to

  • Classify free-text emails, tickets or form answers
  • Extract fields from messy or inconsistent documents
  • Draft replies or summaries that a person approves
  • Choose between several tools or steps based on context

Our Python automation work covers the first list and our AI agents and chatbots cover the second. Plenty of projects use both.

The hybrid pattern that scales

The best production systems rarely pick a side. They use a script as the spine and call a model only where interpretation is unavoidable.

  1. The script receives and validates the inputFixed rules handle everything that can be handled with rules.
  2. A model handles the one messy stepFor example, reading a free-text request and returning structured fields. Ask for a strict format and let code check the result.
  3. Code validates the model’s outputIf the output fails the schema or a sanity check, retry it or route it to a person instead of passing it on.
  4. A person reviews the exceptionsLow-confidence or high-value cases land in a review queue. This human-in-the-loop step is what lets you trust the rest to run unattended.

If you do give an agent tools, keep them narrow and well defined, increasingly through open standards such as the Model Context Protocol (MCP), rather than broad access to everything. An agent that can only do three things can only go wrong in three ways.

Decide with numbers, not hype

Don’t pick the tool by how impressive it sounds. Run the process both ways on a small sample and measure three things:

  • Cost per run, including model usage, hosting and the time people spend fixing mistakes
  • Latency, from trigger to finished result
  • Error rate, counted against a sample a person has checked by hand

Then iterate. Over time you build a library of small scripts that each remove one chore, and the savings compound without adding headcount. That is how modern teams scale without scaling cost.

Not sure which side your process falls on? That is exactly what the free audit settles, and we will tell you honestly if the answer is “a script”.

Frequently asked questions

What is the difference between an AI agent and an automation script?

A script follows fixed instructions you wrote in advance, so it does the same thing every time. An AI agent uses a language model to interpret input and decide which steps or tools to use, which makes it flexible but less predictable and more expensive to run.

Is agentic AI worth it for a small business?

It can be, for language-heavy work such as triaging emails or extracting data from messy documents. For fixed-rule chores like syncing data or generating reports, a script is usually cheaper and more reliable. A short audit of your processes shows which is which.

Can I start with a script and add AI later?

Yes, and it is often the best order. Build the deterministic workflow first, keep the messy step behind a clear interface, and swap in a model for that step once you have measured the baseline.

Aren’t scripts just old-school RPA?

Not quite. Traditional RPA often mimics clicks on a screen, which breaks when the interface changes. We prefer scripts that talk to systems through their APIs, with tests, logging and retries, which are typically far more robust.

Free automation audit

Not sure whether you need a script or an agent?

Tell us the process that is eating your team’s time. We will map it, put a number on it and tell you honestly which tool fits, even when the answer is a plain script.

No obligation · No sales deck · We reply within one business day.

← Back to all field notes