Extension provides the browse_url tool for the Pi coding agent
README.md

Pi Browser Extension #

This extension provides the browse_url tool for the pi coding agent, allowing it to browse web pages and extract their content as clean Markdown. It uses Playwright for browser automation and Turndown for HTML-to-Markdown conversion.

Description #

The browse_url tool allows the agent to:

  • Navigate to any URL.
  • Strip away noise (scripts, styles, navbars, footers).
  • Convert the remaining meaningful content into a clean Markdown format.
  • Handle basic headers and code blocks for better LLM consumption.

Requirements #

  • Node.js (LTS recommended)
  • npm

Installation #

  1. Copy the extension folder to your pi extensions directory:

    mkdir -p ~/.pi/agent/extensions/browser-extension
    # Copy files into this directory
    
  2. Install npm dependencies:

    cd ~/.pi/agent/extensions/browser-extension
    npm install
    
  3. Install Playwright browsers:

    npx playwright install
    

Usage #

Once installed and the pi agent is restarted, the agent will have access to the following tool:

browse_url

  • Description: Browse a web page to extract its content as clean Markdown.
  • Parameter: url (The URL of the page to browse).

Configuration #

The extension runs the browser in headless mode by default and uses the following flags to ensure compatibility across different Linux environments:

  • --no-sandbox
  • --disable-setuid-sandbox
  • --disable-dev-shm-usage