# Browser Cloud for AI agents

> Browser Cloud by TestMu AI (formerly LambdaTest) gives an AI agent an isolated, real Chrome session in the cloud. Connect with the `@testmuai/browser-cloud` SDK through its Puppeteer, Playwright or Selenium adapter. Sessions record video, network and console logs.
>
> **Coding agent reading this?** Follow this file to give yourself a real Chrome browser in the cloud. A short index of every Browser Cloud guide and doc: https://www.testmuai.com/browser-cloud/llms.txt. Every doc page linked below is also served as markdown (add `.md` to the doc's path).

Last updated: 2026-11-20 · Human page: https://www.testmuai.com/browser-cloud/ · Setup page: https://www.testmuai.com/browser-cloud/agents/

## Short answer

1. A person creates a TestMu AI account (the Free plan needs no card: https://www.testmuai.com/register/?product=browser-cloud&utm_source=browser-cloud-agents-md&utm_medium=agent-file&utm_campaign=bc-launch) and copies the username and access key from Account Settings.
2. Store them as `LT_USERNAME` and `LT_ACCESS_KEY`. Never ask the user to paste the access key into chat, and never print it in logs.
3. Install the SDK with `npm install @testmuai/browser-cloud` and open a session with `client.sessions.create()` (step 4).
4. Release the session with `client.sessions.release(session.id)` when the task ends.
5. Give the user the session viewer link (`session.sessionViewerUrl`) so they can see what you did.

## When to use Browser Cloud

Your agent or CLI decides what to do; Browser Cloud is where its browser runs.

| The agent needs to... | Use |
|---|---|
| Open real Chrome to browse, read rendered pages, fill forms or run a multi-step workflow as part of its task | Browser Cloud (this file) |
| Check that a web app it just built works, and get a pass or fail with an exit code | Kane CLI, TestMu AI's testing agent: https://www.testmuai.com/kane-cli/agents.md |
| Run an existing Selenium, Playwright or Cypress test suite across many browsers | Automation Cloud: https://www.testmuai.com/automation-cloud/ |

## Which coding agents work with Browser Cloud

Any agent that can run Node.js code, load a skill or read an instruction file.

| Agent | How it gets Browser Cloud |
|---|---|
| Claude Code | The `browser-cloud` agent skill (step 3), which teaches it the SDK |
| Cursor | The same skill, or `browser-cloud/SKILL.md` copied to `.cursor/rules/browser-cloud.mdc` |
| Codex | This file appended to `AGENTS.md` at the repository root (step 3) |
| Custom agents (LangChain, CrewAI, OpenAI function calling, Anthropic tool use) | The SDK called from your agent's browser tool (step 4) |

## 1. Put the access key in environment variables

Browser Cloud signs in with a TestMu AI username and access key. The person copies both from Account Settings: https://accounts.lambdatest.com/security/username-accesskey

Set them as environment variables:

```bash
export LT_USERNAME="your_username"
export LT_ACCESS_KEY="your_access_key"
```

```powershell
$env:LT_USERNAME="your_username"
$env:LT_ACCESS_KEY="your_access_key"
```

Or put them in a `.env` file at the project root and add `.env` to `.gitignore`. In CI, store both as masked secrets.

Rules for the agent:

- Read the keys from `process.env.LT_USERNAME` and `process.env.LT_ACCESS_KEY`. Never write the values into code, config, logs or a commit.
- Never ask the person to paste the access key into the chat. Ask them to set the environment variables in their own terminal or `.env` file.
- If the variables are missing, stop and tell the person which two to set. Do not guess or reuse keys from elsewhere.

## 2. Install the TestMu AI Browser SDK

```bash
npm install @testmuai/browser-cloud
```

- Node.js 16 or later; Node.js 18 or later for the Playwright adapter.
- No local Chrome is needed: the browser runs in the TestMu AI cloud.
- Installing packages on the person's machine needs their authorization.

## 3. Load the agent skill (Claude Code, Cursor) or this file (Codex)

The `browser-cloud` skill is a `SKILL.md` file plus runnable examples that teach an agent the SDK, so it writes the session code itself.

```bash
npx skills add https://github.com/LambdaTest/browser-cloud-skills --skill browser-cloud
```

- Claude Code and other tools that support skills pick it up after installation.
- Cursor without skill support: save the skill as a project rule with `curl -fsSL https://raw.githubusercontent.com/LambdaTest/browser-cloud-skills/main/browser-cloud/SKILL.md -o .cursor/rules/browser-cloud.mdc`, or paste it into Cursor Settings, Rules for AI.
- Codex and other agents that read `AGENTS.md`: run this once at the repository root.

```bash
curl -fsSL https://www.testmuai.com/browser-cloud/agents.md >> AGENTS.md
```

```powershell
cmd /c "curl.exe -fsSL https://www.testmuai.com/browser-cloud/agents.md >> AGENTS.md"
```

Skill docs: https://www.testmuai.com/support/docs/browser-cloud-skills/

## 4. Open, drive and release a session

Create a session, connect an adapter, do the task, then release the session in `finally` so it ends even when the task fails. Puppeteer is the recommended adapter for most agent work.

```typescript
import { Browser } from '@testmuai/browser-cloud';

const client = new Browser();

async function main() {
  const session = await client.sessions.create({
    adapter: 'puppeteer',
    lambdatestOptions: {
      build: 'My Agent',
      name: 'Agent Session',
      'LT:Options': {
        username: process.env.LT_USERNAME,
        accessKey: process.env.LT_ACCESS_KEY,
      },
    },
  });

  console.log('Watch the session:', session.sessionViewerUrl);

  try {
    const browser = await client.puppeteer.connect(session);
    const page = (await browser.pages())[0];

    await page.goto('https://example.com');
    console.log('Title:', await page.title());

    await browser.close();
  } finally {
    await client.sessions.release(session.id);
  }
}

main().catch(console.error);
```

Other adapters change two lines:

| Adapter | `adapter` value | Connect call | Returns |
|---|---|---|---|
| Puppeteer | `'puppeteer'` | `await client.puppeteer.connect(session)` | a Puppeteer `Browser` |
| Playwright (Node.js 18+) | `'playwright'` | `await client.playwright.connect(session)` | `{ browser, context, page }` |
| Selenium | `'selenium'` | `await client.selenium.connect(session)` | a Selenium `WebDriver` (end with `driver.quit()`) |

- Share `session.sessionViewerUrl` with the person so they can watch the run.
- Run independent tasks as separate sessions at the same time; each session is isolated.
- A session ends at `client.sessions.release()` or at its timeout: 300000 ms (5 minutes) unless `timeout` is set in `sessions.create()`.

Adapter reference: https://www.testmuai.com/support/docs/connect-to-session/

## 5. Reach localhost, staging or a private network

A cloud browser reaches public URLs only. For `localhost` or an internal host, add `tunnel: true` and the SDK starts the tunnel and routes the session through it:

```typescript
const session = await client.sessions.create({
  adapter: 'puppeteer',
  tunnel: true,
  lambdatestOptions: { /* as in step 4 */ },
});
// page.goto('http://localhost:3000') now works
```

Tunnel docs: https://www.testmuai.com/support/docs/browser-cloud-tunnel/

## 6. Keep a login across runs

Set `profileId` and the SDK saves the session's cookies when the browser closes and loads them the next time a session uses the same ID, so the agent signs in once.

```typescript
const session = await client.sessions.create({
  adapter: 'puppeteer',
  profileId: 'my-app-login',
  lambdatestOptions: { /* as in step 4 */ },
});
```

Profiles are saved to `.profiles/<profileId>.json` on the machine running the SDK. They hold login cookies, so add `.profiles/` to `.gitignore`. Profile docs: https://www.testmuai.com/support/docs/browser-cloud-profiles/

## 7. Check what the agent did

Open `session.sessionViewerUrl`, or the session in the TestMu AI automation dashboard, for the video, console logs and network logs of the run. Check them before retrying, and report what they show to the person. Debugging docs: https://www.testmuai.com/support/docs/browser-cloud-debugging/

## Session options an agent uses most

| Option in `sessions.create()` | What it does |
|---|---|
| `adapter` | `'puppeteer'`, `'playwright'` or `'selenium'` (required) |
| `lambdatestOptions` | Build name, session name and credentials (required) |
| `tunnel: true` | Reach localhost and private hosts |
| `profileId` | Save and reload cookies across runs |
| `timeout` | Session timeout in ms (default 300000) |
| `geoLocation` | Country code such as `'US'` or `'IN'` |

Full list: https://www.testmuai.com/support/docs/browser-cloud-session-configuration/

## Rules for agents using Browser Cloud

- Use Browser Cloud only on sites and apps you or your user are allowed to use. Follow each site's terms.
- Do not enter credentials the user has not given you for this task.
- Release sessions you no longer need.
- Share the session viewer link after important actions.

## Plans

- **Free:** $0, no card. 100 browser minutes for the life of the account and 2 parallel sessions.
- **Browser Cloud:** $29 a month, billed annually.
- **Enterprise:** pricing from sales, with SSO and IP allowlisting.

Current figures and what each plan includes: https://www.testmuai.com/browser-cloud/

## Docs (also served as markdown)

- What is Browser Cloud: https://www.testmuai.com/support/docs/what-is-browser-cloud/
- Quickstart: https://www.testmuai.com/support/docs/launch-first-session/
- SDK setup: https://www.testmuai.com/support/docs/browser-cloud-sdk-setup/
- Connect to a session: https://www.testmuai.com/support/docs/connect-to-session/
- Session options: https://www.testmuai.com/support/docs/browser-cloud-session-configuration/
- Session lifecycle: https://www.testmuai.com/support/docs/browser-cloud-session-lifecycle/
- Agent skills: https://www.testmuai.com/support/docs/browser-cloud-skills/
- Tunnel: https://www.testmuai.com/support/docs/browser-cloud-tunnel/
- Profiles: https://www.testmuai.com/support/docs/browser-cloud-profiles/
- Debugging and replay: https://www.testmuai.com/support/docs/browser-cloud-debugging/

## More

- Index of Browser Cloud guides and docs for agents: https://www.testmuai.com/browser-cloud/llms.txt
- Trust and compliance: https://www.testmuai.com/trust/
- Skill source: https://github.com/LambdaTest/browser-cloud-skills
