*** title: Installation & Setup description: 'Install the SDK, authenticate, and launch your first browser runtime.' ------------------------------------------------------------------------------------ ## Install ```bash npm npm install @bctrl/sdk ``` ```bash pnpm pnpm add @bctrl/sdk ``` ```bash yarn yarn add @bctrl/sdk ``` ## Create a client ```ts import { Bctrl } from "@bctrl/sdk"; const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY!, }); ``` The API key authenticates all requests. Get one from the [BCTRL dashboard](https://app.bctrl.ai). ## Create a workspace A [workspace](/sdk/concepts/workspaces) is an isolated environment for your agent's resources. Mount the credentials and storage it needs: ```ts const workspace = await bctrl.workspaces.create({ name: "my-first-workspace", mounts: { ai: { allow: ["openai-prod"] }, storage: { workspace: "my-first-workspace" }, }, }); ``` ## Launch a browser runtime A [runtime](/sdk/concepts/runtimes) is a remote browser running on BCTRL infrastructure. Pick a driver — Playwright, Puppeteer, Stagehand, or Selenium: ```ts const runtime = await workspace.runtimes .browser("main") .playwright({ mode: "ephemeral" }); ``` ## Automate Use the driver's native API to control the remote browser: ```ts await runtime.page.goto("https://example.com"); const title = await runtime.page.title(); console.log(title); ``` ## Clean up ```ts await runtime.stop(); ``` ## Full example ```ts import { Bctrl } from "@bctrl/sdk"; const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY! }); const workspace = await bctrl.workspaces.create({ name: "quickstart", }); const runtime = await workspace.runtimes .browser("main") .playwright({ mode: "ephemeral" }); await runtime.page.goto("https://example.com"); const title = await runtime.page.title(); console.log(`Page title: ${title}`); await runtime.stop(); ``` ## Next steps * [Workspaces](/sdk/concepts/workspaces) — mount AI credentials, vault, and storage * [Runtimes](/sdk/concepts/runtimes) — drivers, launch modes, concurrent runtimes * [Scopes & Inheritance](/sdk/concepts/scopes-and-inheritance) — how resources flow to runtimes * [Browser Capabilities](/sdk/browser-capabilities) — full reference for browser automation