Some tasks always take the same steps in the same order. Lint, format, compile, and report needs no run-time choice.
A script also wins when a wrong extra step is costly. A loop that may run anything must be fenced; a script cannot stray.
Signal | Favor a script | Favor an agent |
|---|---|---|
Step order | Known ahead of time. | Depends on what each tool returns. |
Tool set | Small and fixed. | Chosen per step from many tools. |
Inputs | Uniform shape every run. | Wide variety that resists branching. |
Cost of a stray step | High, for example a write to hardware state. | Low, for example extra read-only checks. |
Numbers below are stated example parameters. Real costs vary by model and setup: measure them.
assume one model decision costs 10 units and one tool call costs 1 unit
fixed script: 0 decisions + 3 tool calls = 0 x 10 + 3 x 1 = 3 units
agent run with 3 decisions + 3 tool calls = 3 x 10 + 3 x 1 = 33 units
ratio: 33 / 3 = 11, so the agent run costs eleven times the script run
assume each step succeeds with probability 0.9, steps independent
4-step agent run: 0.9^4 = 0.6561, about 66 in 100 runs succeed
2-step script: 0.9^2 = 0.81, so about 81 in 100 runs are expected to succeed (the expected rate under independence; actual counts vary)Use a script when the path is known and an agent when only the goal is known. Start with the script and promote the step that first needs a choice.
Least privilege still applies. An agent with write or shell tools needs human approval for risky actions, secrets never go into prompts, and proprietary IP goes only to deployments approved for its data class.
Script. The steps are fixed, so a loop would only add cost and new ways to fail.
Eleven times: 33 units against 3 units.