Stagehand compatibility
https://docs.stagehand.dev/
import "dotenv/config";
import { Stagehand } from "@browserbasehq/stagehand";
import { z } from "zod/v3";
async function main() {
const stagehand = new Stagehand({
env: "LOCAL",
localBrowserLaunchOptions: {
cdpUrl: "ws://127.0.0.1:9222"
},
model: "ollama/qwen3:1.7b",
});
await stagehand.init();
const page = stagehand.context.pages()[0];
await page.goto("https://demo-browser.lightpanda.io/");
// Act on the page
await stagehand.act("Click the Campfire link")
const price = await stagehand.extract("product price", z.string())
console.log(price);
await stagehand.close();
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
@karlseguin : this is a work in progress, but Stagehand relies on existing Chrome's default target.
So the STARTUP session hack doesn't work with it...
Next blocker Accessibility.getFullAXTree
> {"id":36,"method":"Accessibility.getFullAXTree","params":{"frameId":"TID-1"},"sessionId":"SID-1"}
< {"id":36,"error":{"code":-31998,"message":"UnknownMethod"},"sessionId":"SID-1"}
Exciting \o/ One last bit :)
In Stagehand, in agent mode, screenshots are sent to AI models to understand where to click, what to do next. How can we solve these?
See: https://docs.stagehand.dev/v3/configuration/models#agent-models-with-cua-support
Lightpanda can't provide screenshot, so we won't be compatible with computer use agents.
In the future, we think of adding kind of text rendering, something similar to lynx maybe, that could be helpful for this use cases.