Puppeteer is a framework for browser automation. It is natively supported in JavaScript and TypeScript.

Laminar excels at tracing browser agents by providing unified visibility into both browser session recordings and agent execution steps.

Puppeteer integration

Laminar has a native integration with Puppeteer for JavaScript. You simply need to initialize Laminar with your project API key and Puppeteer will be traced automatically. We will hook into the API to create OpenTelemetry spans, but more importantly, we record browser session recordings.

import { Laminar } from '@lmnr-ai/lmnr';
import puppeteer from 'puppeteer'; // or 'puppeteer-core'

Laminar.initialize({
  projectApiKey: process.env.LMNR_API_KEY,
});

// The rest of your puppeteer code

For some setups, you may need to pass the module to the Laminar.initialize function. For example,

import puppeteer from 'puppeteer';
import { Laminar } from '@lmnr-ai/lmnr';

Laminar.initialize({
  projectApiKey: process.env.LMNR_API_KEY,
  instrumentModules: {
    puppeteer: puppeteer
  }
});