Laminar has an extensive observability suite for browser agents. If you are
building browser agents, you can use Laminar to trace them and record the browser sessions.
That is, by default, you will get both the LLM calls traces and a session recording of
the browser sessions.
Laminar traces the LLM calls using automatic instrumentations provided by OpenLLMetry. You can
extend the traces with Laminar’s manual instrumentation when needed.
In addition, Laminar instruments popular browser automation frameworks (integrations with Puppeteer, Playwright, Stagehand, and BrowserUse) and records the browser sessions.
Here is an example of a simple browser agent that uses Playwright to navigate to a website and extract the title.
If you don’t have a project API key, you can get one by signing up on Laminar or spinning up a self-hosted instance and getting a key from the project settings.
Copy
import { Laminar } from '@lmnr-ai/lmnr';import { chromium } from 'playwright';Laminar.initialize({ projectApiKey: process.env.LMNR_API_KEY, instrumentModules: { playwright: { chromium }, // add other libraries as you need }});async function main() { const page = await browser.newPage(); await page.goto('https://www.duckduckgo.com/'); await page.locator('input[name="q"]').fill('Laminar observability'); await page.locator('input[name="q"]').press('Enter'); const textSelector = await page.locator('a', { hasText: 'www.lmnr.ai' }).first(); await textSelector?.waitFor(); await textSelector?.click(); const title = await page.title(); await page.waitForLoadState('load'); console.log('Title of this page is', title); await browser.close();}main().then(() => Laminar.shutdown().then(() => { console.log('Done!');}));
Copy
import { Laminar } from '@lmnr-ai/lmnr';import { chromium } from 'playwright';Laminar.initialize({ projectApiKey: process.env.LMNR_API_KEY, instrumentModules: { playwright: { chromium }, // add other libraries as you need }});async function main() { const page = await browser.newPage(); await page.goto('https://www.duckduckgo.com/'); await page.locator('input[name="q"]').fill('Laminar observability'); await page.locator('input[name="q"]').press('Enter'); const textSelector = await page.locator('a', { hasText: 'www.lmnr.ai' }).first(); await textSelector?.waitFor(); await textSelector?.click(); const title = await page.title(); await page.waitForLoadState('load'); console.log('Title of this page is', title); await browser.close();}main().then(() => Laminar.shutdown().then(() => { console.log('Done!');}));