Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 2.03 KB

File metadata and controls

65 lines (51 loc) · 2.03 KB
Shows a black Browser Use Logo in light color mode and a white one in dark color mode.

browser-use-js 🤖

GitHub stars npm version License: MIT JavaScript Playwright LangChain

🌐 browser-use-js is a JavaScript port of the original Python project, making it easy to connect AI agents with web browsers using JavaScript.

Installation

# 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

Quick Start

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);