01The question
Products such as Grok Bot say they sign in to your tools, use them as you would, and repeat a workflow after watching you do it once. Yet a language model only reads and writes text (The harness is a program on your machine). So how does text click a button?
The answer is plainer than the pitch. xAI doesn't publish how Grok Bot works inside, so the example here is the way this kind of agent is generally built, with tools anyone can install. It starts from something much older than agents: a .
02A script decides everything in advance
A script is the commands you would type, kept in a file (A script is text another program reads). A program can drive a browser the same way. , a library from Microsoft built for testing websites, lets a few lines of Node open Chromium, go to a page and click a button.
Each of those lines was chosen before the script ran. That makes a script free to run again, and it makes a script break when the page changes, because it has no way to write a different line.
<button id="auth-submit">Sign in</button>Written in advance, and never changed
page.click('#login-btn')Written now, from the page in front of it
{"action":"click","ref":"e21"}03An agent writes the next line as it goes
An agent keeps the browser and the library, and replaces the list of lines with a loop. Look at the page, ask the model for the next action, carry it out, and go round again. The that runs this loop is ordinary code, like the script was. The only new part is where each line comes from.
- heading "Sign in to Zendesk" - textbox "Email" [ref=e12] - textbox "Password" [ref=e13] - button "Sign in" [ref=e14] - link "Forgot password?" [ref=e15]
Playwright flattens the page into this list. It is text.
So the model never touches the browser. It writes a line of text, usually as a , and the harness does the rest. That is why the browsers built for agents aren't a new kind of browser.
Chrome could always be scripted. What changed is the author: a model at run time, not a developer in advance.
04The page reaches the model as text
For this to work, the model has to be given the page in a form it can read. A web page in a browser is a tree of elements, the , and Chromium lets other programs ask for it over a debugging channel, the . Raw HTML would be enormous and mostly about appearance. So harnesses usually ask for an : what each thing is and what it is called, the view a screen reader gets.
- heading "Issues" [level=1] - link "New issue" - link "Open (36)" - link "Closed (18,369)" - button "Filter by author": Author - button "Filter by labels": Labels
What each thing is and what it is called, for the whole page, including what is off screen.
Where there is no tree to read, as in a native app or a drawing on a canvas, the harness sends a screenshot to a model that can read images, and the reply is a pair of coordinates. Screenshots can use fewer tokens than text, but a click aimed at a coordinate is easier to get wrong than a click on a named element. So many harnesses prefer the text, and some send both.
A page flattened into text, a model that picks from it, and a while loop. That is the whole mechanism.
05The line it writes is tokens
Here is where the idea pays off. The script is the model's output, and output is . A click is about a dozen of them. So a 40-step job is 40 short replies, billed like any others. Grok Bot's own pricing says so: weekly usage is included, and anything over is "billed based on token cost".
The output is the small part. On every turn the harness also sends the goal, the page and what has happened so far, and all of that is input. A job's cost is roughly the number of turns times the size of the page, which is why a long run on a busy page costs far more than three shell commands, though you'd call both one task.
Harnesses are shaped by this. They flatten pages. They replace old history with a summary ( is finite too). And they prefer a single command to five pages of clicking.
A script is written once and costs nothing to run again. An agent's script is written again on every run, and you pay for the writing.
06A recording is a script; a routine is its goals
Now "show it once" has a plain reading. Logging your clicks, keystrokes and navigations gives you a real, replayable script. Test tools have done this for years: npx playwright codegen opens a browser and writes code as you click. Replayed as it stands, that recording is cheap, and it breaks the way any script breaks.
A model can take the same log and write down what you were doing: filter the refund tickets, export them, add them to the sheet. Stored like that, the steps are goals, and the loop can find the button wherever it has moved. Each step then costs tokens again. The middle way is to replay the recorded action and call the model only when it stops matching, which is what action caching in tools such as Stagehand does. xAI doesn't say which of these its routines use. Either way, a timer such as sets it off, the same kind of thing that has run scripts on a schedule since the 1970s.
The script says exactly what. The routine says what for, and the model works out how, each time it has to.
07So click only when nothing else reaches it
If every turn costs a page, the cheapest job has the fewest turns. Most services offer a way that has none: an API (Why the browser needs an API), a URL that returns data. Use it when it exists and you can get access to it. It takes one step, and its reply keeps its shape when the website is redesigned. Its reply can still be big, so have a script keep the fields you need before the model gets them.
It can also be safer. Many services let a key or an OAuth grant be limited, to reading tickets for example, whereas a logged-in browser session can do whatever your account can. And a page is untrusted text going to the same model that holds your session, so words hidden in a page can be taken as orders. That is , and Brave showed it against Perplexity's Comet browser.
The browser earns its cost when there is no API, or when there is one you can't get at: an internal tool from years ago, a supplier's portal, a plan you aren't on. Check the site's terms first, because some ban automation outright, as LinkedIn's do. Most real routines mix them: an API for the data, a plain script for the sums, the browser for the one dashboard nothing else reaches.
Is there a URL that returns JSON for this? If yes, use that. If no, click.
Connected
- Note · same thingWhat happens when a program runs?
The harness and model of that note, seen doing one job. There the tool is an edit to a file; here it is a click.
- Note · same thingWhat is a script, and what is a branch?
What a script is, from the first line down. This note starts where that one's scripts stop being written in advance.
- Note · same patternWhat is a runtime, and why can it be the weak point?
An engine that can only calculate, and a harness that decides what it can reach. A model behind a browser is the same three parts again.
- Note · same thingHow does code reach what it needs?
What an API is and why its secrets stay on a server, which is the other half of choosing an API over a click.
- Note · same thingWhy does thinking harder cost more?
What a token is and why each one costs what it does. Here they are counted turn by turn.
Side threads
Questions that came up once the main idea began to hold, kept as they were asked. Each opens beside the paragraph it grew from.
Terms
Checked
What the chat had wrong or only half right, against sources. The note above already says the corrected thing.
- Each Bot is an isolated environment with its own files and PATH.Grok Bot's page says the opposite: every Bot shares one persistent cloud computer, and isolation is per user.xAI, Grok Bot FAQs
- Grok Bot's routines keep the steps as goals and replay them with the model.The page doesn't say how routines are stored or replayed, and the chat gave two different answers. Both are techniques in use elsewhere.xAI, Grok Bot; Stagehand, act
- Scripting started at Bell Labs in the 1970s.Louis Pouzin's RUNCOM ran command files on MIT's CTSS around 1964, and he coined "shell". Unix took the idea up.Louis Pouzin, The Origin of the Shell
- Playwright drives Chromium, Firefox and WebKit over the Chrome DevTools Protocol.CDP is the Chromium case. Its Firefox and WebKit are patched builds.Playwright, Browsers
- Running
playwright codegenshows the accessibility snapshot.It shows generated code.page.ariaSnapshot()prints a snapshot.Playwright, Codegen; Aria snapshots xdotoolfires clicks through the OS accessibility layer.It simulates input through X11's XTEST extension.xdotool README- A page's HTML is about 200,000 tokens against 2,000 for its snapshot, and a screenshot often costs more than the text.Those were illustrations. A real GitHub issues page measured about 89,000 and 6,400, and its screenshot about 1,334, though that holds only what is on screen.Measured 1 November 2026; Claude docs, Vision
- Harnesses usually summarise history after about 30 steps.No fixed number. Claude's compaction, for one, runs on demand or at a token threshold.Claude docs, Compaction
api.zendesk.com/v2/tickets?tags=refundreturns the tickets in one token-cheap call, always the same.Zendesk's API sits on your subdomain, and tags go through Search. Replies can be large: 25 GitHub issues were about 29,000 tokens unfiltered. The data changes between calls; the shape is what stays fixed.Zendesk, Search; GitHub REST API, measured 1 November 2026- Government portals never have an API, and LinkedIn is a fair case for the browser.USCIS publishes a Case Status API, for one. LinkedIn's User Agreement bans bots and unauthorised automated methods.USCIS Developer Portal; LinkedIn User Agreement, 8.2
- Claude Code is a Node script with a shebang.The native install on a Mac is a compiled program,
Mach-O 64-bit executable arm64. The npm version is the script.`file ~/.local/bin/claude`, 1 November 2026 - Comet and Atlas are Chromium forks with the harness in a sidebar, and Stagehand's call is
page.act.Atlas runs Chromium in a separate process behind a native interface. Stagehand's current call isstagehand.act.OpenAI, How we built OWL; Stagehand, act