npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

beam

v0.8.1

Published

Browser automation and agent framework in TypeScript

Downloads

60

Readme

Overview

Beam combines browser automation with AI capabilities, allowing you to automate complex web tasks using natural language. It integrates language models to interpret tasks, plan actions, and execute them in a browser environment.

Beam is inspired by and builds upon browser-use, an innovative project that pioneered LLM-powered browser automation. Beam is essentially a 1:1 mapping of browser-use's functionality into TypeScript, with the main difference being the underlying tooling:

  • Using TypeScript instead of Python
  • Built on Mastra instead of Langchain
  • Providing the same core functionality with JavaScript ecosystem integration
  • Maintaining the same browser automation principles and approach

For a more detailed comparison, see our comparison guide.

Features

  • AI-Powered Automation: Define tasks in natural language and let the AI agent handle the execution
  • Smart Planning: Uses a planner agent to strategize complex task execution
  • Memory Management: Maintains context across actions with configurable memory options
  • Vision Capabilities: Can interpret visual elements on web pages
  • Secure Navigation: Configurable domain restrictions for security
  • Event System: Rich event system for monitoring execution progress
  • Extensible Tools: Create and integrate custom tools to enhance the agent's capabilities

Installation

npm install beam

For more detailed installation instructions, see our Installation Guide.

API Keys

Beam requires API keys for whichever language model provider you choose to use:

  • OpenAI: Set the OPENAI_API_KEY environment variable or provide it directly to the client
  • Anthropic: Set the ANTHROPIC_API_KEY environment variable

Visit the respective provider's website to obtain your API key:

Quickstart

import { Beam } from "beam";
import { openai } from "@ai-sdk/openai";
import dotenv from "dotenv";
// Load environment variables from .env file
dotenv.config();

async function example() {
  // Initialize Beam with an LLM
  const beam = new Beam({
    llm: openai("gpt-4.1"), // Requires OPENAI_API_KEY in your .env file
    useVision: true,
  });

  beam.on("text", content => process.stdout.write(content));

  await beam.initialize();

  try {
    // Run a task
    const result = await beam.run({
      task: "Go to news.ycombinator.com and summarize the top 3 stories",
    });

    console.log(JSON.stringify(result, null, 2));

    console.log("Task completed successfully!");
  } finally {
    // Close the browser when done
    await beam.close();
  }
}

example().catch(console.error);

Run the example

First, create a .env file in your project root:

OPENAI_API_KEY=your_openai_api_key_here

Then run the script:

# Install dependencies
npm install beam @ai-sdk/openai dotenv

# Run your script (assuming it's saved as example.ts)
npx tsx example.ts

For a more detailed guide, see our Quick Start Guide.

Steel Integration

Steel's cloud browsers crack CAPTCHAs, dodge bots, and track everything—giving Beam agents the stealth and insights they need.

import { Beam } from "beam";
import { openai } from "@ai-sdk/openai";
import dotenv from "dotenv";
// Load environment variables from .env file
dotenv.config();

async function example() {
  // Initialize Beam with Steel integration
  const beam = new Beam({
    llm: openai("gpt-4.1"),
    useSteel: true,
  });

  await beam.initialize({ solveCaptcha: true });

  try {
    await beam.run({
      task: "Search for Browser Agents and summarize the top result",
    });
  } finally {
    await beam.close();
  }
}

example().catch(console.error);

Set your Steel API key in your environment variables:

STEEL_API_KEY=your_steel_api_key

Documentation

Comprehensive documentation is available in the docs directory:

Getting Started

Core API

Advanced Usage

Examples

Basic Example with Event Handling

import { Beam } from "beam";
import { openai } from "@ai-sdk/openai";

// Note: Requires properly configured environment variables
// See Quickstart section for setup details
async function example() {
  const beam = new Beam({
    llm: openai("gpt-4o"),
    useVision: true,
    maxSteps: 10,
  });

  // Set up event listeners for real-time updates
  beam.on("text", content => process.stdout.write(content)); // Stream text output
  beam.on("tool-call", toolCall => console.log(`Using tool: ${toolCall.toolName}`));
  beam.on("error", error => console.error("Error:", error));
  beam.on("done", result => console.log("Task completed:", result.completed));

  try {
    await beam.initialize();
    await beam.run({
      task: "Go to news.ycombinator.com and summarize the top 3 stories",
    });
  } finally {
    await beam.close();
  }
}

example().catch(console.error);

Using Custom Tools

import { Beam } from "beam";
import { openai } from "@ai-sdk/openai";
import { createTool } from "@mastra/core/tools";
import { z } from "zod";

// Note: Requires properly configured environment variables
// See Quickstart section for setup details

// Define a custom tool
const weatherTool = createTool({
  id: "getWeather",
  description: "Get the current weather for a location",
  inputSchema: z.object({
    location: z.string(),
  }),
  execute: async ({ context }) => {
    const { location } = context;
    // Implementation to fetch weather data
    return { location, temperature: "72°F", conditions: "Sunny" };
  },
});

// Initialize Beam with custom tools
const beam = new Beam({
  llm: openai("gpt-4o"),
  tools: {
    custom: {
      getWeather: weatherTool,
    },
  },
});

// Now the agent can use your custom weather tool

For more examples, check the Examples Section.

License

MIT