
🌐 browser-use-js is a JavaScript port of the original Python project, making it easy to connect AI agents with web browsers using JavaScript.
# Using npm
npm install
# Install Playwright browsers
npx playwright install
Add your API keys to your .env
file:
OPENAI_API_KEY=your_openai_api_key
import { Browser, BrowserConfig, Agent } from "browser-use-js";
import { ChatOpenAI } from "@langchain/openai";
import dotenv from "dotenv";
dotenv.config();
async function main() {
const browser = new Browser(
new BrowserConfig({
headless: false,
disableSecurity: true,
})
);
const agent = new Agent({
task: "Compare the price of gpt-4o and DeepSeek-V3",
llm: new ChatOpenAI({
modelName: "gpt-4o",
temperature: 0.7,
}),
browser: browser,
useVision: true,
});
await agent.run();
await browser.close();
}
main().catch(console.error);