# StorageBrowserRef

`StorageBrowserRef` is the inline browser configuration attached to a stored agent. The `provider` id is resolved at hydration time against the [`BrowserProvider`](https://mastra.ai/reference/editor/browser-provider) registered on [`MastraEditor.browsers`](https://mastra.ai/reference/editor/mastra-editor).

It is the type used by [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by stored agent records.

## Usage example

```typescript
import { MastraEditor } from '@mastra/editor'
import { stagehandBrowserProvider } from '@mastra/stagehand'

new MastraEditor({
  browsers: { [stagehandBrowserProvider.id]: stagehandBrowserProvider },
  builder: {
    enabled: true,
    configuration: {
      agent: {
        browser: {
          type: 'inline',
          config: {
            provider: 'stagehand',
            headless: true,
            viewport: { width: 1280, height: 720 },
          },
        },
      },
    },
  },
})
```

## Type

```typescript
type StorageBrowserRef = { type: 'inline'; config: StorageBrowserConfig }
```

There is no `{ type: 'id' }` variant for browsers — they are always inlined.

## Properties

**type** (`'inline'`): Discriminant. Must be the literal \`"inline"\`.

**config** (`StorageBrowserConfig`): Provider id and per-instance browser configuration. See the section below.

## `StorageBrowserConfig`

The shape embedded under `config`. Defined in `@mastra/core/storage`.

**provider** (`string`): Provider identifier (for example, \`"stagehand"\`). Must match a \`BrowserProvider.id\` registered on \`MastraEditor.browsers\`. There are no built-in providers.

**headless** (`boolean`): Run the browser in headless mode (no visible UI). (Default: `true`)

**viewport** (`{ width: number; height: number }`): Browser viewport dimensions. Controls window size and how pages render.

**timeout** (`number`): Default timeout in milliseconds for browser operations. (Default: `10000`)

**screencast** (`ScreencastOptions`): Screencast options for streaming browser frames to the UI.

**screencast.format** (`'jpeg' | 'png'`): Image format.

**screencast.quality** (`number`): JPEG quality 0–100.

**screencast.maxWidth** (`number`): Max width in pixels.

**screencast.maxHeight** (`number`): Max height in pixels.

**screencast.everyNthFrame** (`number`): Capture every Nth frame.

## Hydration

`StorageBrowserRef` is resolved lazily on `mastra.editor.agent.getById()`. The editor looks up `config.provider` on `MastraEditor.browsers` and calls `provider.createBrowser(config)`. If the provider is not registered, the editor logs a warning and returns `undefined` — the agent still loads, but without a browser.

## Related

- [Browser](https://mastra.ai/docs/agent-builder/browser) — concept and worked examples.
- [BrowserProvider](https://mastra.ai/reference/editor/browser-provider) — implementer-facing provider interface.
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) — where this type is pinned as the Builder default.
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref) — sibling reference type for workspace configuration.