Less page
The model reads a numbered list of what a person could click or type into, and answers with a number. No screenshots and no HTML.
Selfbrowse is an open-source Python agent that does tasks in a real browser. The model gets a short numbered list in place of the page, placeholders in place of your data, and no call at all for clicks that worked before. That makes it cheap enough for a model on your laptop.
pip install selfbrowse
Python 3.10+, MIT licence, version 0.1. Works with any model that can call tools.
The first model call, drawn to scale
13,467
tokens, browser-use
1,128
tokens, Selfbrowse
The model reads a numbered list of what a person could click or type into, and answers with a number. No screenshots and no HTML.
Passwords, emails, card numbers and names reach the model as placeholders. The real value is typed at the keyboard, on the same site only.
Clicks that worked before on a site are replayed without asking the model, once they have earned trust.
On every step Selfbrowse lists what is usable on screen: links, buttons, fields, dropdowns and headings. Only the newest list stays in the conversation, so a long task does not drag every earlier page along with it.
The page
What the model reads
Every tool description goes out with every call, so the set is short: goto, click, type, select, read, find, ask_human, done and a few more. About 790 tokens for all of them.
Controls inside iframes, from the same site or another, and inside open shadow roots appear in the same list and are clicked the same way.
A sloppy call is repaired: {"id": "7"} becomes {"ref": 7}. A model going in circles gets a short, specific nudge.
Hiding a value usually breaks the task, because the model cannot type what it cannot see. Selfbrowse gives it a stable placeholder and fills in the real value itself.
<secret:pw>, and the value appears only at the keyboard. It is absent from the history and the trace.--redact-presidio adds Microsoft Presidio for names and more. Nothing is sent to a detection service.--allow-domain, or use a local model so page text never leaves your machine.Email on file: priya.raman@acme.comEmail on file: <EMAIL_1>type {"ref": 2, "text": "<EMAIL_1>"}priya.raman@acme.comSubscribed priya.raman@acme.com to the newsletter.--no-restore) the model typed the literal text [email] into the form in all five runs. One model, one page, so read it as a working demonstration, not a rate.After a successful run, Selfbrowse keeps the clicks that led there, filed by page type. Once a path is trusted it is replayed with no model call.
A path is trusted after it worked for two different tasks, or twice for the same one. Risky clicks such as Buy, Pay and Delete are never recorded, and neither is anything you typed. A replay still passes every guardrail, a path that stops working is dropped, and unused ones expire after 90 days.
Learning helps routine jobs you repeat. Across different tasks in the same shop it gave no saving.
# what it has learned, clearing one site, turning it off
selfbrowse sites
selfbrowse forget example.com
selfbrowse --no-learn "..."
| Run | Calls | Tokens sent | Seconds | Correct |
|---|---|---|---|---|
| 1, off | 6 | 66 | no | |
| 2, off | 5 | 48 | no | |
| 3, off | 9 | 79 | yes | |
| 4, off | 7 | 55 | yes | |
| 1, on | 7 | 43 | yes | |
| 2, on | 7 | 36 | yes | |
| 3, on | 3 | 12 | yes | |
| 4, on | 3 | 11 | yes |
“Off” and “on” are learning. From the third run with learning on, four clicks were replayed from the saved flow. Raw rows are in benchmarks/compare/results/learning-qwen3.8-fix.
The same tasks, model and browser for both, behind one proxy that counts every token. Code checks each result, using the demo shop's state or a fact from the site's own API. The agent's own claim of success is never counted.
| Model and tasks | Tokens sent per task, average | Passed | Time per task |
|---|
benchmarks/compare, so you can rerun it on your own models.Guardrails act twice in every step: on the page before the model reads it, and on the action before the browser runs it. Real values exist only where they are typed.
Everything here is in the package and turns on with a flag or one line of Python.
selfbrowse-mcp is an MCP server. The assistant calls browse(task) and gets back only the answer, so pages never enter its context. MCP server--trace records each model call, reply and action. --otel URL sends OpenTelemetry spans to Jaeger, Phoenix, Langfuse or Tempo, with no code changes. Observability--screenshots DIR saves a picture after every step with an index page, and --record-video DIR saves a video. The model never gets these images.--cdp-url, or start an Amazon Bedrock AgentCore session with --cloud agentcore. Remote browsers--channel chrome --profile DIR uses your installed browser and keeps logins between runs, which gets past many bot checks.Selfbrowse is early software. These are the things we know it does not do well, or have not checked.
Install the package and a browser for it to drive, then give it a task. With Ollama there is no key and no cost.
Add --headed to watch it work. There are fourteen runnable scripts in examples, three of which need no API key.
Install
pip install selfbrowse
playwright install chromium
Command line
# a local model through Ollama
selfbrowse -m ollama:qwen3.6:latest "Open news.ycombinator.com and tell me the top story"
# Claude, staying on one site and asking before risky clicks
export ANTHROPIC_API_KEY=your-key-here
selfbrowse --headed --allow-domain example.com --confirm-risky "..."
Python
from selfbrowse import BrowseAgent
from selfbrowse.guardrails import AllowedDomains, RedactPII, Budget
result = BrowseAgent(
"Find the cheapest desk lamp and add it to the cart",
llm="ollama:qwen3.6",
guardrails=[AllowedDomains(["shop.example.com"]), RedactPII(),
Budget(max_tokens=50_000)],
).run()
print(result.output, result.usage)