0.1.1 • Published 5 months ago

@agent-infra/browser v0.1.1

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

@agent-infra/browser

A tiny Browser Control library based on puppeteer, built for Agent Tars.

Features

  • 🔍 Browser Detection - Auto-detects installed browsers across platforms
  • 🔄 Remote Browser Support - Connect to remote browser instances
  • 🛡️ Type Safety - Written in TypeScript with full type definitions

Architecture

graph TD
    A[Browser Interface] --> B[Local Browser]
    A --> C[Remote Browser]
    B --> D[Browser Finder]
    B --> E[Browser Adapter]
    C --> E
    E --> F[Puppeteer Adapter]
    F --> G[Browser Control]

Installation

npm install @agent-infra/browser
# or
yarn add @agent-infra/browser
# or
pnpm add @agent-infra/browser

Quick Start

import { LocalBrowser } from '@agent-infra/browser';

async function main() {
  // Initialize browser
  const browser = new LocalBrowser();

  try {
    // Launch browser
    await browser.launch({ headless: false });

    // Create new page
    const page = await browser.createPage();

    // Navigate to URL
    await page.goto('https://example.com');

    // Take screenshot
    await page.screenshot({ path: 'example.png' });
  } finally {
    // Always close browser
    await browser.close();
  }
}

Credits

Thanks to:

  • EGOIST for creating a great AI chatbot product ChatWise from which we draw a lot of inspiration for browser detection functionality.
  • The puppeteer project which helps us operate the browser better.