/testmu-browser-cloud:browser-cloudfrom TestMu AI Browser Cloud
Writes TypeScript that gives an AI agent a TestMu AI Browser Cloud browser: it creates a cloud browser session with the @testmuai/browser-cloud SDK, connects Puppeteer, Playwright or Selenium, runs the task (scrape, screenshot, PDF, form fill, login reuse, file transfer, or localhost through a tunnel) and releases the session. It can wrap the task as a LangChain, CrewAI, OpenAI or Anthropic tool, or as a standalone function. Use when the user asks for TestMu AI or LambdaTest Browser Cloud, a cloud browser session, cloud Puppeteer or Playwright for an agent, or a browser tool for an AI agent that should run in the cloud instead of a local Chrome.
Ships in TestMu AI Browser Cloud. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You write production-grade TypeScript code that connects AI agents to the real web using TestMu AI Browser Cloud. Sessions run in TestMu AI's cloud, so they need no local Chrome. Agents get real, observable cloud browsers on demand.
Every output from this skill is runnable TypeScript that:
Extract these before writing code:
| Signal | What to determine |
|---|---|
| Task type | Scrape content, screenshot, PDF, form fill, login + persist, monitor, download file, interact with app |
| Agent framework | LangChain, CrewAI, AutoGen, OpenAI functions, custom loop, or standalone script |
| Adapter preference | Puppeteer (default), Playwright, or Selenium |
| Auth needed | Does the target site require login? Reuse session? |
| Local access | Does the agent need localhost or internal URLs? → tunnel |
| Browser profile options | Did the user ask for a varied user agent, viewport or human-paced input on a site they own or may automate? |
| Scale | Single run vs. repeated cron vs. parallel agents |
If the user does not specify adapter: default to Puppeteer. If the user does not specify framework: output a standalone async function the user can wrap into any framework.
Read the task and match it to one of these patterns. Each has a reference implementation in /references/.
| Pattern | When to use | Reference |
|---|---|---|
| Quick Action | One-off scrape, screenshot, or PDF — no interaction needed | references/patterns/quick-actions.md |
| Session + Navigate | Multi-step navigation, form interaction, JS-heavy pages | references/patterns/session-navigate.md |
| Auth + Profile | Login once, reuse session across runs (cron / serverless) | references/patterns/auth-profile.md |
| Parallel Sessions | Multiple agents / tasks running simultaneously | references/patterns/parallel-sessions.md |
| Tunnel + Localhost | Agent must reach local dev server, staging, or VPN URLs | references/patterns/tunnel.md |
| LangChain Tool | Wrap browser actions as LangChain Tool for agent chain | references/integrations/langchain.md |
| CrewAI Tool | Wrap as CrewAI BaseTool for crew workflows | references/integrations/crewai.md |
| OpenAI Function | Define as function_call / tool for GPT-4 agent loops | references/integrations/openai-functions.md |
| File Upload/Download | Agent needs to upload docs or download reports from cloud browser | references/patterns/files.md |
try/finally to release sessions. Sessions left open waste quota and money.LT_USERNAME or LT_ACCESS_KEY.build and name in lambdatestOptions — makes runs easy to find in the TestMu AI automation dashboard.timeout: 1800000.package.json for @testmuai/browser-cloud in dependencies or devDependencies. If it is missing, tell the user the install command for their package manager (pnpm add @testmuai/browser-cloud with pnpm-lock.yaml, yarn add @testmuai/browser-cloud with yarn.lock, otherwise npm install @testmuai/browser-cloud) and run it only after they agree. If there is no package.json, ask the user where the project should live before creating one.import { Browser } from '@testmuai/browser-cloud';
const client = new Browser();
export interface BrowserTaskResult {
success: boolean;
data?: unknown;
error?: string;
sessionViewerUrl?: string;
}
export async function browserTask(input: string): Promise<BrowserTaskResult> {
const session = await client.sessions.create({
adapter: 'puppeteer',
timeout: 1800000,
lambdatestOptions: {
build: 'Agent: <TaskName>',
name: input.slice(0, 80),
'LT:Options': {
username: process.env.LT_USERNAME!,
accessKey: process.env.LT_ACCESS_KEY!,
video: true,
console: true,
},
},
});
try {
const browser = await client.puppeteer.connect(session);
const page = (await browser.pages())[0];
// --- task logic here ---
await browser.close();
return { success: true, data: null, sessionViewerUrl: session.sessionViewerUrl };
} catch (err) {
return { success: false, error: String(err) };
} finally {
await client.sessions.release(session.id);
}
}
Layer in only what the task actually needs. Do not add capabilities the task does not require.
stealthConfig)Add only when the user asks for it, on a site they own or may automate, for example their own staging site that serves different pages to headless user agents. Do not use these options to get around a site's bot protection, CAPTCHAs, rate limits or terms (rule 8).
stealthConfig: {
humanizeInteractions: true, // random delays on click/type
randomizeUserAgent: true, // pool of 7 real Chrome/Firefox UAs
randomizeViewport: true, // ±20px jitter on viewport
}
Add when: agent logs in to a service and runs on a schedule or as serverless.
// In session config:
profileId: 'service-name-login', // auto-saves cookies on browser.close()
// On first run, agent logs in normally.
// On all subsequent runs, cookies are restored — login page is skipped.
See full pattern: references/patterns/auth-profile.md
Add when: agent must reach localhost, *.internal, or VPN-gated URLs.
tunnel: true,
tunnelName: 'agent-tunnel',
// Then: await page.goto('http://localhost:3000') works from the cloud.
Add when: agent creates multiple sessions in one script run and needs to share login state.
// After login in session 1:
const ctx = await client.context.getContext(page1);
// In session 2:
await client.context.setContext(page2, ctx);
// Already authenticated — no re-login.
Add when: agent runs multiple browser tasks concurrently.
const results = await Promise.all(
urls.map(url => browserTask(url))
);
Always add releaseAll() in the shutdown handler:
process.on('SIGINT', async () => { await client.sessions.releaseAll(); process.exit(0); });
import { Tool } from 'langchain/tools';
class BrowserCloudTool extends Tool {
name = 'browser-cloud';
description = 'Browse any URL, scrape content, take screenshots, or fill forms using a real cloud browser. Input: URL or task description.';
async _call(input: string): Promise<string> {
const result = await browserTask(input);
return JSON.stringify(result);
}
}
See references/integrations/crewai.md for the wrapper pattern using a Node.js subprocess bridge.
See references/integrations/openai-functions.md for the function definition schema and handler.
The exported function works directly — call it from any async context, pass the result back to the LLM.
| Scenario | Use |
|---|---|
| Most agent use cases | Puppeteer — simplest return type (Browser) |
| Complex form interaction, auto-waiting | Playwright — page.fill(), built-in waits, returns {browser, context, page} |
| Existing Selenium test suite | Selenium — connects to TestMu hub via HTTP/WebDriver |
For one-off operations where the agent does not interact beyond data extraction:
// Scrape — format options: 'html' | 'text' | 'markdown' | 'readability'
const scraped = await client.scrape({ url, format: 'markdown', waitFor: '#content' });
// Screenshot (import { ScreenshotResponse, PdfResponse } from '@testmuai/browser-cloud')
const shot = (await client.screenshot({ url, fullPage: true, format: 'png' })) as ScreenshotResponse;
fs.writeFileSync('out.png', shot.data);
// PDF
const pdf = (await client.pdf({ url, format: 'A4', printBackground: true })) as PdfResponse;
fs.writeFileSync('out.pdf', pdf.data);
Without a sessionId, a Quick Action launches a temporary headless Chrome on the machine that runs the code (Chrome must be installed there) and closes it afterwards. To run it in a cloud browser instead, create a session, register its page with client.quick.registerSessionPage(session.id, page) and pass sessionId (see references/patterns/quick-actions.md). Tell the user which of the two the code does.
Before finalizing any code output, verify:
@testmuai/browser-cloud is listed in package.json, or the user has the install command and agreed before it ranprocess.env.LT_USERNAME and process.env.LT_ACCESS_KEYtry/finally wraps all browser work with client.sessions.release(session.id) in finallybuild and name set in lambdatestOptionstimeout set explicitly (not relying on 5-min default for agent workflows)stealthConfig only if the user asked for it, on a site they own or may automateSIGINT handler added if the script manages multiple sessions or runs as a long-lived process.env file setup instructions included in comments or a README blockreferences/
patterns/
quick-actions.md — scrape / screenshot / PDF one-liners
session-navigate.md — multi-step navigation and interaction
auth-profile.md — login once, persist across runs
parallel-sessions.md — concurrent agent sessions
tunnel.md — localhost and internal network access
files.md — upload/download between agent and cloud browser
integrations/
crewai.md — CrewAI BaseTool wrapper (Python + subprocess bridge)
langchain.md — LangChain scrape and screenshot tools in cloud sessions, plus agent setup
openai-functions.md — OpenAI and Anthropic function calling definition
If the user's project already declares @testmuai/browser-cloud, skip reinstall unless they ask to upgrade. Otherwise follow non-negotiable rule 7 above: give the install command and run it only after the user agrees.
npm i @testmuai/browser-cloud
# Node.js 18+ required.
# .env
LT_USERNAME=your_testmuai_username
LT_ACCESS_KEY=your_testmuai_access_key
Credentials: TestMu AI → sign in → Account Settings (same username/access key pair as for Browser Cloud / automation).
Session logs: After each run, the video and console log (and the network log, if the code turns it on) appear in your TestMu AI automation session history (open the dashboard from testmuai.com after sign-in).
agents/openai.yaml (opens in a new tab)references/integrations/crewai.md (opens in a new tab)references/integrations/langchain.md (opens in a new tab)references/integrations/openai-functions.md (opens in a new tab)references/patterns/auth-profile.md (opens in a new tab)references/patterns/files.md (opens in a new tab)references/patterns/parallel-sessions.md (opens in a new tab)references/patterns/quick-actions.md (opens in a new tab)references/patterns/session-navigate.md (opens in a new tab)references/patterns/tunnel.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub lambdatest/browser-cloud-skills --plugin testmu-browser-cloud