H2MHuczyńskiSystems you own
Contact

Work · Migration · Python → TypeScript on Cloudflare Workers

A Python browser agent ported to the edge in four days

The core of browser-use, the open-source Python agent with over 100k GitHub stars, rewritten as about 2,400 lines of TypeScript on Cloudflare Workers. No local browser, no server. On the same site it found slightly more with 2.4× fewer steps.

4 daysscaffold to production queue
80 → 33agent steps, same site
204 vs 200job ads found, port vs original
~2,400lines of TypeScript

Measured on the same sites, the Python original against the port. Our own R&D; the client it was built for is not named.

01

The situation

A hiring-signal database for a recruitment agency: which logistics companies are hiring, read from their own careers pages. The Python browser-use agent did the reading well, but only on a laptop with a real browser, one company at a time.

02

What was ported, and what was not

Ported: the DOM extraction and serialisation that turn a page into text a model can act on, the tools (click, type, scroll, save), and the agent loop. Written as a plan first, one GitHub issue per layer, each tested against the Python output on the same page.

Not ported: the 3,000-line browser session manager, telemetry, multi-tab and the rest. Cloudflare's Browser Rendering already launches the browser, so that code had no job to do.

03

What changed

On a 14-page careers site the original took 80 steps to collect 200 ads; the port took 33 steps and found 204. On a scrolling site it found 39 against 37.

The agent now runs on Cloudflare: one Worker invocation per company from a queue, a weekly cron, results and live logs written straight to D1. Prompt caching makes repeated tokens six times cheaper.

04

How it runs

Workers, Browser Rendering, Workers AI and D1 on one account. Sites that block automated browsers are checked against robots.txt first and flagged for a person, not forced.

How the pieces connect

The system on one map. Arrows show what feeds what; hover a piece to light its path.

Queue

Queue + weekly cron

One Worker invocation per company.

Agent

Agent loop · ~2,400 lines TS

State → model → tool → repeat, with loop detection.

Browser

Browser Rendering · headless Chromium

DOM extracted and serialised for the model.

AI

Workers AI · prompt caching

Tool calling; cached tokens six times cheaper.

D1

Jobs, runs and live logs

Written directly through the native binding.

Runs on

  • Typescript
  • Workers
  • Cloudflare
  • Python
  • Sqlite

If you want one of these

Three steps. The six-step version, with the brief and the video request, is on the home page.

  1. 01

    Scoping call

    30 min, free

    You describe the situation; I ask three questions and propose a shape.

  2. 02

    Audit: subscriptions or your own system

    €1,200 / $1,400 net, 5 business days

    The 36-month cost comparison, the order of moves, the risks and a fixed build price. Paid by bank transfer after the call, once you accept the offer; credited in full against a build ordered within 60 days of the report.

  3. 03

    Build, handoff, operate

    fixed price from the audit

    One engineer builds every layer on your account and documents it. The offer includes a monthly plan by default, so the system is looked after from launch day.

Questions I get about this

Tap a question to see the answer.

Scoping calls · most weeks

Audit: subscriptions or your own system. In 5 business days: the 36-month cost comparison, the order of moves, the risks and a fixed build price in writing. It costs €1,200 / $1,400 net, paid by bank transfer against an invoice after the call and after you accept the offer. If you order the build within 60 days of the report, the full amount comes off its first instalment; if not, the report is yours to take to anyone.

The repository, the Cloudflare account, the domains and the data sit under your company from day one, and the data is yours. Code built only for you becomes yours once it is paid for, as the contract sets out; H2M modules come with a perpetual licence. I get access to your accounts, not ownership of them.

The audit gives you a date and a fixed price before you commit to the build. The stack is small and one person builds every layer, so nothing waits in a queue between departments.

Yes, before you send the brief if you need it. Send yours or use mine.

Something else? Ask it on the call

A 30-minute call, free

Thirty minutes, then an offer for the audit

Pick a free time in my calendar. Or leave an email: I reply within one business day with three questions and a proposed time for the call, not a deck.

More of the same shape