Engineering

We Deleted 137,000 Lines of Our Own Code and Benchmark Scores Went Up

We built a scheduler UI, deleted it, and wrote a 37-line prompt that replaced it. browser-use 1.0 follows the same idea: one main tool, python.

Magnus Müller

Co-Founder, CEO

We built a scheduler UI for our cloud agent: three pages, two Lambdas, 6,439 lines. It lasted fifteen weeks. Today the agent schedules itself from a 37-line paragraph and three curl calls, and nobody opens a form.

browser-use 1.0 is the same move. The 24 tools became one main tool, python, plus two ways to finish. On BU Bench v2.1 the same three models scored 14 to 33 points higher than on 0.x. That is the whole 1.0 release, which also deleted 136,905 lines and changed the defaults. We didn't test the tool change on its own, and it was one run per model.

Terminal output: tools per release, 9 in 0.1.1, 29 in 0.3.3, 24 in 0.13.14, 3 in 1.0. Python lines in the library 1,574, 67,599 and 13,738. Hello world 7, 14 and 3 lines.
The library on the way up and back down. 6 of the 29 tools at the peak were Google Sheets actions.

What 1.0 looks like

We shipped it on November 10, 2026. The pull request added 29,601 lines and deleted 136,905 across 554 files. 178 Python files became 43.

The model gets a persistent REPL with the browser-harness helpers and raw cdp() already imported:

async def python(ctx: RunContext[Session], code: str) -> list[Any]:
    """Run Python in the persistent REPL (browser-harness helpers and raw cdp() pre-imported)."""
    ...
 
tools=[Tool(python, max_retries=TOOL_RETRIES, sequential=True), *tools]

Your own tools still register next to it. The hello world is three lines again, because the model and the browser default to Browser Use Cloud:

from browser_use import Agent
 
result = Agent('Find the number of stars of the browser-use repo').run_sync()
print(result.final_result())

To try it, run uv add browser-use and set BROWSER_USE_API_KEY, or pass your own model with llm=. The benchmark chart is in the release notes: 200 tasks run, the frozen 180-task set scored, November 8, 2026. The same models cost 2.7x to 5.2x less.

How we got to 29 tools

The first commit was October 31, 2024: 8 files, 670 lines, 10 actions. Then every bug became an action. Dropdowns that click couldn't open got two. Scrolling to a phrase got scroll_to_text. Google Sheets got six. By 0.3.3 (June 26, 2025) the model picked from 29.

An action costs you twice. Its schema sits in every prompt, and when the menu has no entry for what the page needs, the agent is stuck, because the menu is its only way to touch the browser. We moved from Playwright to raw CDP in August 2025 and added a JavaScript tool (The Bitter Lesson of Browser Agents tells that part). The library still had 24 actions in October 2026.

32 helpers, 16 of them dead in 50 minutes

What broke the pattern was a side project. On April 16, 2026 Gregor committed harnesless: 404 lines of Python. A daemon holds one CDP websocket to Chrome, the agent writes Python, and cdp("Domain.method", ...) reaches anything Chrome can do.

import sys
from helpers import *  # noqa: F401,F403
exec(sys.stdin.read())

The first version still shipped 32 helpers, including our indexed-DOM ones: get_dom, click_element, type_in. Gregor ran 7 real tasks on it (Upwork, X, Google Flights, Hacker News, Netflix, an iPhone comparison). The model never called any of them. Fifty minutes after the first commit, the next commit says:

every DOM interaction went through js() + a bespoke selector, never through the indexed-DOM helpers.

16 helpers went out, 4 came in, and 32 became 20. The model just wrote its own selectors.

The rule since then: keep a helper only if the model couldn't rewrite it from scratch after reading it once. It has grown anyway. The core is now 2,176 lines and the helpers file has 26 helpers. The Bitter Lesson of Agent Harnesses has the whole argument. One correction, since people (including us) get this wrong: the library kept its 24 tools until November. The harness proved the idea first, and the library caught up months later.

The scheduler we deleted

The cloud agent went the same way: every capability got a UI, then a tool, then a rule. Scheduling went through all three.

Terminal output: scheduler UI added 6,439 lines in May 2025; deleted, 5,634 lines removed in September 2025; manage_schedules tool 1,008 lines in February 2026; July 2026 a 37-line prompt plus 815 lines of backend, 314 of them tests.
Lines changed by the pull requests that shipped or deleted each version.

The February tool, manage_schedules, started a fresh sandbox for every occurrence, so nothing carried over. In July we replaced it with this paragraph in the agent's instructions (host and auth lines removed):

