Hacker news

  • Top
  • New
  • Past
  • Ask
  • Show
  • Jobs

We made Playwright 2x faster and 80% more token efficient (https://github.com)

119 points by wittydeveloper 1 day ago | 34 comments | View on ycombinator

wittydeveloper 1 day ago |

We built Stagehand 2 years ago (24k stars and 4M monthly npm downloads) and recently fixed its biggest flaw: round-trip latency.

Every action performed requires a round trip between your script and the browser (short when running locally but increased when running in the cloud). We also saw multiple posts complaining about the eager token appetite of Playwright MCP.

For this reason, we rebuilt Stagehand from the ground up and shipped v4, where Stagehand controls the browser from an extension automatically loaded upon your browser startup.

Stagehand v4 comes with batch command support, dedicated token-efficient methods `act()` and `extract()`, and a brand new architecture making it 2x faster than Playwright and 80% more token efficient.

You can see for yourself by looking at our benchmarks, comparing its performance across a dozen models (frontier and open weights) and tools (Codex, Claude Code, and more): https://www.stagehand.dev/evals

Ask me anything!

MiguelG719 about 3 hours ago |

We also just added Jev support https://github.com/browserbase/stagehand/pull/2952

On the act/extract/observe evals it shows promising results being extremely efficient

- act: 4.3x faster, 97% fewer LLM calls. Pass rate: 97.5% -> 98.3%. - heldout: 4.1x faster, 78% fewer LLM calls. Pass rate: 87.5% -> 97.5%. - observe: 11.1x faster, 69% fewer LLM calls. Pass rate: 75.0% -> 83.3%. - extract: 8.7x faster, 75% fewer LLM calls. Pass rate unchanged at 92%.

cost effectively 0

ulrikrasmussen about 15 hours ago |

Looks very useful, and I like the caching idea which I think makes it interesting for self-healing CI tests.

How does it determine when a cached act() fails and has to be re-evaluated by the LLM? And in particular, if the cache is saved in the cloud (Browserbase?), won't this lead to a lot of cache churn if used in CI pipelines where different versions of the site are running against the same cache?

Also, is there a technical reason why the cache couldn't just be a local file that's checked in along with the script but must be provided by Browserbase? If it was, devs could heal failing tests locally using LLM calls, while CI runs entirely deterministically.

throw03172019 about 5 hours ago |

Can this be used for browser automation on customer computers? The only glaring issue I see is the api tokens are exposed for LLMs.

vishalanton 1 day ago |

So for an enterprise with a 1,000 test Playwright suite, does this basically mean ~2x faster CI times? That would be huge.

yread about 7 hours ago |

Is there something like this for cypress?

tengkahwee about 15 hours ago |

Would you recommend to use this over agent-browser for general agent-based validation work? Any performance benefit?

bensyverson about 19 hours ago |

If your needs are simpler, I created a tiny headless WebKit browser specifically for agents called Sleepy Hollow [0]

[0]: https://github.com/bensyverson/sleepyhollow

cl685 1 day ago |

what did you lose compared to CDP (e.g. cross-origin iframes, downloads running in envs where you can't load extensions)?

ishankunam 1 day ago |

seems really cool! although, one question i have is why not keep agent() alongside the new primatives? it seems v4 removed agent() entirely rather than offering it with all of act(), observe(), extract().

dot_louis 1 day ago |

Do I need to pay for Browserbase to use this?

alyssamaru 1 day ago |

How much does the harness really matter for evals?

cl685 1 day ago |

lowk why not just do astra computer use

alikhater30000 about 4 hours ago |

[flagged]

hellobuddy9 about 9 hours ago |

[dead]

shashanoid about 15 hours ago |

no matter how much faster you make.. playwright is playwright. Dead bot giveaway.