HN user

tanishqkanc

27 karma
Posts9
Comments30
View on HN

with playwright-cli, the agent makes reasoning decisions between each cli call. with browser-tools, the agent can write big playwright code blocks that execute in one go meaning less turns and the agent can select exactly what it needs from the result.

I think the code version of playwright-cli is still supported but we just use the default instructions given by the cli which push it towards per cli call usage

playwright-cli is very simple and meant for humans - it basically generates a first draft of a script, and was originally meant for writing e2e tests. You need to do a lot of post-processing on it to get it to be a reliable automation.

libretto gives a similar ability for agents for building scripts but:

- agents automatically run, debug, and test the integrations they write - they have a much better understanding of the semantics of the actions you take (vs. playwright auto-assuming based on where you clicked) - they can parse network requests and use those to make direct API calls instead

there's fundamentally a mismatch where playwright-cli is for building e2e test scripts for your own app but libretto is for building robust web automations

we started using stagehand initially! But it doesn't follow the same model of pre-generating deterministic code. Your code is meant to look like this:

// Let AI click await stagehand.act("click on the comments link for the top story");

the issue with this is that there's now runtime non-determinism. We move the AI work during dev-time: AI explores and crawls the website first, and generates a deterministic legible script.

Tangentially, Stagehand's model may have worked 2 years ago when humans still wrote the code, but it's no longer the case. We want to empower agents to do the heavy lifting of building a browser automation for us but reap the benefits of running deterministic, fast, cheap, straightforward code.

I’m glad it left that impression! My thoughts have clarified a bit since I read that post, and I think what I describe is more declarative, like React. But the best places to read about it (for web devs) are in Elm!

There is also this new thing I found that seems to really lean into the core of what being functional means here: https://github.com/jorgebucaran/hyperapp

After a while, you see that basically all systems can be modeled as event-driven, functional systems. It’s a flexible model, and fits beautiful into web dev where the semantics are very clear: the system is the web app and events are clicks, keyboard events, asynchronous calls...

Im not sure if there’s a good way to use css to animate an arbitrary number of children with a delay, while retaining clean markup. I did this before: .article-child { animation-delay: var(—index)*0.025s; } and while rendering, set style tags on each element style=“—index:5”, etc. That works, but it was annoying to maintain, and every single element has these style tags. So I just use Motion One (WAAPI) now.

Ah! That’s unfortunate . All that work of pre-rendering, and it won’t even work with javascript disabled. To be clear, I use a very very tiny bit of javascript only to animate the article elements after render.I guess when that fails, it just doesn’t animate the opacity to 1…hm...