You can send a task back to yourself later. It arrives in THIS session as a normal turn prefixed
"[scheduled]", so future-you resumes with everything present-you knows: the conversation, the
workspace files, the browser. Write it as instructions to your future self, not as a script.
 
That is what makes a repeating task get cheaper. The first occurrence works out where the data lives
and what breaks; write that down in a workspace memory file and every later one starts from there.
 
Repeating, every Monday 09:00 UTC:
  curl -s -X POST "${AUTH[@]}" "$URL" -d '{"cron_expr":"0 9 * * MON","task":"..."}'
 
GET "$URL" to list what this session has scheduled. DELETE "$URL/<schedule_id>" to cancel one.
 
A cron schedule runs until deleted, so one with a finish condition should check it and delete itself
when met. Tell the user what you scheduled and when it fires.

The backend is one table, three endpoints and a job that runs every minute. An occurrence wakes the existing session instead of starting a sandbox. The PR explains why a form can't compete: the decision to schedule ("I should check back on this in an hour") is "reached mid-reasoning, from context that only exists inside the run." A dashboard can't see that, the agent can. We haven't measured cost per occurrence, so "later runs get cheaper" is a reason, not a result.

Recovery went the same way. When the browser died or its IP got blocked, the old agent just failed the run. Now it can create and stop browsers itself through the public API, and in November we added refresh_connection, which changes the IP in place and keeps the browser. Our tuned fast agent also lost to plain Pi in September, 16% to 22% slower. We deleted the plan checklist, file tools and long instruction file, and the first model call dropped from 5,578 tokens to 2,740 (the change notes don't record the sample size, and we re-measured the payload, not the speed). The speed write-up has the paired evals.

What the agent did that we never built

Give the model one code tool and raw CDP, and you can count what it reaches for. We did that on 199 traces from a BU Bench v2.1 run on November 13, 2026: 12,976 code calls and about 47 distinct CDP commands. The top five are what our helpers wrap. The rest nobody designed.

Terminal output: traces out of 199 calling each CDP command. Accessibility.getFullAXTree 126, DOM.getBoxModel 107, Input.dispatchMouseEvent 54. Long tail: Network.enable 8, Page.stopLoading 6, Network.getResponseBody 3, and three commands in 1 trace each.
9 of about 47 command names, counted by regex over the code calls.

One task wanted two years of daily data from a stock exchange statistics page. The page hung on load.

Terminal log of one trace: page hangs 10.2 s at 0:35, script blocked at 0:55 and reload takes 1.3 s, private API found at 1:23, 730 dates fetched at 1:53, 30 retried at 3:15, done at 3:33.
One trace from that run. Times are minutes since the task started.

The agent called Page.stopLoading, saw an empty body, then blocked the script that was stuck:

cdp('Network.enable')
cdp('Network.setBlockedURLs', urls=['*<stuck-script>*'])
goto_url('https://<exchange-stats-page>/')

The reload took 1.3 seconds. It then read the site's own JavaScript, found the JSONP endpoint behind the table and called it directly, 730 dates in batches of 30. 30 timed out, so it retried only those. 4,720 rows, three and a half minutes, judge score 0.92. Nobody built that.

Other traces scored 0.58 to 0.76. On a task that said "observation only" about a site impersonating a software brand, the agent turned off JavaScript, blocked two tracker hosts and logged every redirect before it navigated. On an ad library task it set Animation.setPlaybackRate to 100 so dialogs stopped costing time, collected 140 IDs, set it back to 1 and printed "restored animation rate". Nobody wrote a cleanup rule.

Where a tool beat the prompt

Captchas are where a prompt lost.

Terminal output: on staging, a prose-only prompt solved 0 of 3 hCaptcha, the solve_captcha tool solved 6 of 6 in 21 to 30 seconds.
Ultrafast agent on staging, one vendor, a small test. The solver runs only in our US region so far.

On our Ultrafast agent on staging, a prompt that explained captchas went 0 for 3 on hCaptcha. Our solve_captcha tool went 6 for 6. We think it wins because it flips a solver switch inside the browser with a custom CDP command, which the agent can't reach from the page.

Our rule: if the agent already has the primitive, write prose. It has curl, so scheduling is a paragraph. If it doesn't, build the tool, which is why solve_captcha and refresh_connection exist. We also kept the 50-schedule cap, because an agent in a loop is the realistic failure mode.

Then log which helpers your own agent fires and delete the rest. It took us 7 tasks and 50 minutes to learn that half of ours were dead.

Published