-
Notifications
You must be signed in to change notification settings - Fork 4.7k
agent or script deciding once
The question comes up per task and gets re-argued every time, usually on taste. It has an answer, and it is four questions deep.
1. How many times will this run? Once or a handful: agent. Every day forever: script. The crossover is not about capability, it is about where the cost lands. An agent pays a model for judgement on every run; a script pays a developer once and then nothing.
2. Does the page change shape, or only content? Content changing is what a script handles fine. Shape changing, meaning the selectors move, is what breaks it, and a script that needs repairing monthly has quietly become a recurring cost too. If the site redesigns often or you are reading many different sites with the same intent, judgement per run is worth paying for.
3. Does the task need a decision, or only extraction? "Take the third cell of each row" is extraction. "Find the price, which might be a range, might be per month, might say contact us" is a decision. Scripts are better at the first and cannot do the second without becoming a pile of special cases.
4. How expensive is a wrong answer? A script is wrong the same way every time, which is detectable. An agent is wrong differently each time, which is harder to notice and harder to test. Where exactness matters, either script it or add a verification step you genuinely run: validating an AI agent's output.
The usual framing is "the script costs a day to write, the agent costs cents per run, so the agent wins until you hit a lot of runs". That undercounts both sides.
The agent's real cost is the model turns, and they scale with pages, not with runs. A forty-page walk resends a growing transcript, so page forty is priced with pages one to thirty-nine still in the context. The per-page cost climbs as the run goes on, and the numbers for that are in extracting data to a CSV with an AI agent.
The script's real cost includes repair. Not a day, a day plus whatever a layout change costs a few times a year.
So the break-even is lower than the naive version suggests for long single runs, and higher than it suggests for short ones against unstable pages.
The pattern that actually works, and it is not a compromise:
- The agent explores. Point it at the page and have it report where the data is, what the page demands, what the odd cases look like, and what the selectors are. This is the part a person otherwise spends an hour on with developer tools open.
- You write the script from that report, or have the agent help write it.
- The script runs daily.
- The agent comes back when the script breaks, to find out what moved.
You pay for judgement exactly where judgement is needed: at the start, and at each failure. Nothing pays for judgement in the middle, where there is none to apply.
A script cannot tell you it is subtly wrong. If the layout changes so that the third cell is now the fourth, the script keeps running and returns the wrong column, silently and forever.
An agent in the same situation usually notices, because the value no longer looks like a price, and says something. That is worth real money on data you are going to act on, and it is an argument for the agent that has nothing to do with convenience.
The counter-argument is the same fact from the other side: because the agent decides each time, it can decide differently between runs on a page that did not change. Which of the two failures you prefer is the actual question, and it depends on whether you would rather be consistently wrong or inconsistently right.
Forty supplier sites, pricing pages, once a quarter.
Wrong answer: write forty scrapers. Forty layouts, forty repair jobs, and it runs four times a year.
Wrong answer: run the agent on all forty every quarter with no structure. It works and the results are not comparable, because forty pages describe prices forty ways.
Right answer: the agent reads all forty and records the raw string plus a normalised value plus the URL, per normalising values across sites; you look at the raw column once and fix the normalisation; quarterly reruns compare against the last file rather than starting fresh. Judgement where the sites differ, mechanics where they do not.
Should I use an agent or write a script? Script for a stable page run repeatedly; agent for a page you have not seen, a layout that moves, or a task needing judgement. Most real cases want both, in that order.
Where is the break-even? Lower than the naive per-run arithmetic suggests, because the agent's cost rises within a long run as the transcript grows, and the script's cost includes repairing it when a layout moves.
Which is more reliable? Neither, differently. A script is consistently wrong when the page changes and never says so. An agent notices, and can be inconsistent between runs.
What is the standard hybrid? Agent explores once, you script the repetition, agent returns when the script breaks.
See also: when not to use an AI browser agent, which is the longer list of cases where the answer is neither, and AI browser agents versus traditional scraping for the comparison with the numbers attached.
- The cost-curve claim about a growing transcript is documented and argued on extracting data to a CSV with an AI agent, which is where this project's own figures for it live. Everything else here is a framing rather than a measurement, and is presented as one.
Four questions, asked in order, and the fourth one is the tiebreaker more often than people expect.
- OpenAI Operator alternatives
- Open-source Operator-style agents
- Is OpenAI Operator still available?
- OpenAI Operator vs Claude computer use
- browser-use alternatives
- Choosing an AI browser agent
- Open-source AI browser agents
- Open-source computer-use agents
- What is an AI web agent?
- AI browser agents vs traditional scraping
- Cloud browser infrastructure for AI agents, explained
- Browserbase alternatives
- Firecrawl vs an AI browser agent
- Skyvern alternatives
- Stagehand vs browser-use
- Project Mariner is gone: what replaced it
- Manus alternatives
- Gemini computer use vs Claude computer use
- invisible_playwright_mcp, reviewed honestly by its own wiki
- AI browser vs AI browser agent: which one do you want?
- AI browser agent vs RPA: which one fits the job
- AI browser agent vs n8n, Zapier and Make
- Vercel agent-browser alternatives, compared honestly
- What is an agentic browser? Definition and the two kinds
- Open-source agentic browsers: the three layers, compared
- Choosing an MCP server for browser automation: four axes
- Stealth MCP servers compared: Camoufox, nodriver, Patchright
- Playwright MCP alternatives, and the three you don't need
- Autonomous browser agents: the four rungs of autonomy
- What is actually free in the AI browser agent stack
- browser-use on GitHub: what the repo actually gives you
- Playwright MCP vs Chrome DevTools MCP: different jobs
- How to choose among MCP servers: a map by category
- Which MCP servers are worth adding to Claude Code
- MCP on GitHub: finding servers and judging them fast
- MCP vs an API: the decision, and what the wrapper costs
- MCP alternatives: when the protocol is the wrong shape
- Why does my AI agent get blocked?
- The timing signal AI agents give off
- Agent retry loops trip rate limits, not fingerprints
- Claude computer use detected as a bot
- browser-use getting blocked: what you can and cannot change
- Playwright MCP session blocked: four causes, four fixes
- Playwright MCP and captchas: what actually gets you past
- Cloudflare and a browser MCP server: what is being read
- Can an AI agent solve a captcha? The honest answer
- Getting an AI agent to fill out forms
- Which model to use with invisible_playwright_mcp
- Browser problem or model problem?
- Running invisible_playwright_mcp's browser from Claude Code
- Extracting data to a CSV with an AI agent
- Monitoring a page for changes with an AI agent
- Running invisible_playwright_mcp's browser from Claude Desktop
- Running invisible_playwright_mcp's browser from Cursor
- Using an AI agent to hunt for apartments
- Getting website data into Google Sheets with an AI agent
- Using an AI agent to download invoices from portals
- AI agents for web research
- Using an AI agent to test your own website
- Running invisible_playwright_mcp's browser from Cline
- Posting to social media with an AI agent
- Posting to Facebook with an AI agent
- Posting to Instagram with an AI agent
- Posting to X with an AI agent
- Automating LinkedIn posts: read this first
- Appointment bots: what they are and what an agent can legitimately do
- Track prices across sites with an AI agent
- Build a lead list with an AI browser agent
- Run an AI browser agent on a schedule
- AI browser agent with a local LLM: what changes
- Should you log your AI agent into your accounts?
- How to write a task an AI browser agent can follow
- Move data between two web apps with an AI agent
- The MCP server
- How the tools are shaped, and why
- Playwright MCP vs the Playwright CLI: which fits when
- Playwright MCP: browser is already in use, and the fix
- Playwright MCP best practices: four decisions that matter
- Playwright MCP with a proxy, and the three leaks it leaves
- A browser MCP server in GitHub Copilot: setup and limits
- Using a browser MCP server for web scraping: the pattern
- Which LLM for browser automation: the four properties
- How to build a browser agent, and what to take instead
- Getting an AI agent to log into a website: three routes
- MCP tools, resources and prompts: who controls each
- How many MCP tools is too many? The context arithmetic
- How to build an MCP server: the decisions, not the scaffold
- Local or remote MCP server: what changes, and what does not
- Writing an MCP client in Python: the thirty-line version
- Self-hosted AI agent: what one actually costs to run
- How long an AI browser agent takes per step, measured
- Text, HTML, snapshot or screenshot: what the agent should read
- Giving an AI browser agent a stopping condition
- Keeping an AI browser agent out of destructive actions
- Why did the AI agent click the wrong thing
- When the page changes under the AI agent
- Running one AI agent task across a list of sites
- Seeing a page as it appears in another country
- Getting data out of a dashboard with no export button
- Two browsers in one session: main and support
- Finding the dead links on a site with an AI agent
- Filling a CRM record from a company's website
- One form submission per spreadsheet row, with an AI agent
- Dated screenshots of a page as evidence
- Checking order and delivery status with an AI agent
- Reading a PDF that opens inside the browser
- Summarising a long page or thread with an AI agent
- Collecting every image on a page with its caption
- Collecting event and course listings with an AI agent
- Cancelling a subscription with an AI agent
- What an AI agent can and cannot do inside an iframe
- Shadow DOM and an AI agent: you can click it, you cannot read it
- Running invisible_playwright_mcp's browser from Codex
- What a page snapshot costs, per control
- Native selects and the ones that only look like selects
- Running invisible_playwright_mcp's browser from Gemini CLI
- Clicking by selector or by coordinates
- How long the agent waits before it gives up
- What a second browser costs
- Uploading a file with an AI agent, and why this one cannot
- Watching the agent work, and when it is worth it
- When not to use an AI browser agent
- Agent or script: deciding once instead of every time
- Using the keyboard instead of the mouse
- Secrets in an agent task: where they end up
- What an agent run should log
- Deduplicating what an AI agent collects
- Normalising values across sites
- Validating an AI agent's output
- Reading a table with an AI agent
- Driving a site's own search and filters
- The task works headed and fails headless