> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For full documentation content, see https://platform.bctrl.ai/llms-full.txt.

# Installation & Setup

> Install the SDK, authenticate, and create your first browser runtime.

## Install

<CodeGroup>
  ```bash npm
  npm install @bctrl/sdk
  ```

  ```bash pnpm
  pnpm add @bctrl/sdk
  ```

  ```bash yarn
  yarn add @bctrl/sdk
  ```
</CodeGroup>

## Create a client

```ts
import { Bctrl } from "@bctrl/sdk";

const bctrl = new Bctrl({
  apiKey: process.env.BCTRL_API_KEY!,
});
```

Create an API key in the [BCTRL dashboard](https://app.bctrl.ai).

## Create a space

A space is the boundary for runtime work. It controls which resources the runtime can access.

```ts
const space = await bctrl.spaces.create({
  name: "invoice-agent",
  mounts: {
    storage: { space: "acme-invoices" },
    vault: { allow: ["clients/acme/"] },
    ai: { allowConnections: ["anthropic-prod"] },
  },
});
```

## Launch a browser runtime

```ts
const runtime = await space.runtimes.browser.launch({
  name: "quickbooks",
});
```

## Connect to it

Browser runtimes expose CDP connections. Use the endpoint with Playwright, Puppeteer, or another CDP-compatible tool.

```ts
const connection = await runtime.connections.create({
  protocol: "cdp",
});
```

## Inspect the active run

The run is where BCTRL records evidence.

```ts
const run = await runtime.currentRun();

const live = await run.live({
  control: "none",
});

console.log(live.iframeUrl);
```

## Next

* [Browser Quickstart](/sdk/getting-started/browser-quickstart)
* [Spaces](/sdk/core-concepts/spaces)
* [Connections](/sdk/core-concepts/connections)
* [Runs](/sdk/core-concepts/runs)