@mastra/core 1.23.0-alpha.8 → 1.23.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +3 -0
  3. package/dist/agent/index.cjs +8 -8
  4. package/dist/agent/index.js +1 -1
  5. package/dist/browser/index.cjs +2 -2
  6. package/dist/browser/index.js +1 -1
  7. package/dist/channels/index.cjs +4 -4
  8. package/dist/channels/index.js +1 -1
  9. package/dist/{chunk-MDI4VT5E.js → chunk-2UKRWY5F.js} +3 -3
  10. package/dist/{chunk-MDI4VT5E.js.map → chunk-2UKRWY5F.js.map} +1 -1
  11. package/dist/{chunk-QCA3KTAW.js → chunk-5W5QXDQT.js} +8 -8
  12. package/dist/{chunk-QCA3KTAW.js.map → chunk-5W5QXDQT.js.map} +1 -1
  13. package/dist/{chunk-GYBRTUAA.js → chunk-6757WCEN.js} +6 -6
  14. package/dist/{chunk-GYBRTUAA.js.map → chunk-6757WCEN.js.map} +1 -1
  15. package/dist/{chunk-KS5DMDW6.js → chunk-7QUQNRRH.js} +4 -4
  16. package/dist/{chunk-KS5DMDW6.js.map → chunk-7QUQNRRH.js.map} +1 -1
  17. package/dist/{chunk-I3Y3GPMU.cjs → chunk-B2PK5R4Q.cjs} +48 -48
  18. package/dist/{chunk-I3Y3GPMU.cjs.map → chunk-B2PK5R4Q.cjs.map} +1 -1
  19. package/dist/{chunk-IJDENHXO.cjs → chunk-BT35INEC.cjs} +77 -77
  20. package/dist/{chunk-IJDENHXO.cjs.map → chunk-BT35INEC.cjs.map} +1 -1
  21. package/dist/{chunk-MNLWRUSF.js → chunk-C2DN2YA2.js} +3 -3
  22. package/dist/{chunk-MNLWRUSF.js.map → chunk-C2DN2YA2.js.map} +1 -1
  23. package/dist/{chunk-FDZIDJEN.cjs → chunk-C7Y7CU7Z.cjs} +17 -17
  24. package/dist/{chunk-FDZIDJEN.cjs.map → chunk-C7Y7CU7Z.cjs.map} +1 -1
  25. package/dist/{chunk-AGEOFSDZ.js → chunk-CFYLBHVD.js} +4 -4
  26. package/dist/{chunk-AGEOFSDZ.js.map → chunk-CFYLBHVD.js.map} +1 -1
  27. package/dist/{chunk-SI62QJN6.cjs → chunk-CM5SPAVS.cjs} +9 -9
  28. package/dist/{chunk-SI62QJN6.cjs.map → chunk-CM5SPAVS.cjs.map} +1 -1
  29. package/dist/{chunk-2HOPBIDM.js → chunk-CRURZ2L3.js} +3 -3
  30. package/dist/{chunk-2HOPBIDM.js.map → chunk-CRURZ2L3.js.map} +1 -1
  31. package/dist/{chunk-N2EZPXH3.cjs → chunk-CWZIP3XA.cjs} +3 -3
  32. package/dist/{chunk-N2EZPXH3.cjs.map → chunk-CWZIP3XA.cjs.map} +1 -1
  33. package/dist/{chunk-AVEXOOCE.cjs → chunk-DO7NPLHE.cjs} +20 -20
  34. package/dist/{chunk-AVEXOOCE.cjs.map → chunk-DO7NPLHE.cjs.map} +1 -1
  35. package/dist/{chunk-VSJKEJEA.cjs → chunk-IN35S3HE.cjs} +185 -185
  36. package/dist/{chunk-VSJKEJEA.cjs.map → chunk-IN35S3HE.cjs.map} +1 -1
  37. package/dist/{chunk-B35QXEMG.cjs → chunk-J5KOS6DG.cjs} +5 -5
  38. package/dist/{chunk-B35QXEMG.cjs.map → chunk-J5KOS6DG.cjs.map} +1 -1
  39. package/dist/{chunk-I7VQPDZ7.js → chunk-NDJMYGSX.js} +3 -3
  40. package/dist/{chunk-I7VQPDZ7.js.map → chunk-NDJMYGSX.js.map} +1 -1
  41. package/dist/{chunk-VVGJHIQH.js → chunk-S2B7VZP2.js} +3 -3
  42. package/dist/{chunk-VVGJHIQH.js.map → chunk-S2B7VZP2.js.map} +1 -1
  43. package/dist/{chunk-ON4TYQED.cjs → chunk-S4FM2VDW.cjs} +14 -14
  44. package/dist/{chunk-ON4TYQED.cjs.map → chunk-S4FM2VDW.cjs.map} +1 -1
  45. package/dist/{chunk-4EDKJNFU.cjs → chunk-T6D4OICA.cjs} +7 -7
  46. package/dist/{chunk-4EDKJNFU.cjs.map → chunk-T6D4OICA.cjs.map} +1 -1
  47. package/dist/{chunk-6DMP7UU3.js → chunk-TF3R5TSU.js} +9 -9
  48. package/dist/{chunk-6DMP7UU3.js.map → chunk-TF3R5TSU.js.map} +1 -1
  49. package/dist/{chunk-7YWMSWHJ.js → chunk-UHWDPTQ6.js} +4 -4
  50. package/dist/{chunk-7YWMSWHJ.js.map → chunk-UHWDPTQ6.js.map} +1 -1
  51. package/dist/{chunk-TYOVQZSQ.cjs → chunk-WNQT53WL.cjs} +6 -6
  52. package/dist/{chunk-TYOVQZSQ.cjs.map → chunk-WNQT53WL.cjs.map} +1 -1
  53. package/dist/datasets/index.cjs +11 -11
  54. package/dist/datasets/index.js +1 -1
  55. package/dist/docs/SKILL.md +3 -1
  56. package/dist/docs/assets/SOURCE_MAP.json +130 -130
  57. package/dist/docs/references/docs-browser-overview.md +136 -0
  58. package/dist/docs/references/reference-browser-mastra-browser.md +284 -0
  59. package/dist/docs/references/reference.md +3 -0
  60. package/dist/evals/index.cjs +5 -5
  61. package/dist/evals/index.js +2 -2
  62. package/dist/evals/scoreTraces/index.cjs +3 -3
  63. package/dist/evals/scoreTraces/index.js +1 -1
  64. package/dist/harness/index.cjs +7 -7
  65. package/dist/harness/index.js +5 -5
  66. package/dist/index.cjs +2 -2
  67. package/dist/index.js +1 -1
  68. package/dist/llm/index.cjs +20 -20
  69. package/dist/llm/index.js +5 -5
  70. package/dist/loop/index.cjs +14 -14
  71. package/dist/loop/index.js +1 -1
  72. package/dist/mastra/index.cjs +2 -2
  73. package/dist/mastra/index.js +1 -1
  74. package/dist/mastra-UH4BMJCI.cjs +12 -0
  75. package/dist/{mastra-DAVYK67K.cjs.map → mastra-UH4BMJCI.cjs.map} +1 -1
  76. package/dist/mastra-V5WEOIQI.js +3 -0
  77. package/dist/{mastra-IC5TOCD6.js.map → mastra-V5WEOIQI.js.map} +1 -1
  78. package/dist/memory/index.cjs +19 -19
  79. package/dist/memory/index.js +1 -1
  80. package/dist/models-dev-GBFTC4SK.cjs +12 -0
  81. package/dist/{models-dev-V3CMFY6A.cjs.map → models-dev-GBFTC4SK.cjs.map} +1 -1
  82. package/dist/models-dev-H56VRPMF.js +3 -0
  83. package/dist/{models-dev-5ZYOBZZI.js.map → models-dev-H56VRPMF.js.map} +1 -1
  84. package/dist/netlify-DBXTUIEQ.js +3 -0
  85. package/dist/{netlify-IROLGTG3.js.map → netlify-DBXTUIEQ.js.map} +1 -1
  86. package/dist/netlify-XVYJKOMU.cjs +12 -0
  87. package/dist/{netlify-BWJ36562.cjs.map → netlify-XVYJKOMU.cjs.map} +1 -1
  88. package/dist/processor-provider/index.cjs +10 -10
  89. package/dist/processor-provider/index.js +1 -1
  90. package/dist/processors/index.cjs +44 -44
  91. package/dist/processors/index.js +1 -1
  92. package/dist/provider-registry-36IRBNPU.js +3 -0
  93. package/dist/{provider-registry-5XBG4HYJ.js.map → provider-registry-36IRBNPU.js.map} +1 -1
  94. package/dist/provider-registry-NOT45GOM.cjs +44 -0
  95. package/dist/{provider-registry-3AYLGCSG.cjs.map → provider-registry-NOT45GOM.cjs.map} +1 -1
  96. package/dist/relevance/index.cjs +3 -3
  97. package/dist/relevance/index.js +1 -1
  98. package/dist/stream/index.cjs +8 -8
  99. package/dist/stream/index.js +1 -1
  100. package/dist/tool-loop-agent/index.cjs +4 -4
  101. package/dist/tool-loop-agent/index.js +1 -1
  102. package/dist/workflows/evented/index.cjs +10 -10
  103. package/dist/workflows/evented/index.js +1 -1
  104. package/dist/workflows/index.cjs +24 -24
  105. package/dist/workflows/index.js +1 -1
  106. package/package.json +5 -5
  107. package/dist/mastra-DAVYK67K.cjs +0 -12
  108. package/dist/mastra-IC5TOCD6.js +0 -3
  109. package/dist/models-dev-5ZYOBZZI.js +0 -3
  110. package/dist/models-dev-V3CMFY6A.cjs +0 -12
  111. package/dist/netlify-BWJ36562.cjs +0 -12
  112. package/dist/netlify-IROLGTG3.js +0 -3
  113. package/dist/provider-registry-3AYLGCSG.cjs +0 -44
  114. package/dist/provider-registry-5XBG4HYJ.js +0 -3
@@ -0,0 +1,136 @@
1
+ # Browser overview
2
+
3
+ Browser support enables agents to navigate websites, interact with page elements, fill forms, and extract data. Mastra provides browser capabilities through SDK providers that wrap popular browser automation libraries.
4
+
5
+ Mastra supports two browser SDK providers:
6
+
7
+ - [**AgentBrowser**](https://mastra.ai/docs/browser/agent-browser): A Playwright-based provider with accessibility-first element targeting. Best for general web automation and scraping.
8
+ - [**Stagehand**](https://mastra.ai/docs/browser/stagehand): A Browserbase provider with AI-powered element detection. Best for complex interactions that benefit from natural language selectors.
9
+
10
+ ## When to use browser
11
+
12
+ Use browser when your agent needs to:
13
+
14
+ - Navigate websites and interact with page elements
15
+ - Fill out forms and submit data
16
+ - Extract structured data from web pages
17
+ - Automate multi-step web workflows
18
+ - Take actions that require a real browser (JavaScript rendering, authentication flows)
19
+
20
+ ## How it works
21
+
22
+ When you assign a browser to an agent, Mastra includes the provider's tools in the agent's toolset. The agent uses these tools to control the browser: navigating to URLs, selecting elements, typing text, and reading page content.
23
+
24
+ Each provider offers a different set of tools optimized for its approach.
25
+
26
+ ## Quickstart
27
+
28
+ Install your provider of choice, for this example you'll use the AgentBrowser provider.
29
+
30
+ **npm**:
31
+
32
+ ```bash
33
+ npm install @mastra/agent-browser
34
+ ```
35
+
36
+ **pnpm**:
37
+
38
+ ```bash
39
+ pnpm add @mastra/agent-browser
40
+ ```
41
+
42
+ **Yarn**:
43
+
44
+ ```bash
45
+ yarn add @mastra/agent-browser
46
+ ```
47
+
48
+ **Bun**:
49
+
50
+ ```bash
51
+ bun add @mastra/agent-browser
52
+ ```
53
+
54
+ Create a new browser instance:
55
+
56
+ ```typescript
57
+ import { AgentBrowser } from '@mastra/agent-browser'
58
+
59
+ export const browser = new AgentBrowser({
60
+ headless: false,
61
+ })
62
+ ```
63
+
64
+ Assign the browser to an agent:
65
+
66
+ ```typescript
67
+ import { Agent } from '@mastra/core/agent'
68
+ import { browser } from '../browsers'
69
+
70
+ export const webAgent = new Agent({
71
+ id: 'web-agent',
72
+ model: 'openai/gpt-5.4',
73
+ browser,
74
+ instructions:
75
+ 'You are a web automation assistant. Use browser tools to navigate websites and complete tasks.',
76
+ })
77
+ ```
78
+
79
+ The agent automatically receives all browser tools from the provider.
80
+
81
+ ## Cloud providers
82
+
83
+ Both SDK providers support connecting to cloud browser services instead of launching a local browser.
84
+
85
+ ### Browserbase (Stagehand native)
86
+
87
+ Stagehand has native Browserbase integration:
88
+
89
+ ```typescript
90
+ import { StagehandBrowser } from '@mastra/stagehand'
91
+
92
+ const browser = new StagehandBrowser({
93
+ env: 'BROWSERBASE',
94
+ apiKey: process.env.BROWSERBASE_API_KEY,
95
+ projectId: process.env.BROWSERBASE_PROJECT_ID,
96
+ })
97
+ ```
98
+
99
+ ### CDP URL (any provider)
100
+
101
+ Connect to any browser exposing a Chrome DevTools Protocol (CDP) endpoint:
102
+
103
+ ```typescript
104
+ import { AgentBrowser } from '@mastra/agent-browser'
105
+
106
+ const browser = new AgentBrowser({
107
+ cdpUrl: process.env.BROWSER_CDP_URL,
108
+ headless: true,
109
+ })
110
+ ```
111
+
112
+ This works with any [CDP-compatible](https://chromedevtools.github.io/devtools-protocol/) browser service.
113
+
114
+ ## Screencast
115
+
116
+ Browser providers stream a live video feed of the browser to the Mastra Studio UI. This lets you watch the agent interact with pages in real-time.
117
+
118
+ Screencast is enabled by default and can be configured:
119
+
120
+ ```typescript
121
+ const browser = new AgentBrowser({
122
+ screencast: {
123
+ enabled: true,
124
+ format: 'jpeg',
125
+ quality: 80,
126
+ maxWidth: 1280,
127
+ maxHeight: 720,
128
+ },
129
+ })
130
+ ```
131
+
132
+ ## Next steps
133
+
134
+ - [AgentBrowser](https://mastra.ai/docs/browser/agent-browser)
135
+ - [Stagehand](https://mastra.ai/docs/browser/stagehand)
136
+ - [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
@@ -0,0 +1,284 @@
1
+ # MastraBrowser class
2
+
3
+ The `MastraBrowser` class is the abstract base class for browser automation providers. It defines the common interface for launching browsers, managing thread isolation, streaming screencasts, and handling input events.
4
+
5
+ You don't instantiate `MastraBrowser` directly. Instead, use a provider implementation:
6
+
7
+ - [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser): Deterministic browser automation using refs
8
+ - [`StagehandBrowser`](https://mastra.ai/reference/browser/stagehand-browser): AI-powered browser automation using natural language
9
+
10
+ ## Usage example
11
+
12
+ ```typescript
13
+ import { Agent } from '@mastra/core/agent'
14
+ import { AgentBrowser } from '@mastra/agent-browser'
15
+
16
+ const browser = new AgentBrowser({
17
+ headless: true,
18
+ viewport: { width: 1280, height: 720 },
19
+ scope: 'thread',
20
+ })
21
+
22
+ export const browserAgent = new Agent({
23
+ name: 'browser-agent',
24
+ instructions: 'You can browse the web to find information.',
25
+ model: 'openai/gpt-5.4',
26
+ browser,
27
+ })
28
+ ```
29
+
30
+ ## Constructor parameters
31
+
32
+ **headless** (`boolean`): Whether to run the browser in headless mode (no visible UI). (Default: `true`)
33
+
34
+ **viewport** (`{ width: number; height: number }`): Browser viewport dimensions. Controls the size of the browser window. (Default: `{ width: 1280, height: 720 }`)
35
+
36
+ **timeout** (`number`): Default timeout in milliseconds for browser operations. (Default: `10000`)
37
+
38
+ **cdpUrl** (`string | (() => string | Promise<string>)`): CDP WebSocket URL, HTTP endpoint, or sync/async provider function. When provided, connects to an existing browser instead of launching a new one. HTTP endpoints are resolved to WebSocket internally. Can't be used with scope: 'thread' (automatically uses shared scope).
39
+
40
+ **scope** (`'shared' | 'thread'`): Browser instance scope across threads. 'shared' means all threads share a single browser instance. 'thread' means each thread gets its own browser instance (full isolation). (Default: `'thread' (or 'shared' when cdpUrl is provided)`)
41
+
42
+ **onLaunch** (`(args: { browser: MastraBrowser }) => void | Promise<void>`): Callback invoked after the browser reaches 'ready' status.
43
+
44
+ **onClose** (`(args: { browser: MastraBrowser }) => void | Promise<void>`): Callback invoked before the browser is closed.
45
+
46
+ **screencast** (`ScreencastOptions`): Configuration for streaming browser frames.
47
+
48
+ **screencast.format** (`'jpeg' | 'png'`): Image format for screencast frames.
49
+
50
+ **screencast.quality** (`number`): Image quality (1-100). Only applies to JPEG format.
51
+
52
+ **screencast.maxWidth** (`number`): Maximum width for screencast frames.
53
+
54
+ **screencast.maxHeight** (`number`): Maximum height for screencast frames.
55
+
56
+ **screencast.everyNthFrame** (`number`): Capture every Nth frame to reduce bandwidth.
57
+
58
+ ## Properties
59
+
60
+ The following properties (`id`, `name`, `provider`) are abstract and must be defined by concrete provider implementations:
61
+
62
+ **id** (`string`): Unique identifier for this browser instance. Abstract - defined by provider.
63
+
64
+ **name** (`string`): Human-readable name of the browser provider (e.g., 'AgentBrowser', 'StagehandBrowser'). Abstract - defined by provider.
65
+
66
+ **provider** (`string`): Provider identifier (e.g., 'vercel-labs/agent-browser', 'browserbase/stagehand'). Abstract - defined by provider.
67
+
68
+ **headless** (`boolean`): Whether the browser is running in headless mode.
69
+
70
+ **status** (`BrowserStatus`): Current browser status: 'pending', 'launching', 'ready', 'error', 'closing', or 'closed'.
71
+
72
+ ## Methods
73
+
74
+ ### Lifecycle
75
+
76
+ #### `ensureReady()`
77
+
78
+ Ensures the browser is launched and ready for use. Automatically called before tool execution. Implemented in the base class.
79
+
80
+ ```typescript
81
+ await browser.ensureReady()
82
+ ```
83
+
84
+ #### `close()`
85
+
86
+ Closes the browser and cleans up all resources. Implemented in the base class with race-condition-safe handling.
87
+
88
+ ```typescript
89
+ await browser.close()
90
+ ```
91
+
92
+ #### `isBrowserRunning()`
93
+
94
+ Checks if the browser is currently running.
95
+
96
+ ```typescript
97
+ const isRunning = browser.isBrowserRunning()
98
+ ```
99
+
100
+ **Returns:** `boolean`
101
+
102
+ ### Thread management
103
+
104
+ #### `setCurrentThread(threadId)`
105
+
106
+ Sets the current thread ID for browser operations. Used internally by the agent runtime.
107
+
108
+ ```typescript
109
+ browser.setCurrentThread('thread-123')
110
+ ```
111
+
112
+ #### `getCurrentThread()`
113
+
114
+ Gets the current thread ID.
115
+
116
+ ```typescript
117
+ const threadId = browser.getCurrentThread()
118
+ ```
119
+
120
+ **Returns:** `string`
121
+
122
+ #### `hasThreadSession(threadId)`
123
+
124
+ Checks if a thread has an active browser session.
125
+
126
+ ```typescript
127
+ const hasSession = browser.hasThreadSession('thread-123')
128
+ ```
129
+
130
+ **Returns:** `boolean`
131
+
132
+ #### `closeThreadSession(threadId)`
133
+
134
+ Closes a specific thread's browser session. For 'thread' scope, this closes that thread's browser instance. For 'shared' scope, this clears the thread's state.
135
+
136
+ ```typescript
137
+ await browser.closeThreadSession('thread-123')
138
+ ```
139
+
140
+ ### Tools
141
+
142
+ #### `getTools()`
143
+
144
+ Returns the browser tools for use with agents. Each provider returns different tools based on its paradigm.
145
+
146
+ ```typescript
147
+ const tools = browser.getTools()
148
+ ```
149
+
150
+ **Returns:** `Record<string, Tool>`
151
+
152
+ ### Screencast
153
+
154
+ #### `startScreencast(options?, threadId?)`
155
+
156
+ Starts streaming browser frames. Returns a `ScreencastStream` that emits frame events.
157
+
158
+ ```typescript
159
+ const stream = await browser.startScreencast({ format: 'jpeg', quality: 80 }, 'thread-123')
160
+
161
+ stream.on('frame', frame => {
162
+ console.log('Frame received:', frame.data.length, 'bytes')
163
+ })
164
+
165
+ stream.on('stop', reason => {
166
+ console.log('Screencast stopped:', reason)
167
+ })
168
+ ```
169
+
170
+ **Returns:** `Promise<ScreencastStream>`
171
+
172
+ ### Input injection
173
+
174
+ #### `injectMouseEvent(params, threadId?)`
175
+
176
+ Injects a mouse event into the browser. Used by Studio for live interaction.
177
+
178
+ ```typescript
179
+ await browser.injectMouseEvent({
180
+ type: 'mousePressed',
181
+ x: 100,
182
+ y: 200,
183
+ button: 'left',
184
+ clickCount: 1,
185
+ })
186
+ ```
187
+
188
+ #### `injectKeyboardEvent(params, threadId?)`
189
+
190
+ Injects a keyboard event into the browser. Used by Studio for live interaction.
191
+
192
+ ```typescript
193
+ await browser.injectKeyboardEvent({
194
+ type: 'keyDown',
195
+ key: 'Enter',
196
+ code: 'Enter',
197
+ })
198
+ ```
199
+
200
+ ### State
201
+
202
+ #### `getState(threadId?)`
203
+
204
+ Gets the current browser state including URL and tabs.
205
+
206
+ ```typescript
207
+ const state = await browser.getState('thread-123')
208
+ console.log('Current URL:', state.currentUrl)
209
+ console.log('Tabs:', state.tabs)
210
+ ```
211
+
212
+ **Returns:** `Promise<BrowserState>`
213
+
214
+ ```typescript
215
+ interface BrowserState {
216
+ currentUrl: string | null
217
+ tabs: BrowserTabState[]
218
+ activeTabIndex: number
219
+ }
220
+
221
+ interface BrowserTabState {
222
+ id: string
223
+ url: string
224
+ title: string
225
+ }
226
+ ```
227
+
228
+ #### `getCurrentUrl(threadId?)`
229
+
230
+ Gets the current page URL.
231
+
232
+ ```typescript
233
+ const url = await browser.getCurrentUrl()
234
+ ```
235
+
236
+ **Returns:** `Promise<string | null>`
237
+
238
+ ## Browser scope
239
+
240
+ The `scope` option controls how browser instances are shared across conversation threads:
241
+
242
+ | Scope | Description | Use case |
243
+ | ---------- | ------------------------------------------- | ---------------------------------------- |
244
+ | `'shared'` | All threads share a single browser instance | Cost-efficient for non-conflicting tasks |
245
+ | `'thread'` | Each thread gets its own browser instance | Full isolation for concurrent users |
246
+
247
+ ```typescript
248
+ // Shared browser for all threads
249
+ const sharedBrowser = new AgentBrowser({
250
+ scope: 'shared',
251
+ })
252
+
253
+ // Isolated browser per thread
254
+ const isolatedBrowser = new AgentBrowser({
255
+ scope: 'thread',
256
+ })
257
+ ```
258
+
259
+ When using `cdpUrl` to connect to an external browser, the scope automatically falls back to `'shared'` since you can't spawn new browser instances.
260
+
261
+ ## Cloud browser providers
262
+
263
+ Connect to cloud browser services using the `cdpUrl` option:
264
+
265
+ ```typescript
266
+ // Static CDP URL
267
+ const browser = new AgentBrowser({
268
+ cdpUrl: 'wss://browser.example.com/ws',
269
+ })
270
+
271
+ // Dynamic CDP URL (e.g., session-based)
272
+ const browser = new AgentBrowser({
273
+ cdpUrl: async () => {
274
+ const session = await createBrowserSession()
275
+ return session.wsUrl
276
+ },
277
+ })
278
+ ```
279
+
280
+ ## Related
281
+
282
+ - [AgentBrowser](https://mastra.ai/reference/browser/agent-browser): Deterministic browser automation
283
+ - [StagehandBrowser](https://mastra.ai/reference/browser/stagehand-browser): AI-powered browser automation
284
+ - [Browser overview](https://mastra.ai/docs/browser/overview): Conceptual guide to browser automation
@@ -39,6 +39,9 @@ The Reference section provides documentation of Mastra's API, including paramete
39
39
  - [Okta](https://mastra.ai/reference/auth/okta)
40
40
  - [Supabase](https://mastra.ai/reference/auth/supabase)
41
41
  - [WorkOS](https://mastra.ai/reference/auth/workos)
42
+ - [AgentBrowser](https://mastra.ai/reference/browser/agent-browser)
43
+ - [MastraBrowser Class](https://mastra.ai/reference/browser/mastra-browser)
44
+ - [StagehandBrowser](https://mastra.ai/reference/browser/stagehand-browser)
42
45
  - [create-mastra](https://mastra.ai/reference/cli/create-mastra)
43
46
  - [mastra](https://mastra.ai/reference/cli/mastra)
44
47
  - [Agents API](https://mastra.ai/reference/client-js/agents)
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkB35QXEMG_cjs = require('../chunk-B35QXEMG.cjs');
4
- var chunkON4TYQED_cjs = require('../chunk-ON4TYQED.cjs');
3
+ var chunkJ5KOS6DG_cjs = require('../chunk-J5KOS6DG.cjs');
4
+ var chunkS4FM2VDW_cjs = require('../chunk-S4FM2VDW.cjs');
5
5
  var chunk3UBTJXPW_cjs = require('../chunk-3UBTJXPW.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "runEvals", {
10
10
  enumerable: true,
11
- get: function () { return chunkB35QXEMG_cjs.runEvals; }
11
+ get: function () { return chunkJ5KOS6DG_cjs.runEvals; }
12
12
  });
13
13
  Object.defineProperty(exports, "MastraScorer", {
14
14
  enumerable: true,
15
- get: function () { return chunkON4TYQED_cjs.MastraScorer; }
15
+ get: function () { return chunkS4FM2VDW_cjs.MastraScorer; }
16
16
  });
17
17
  Object.defineProperty(exports, "createScorer", {
18
18
  enumerable: true,
19
- get: function () { return chunkON4TYQED_cjs.createScorer; }
19
+ get: function () { return chunkS4FM2VDW_cjs.createScorer; }
20
20
  });
21
21
  Object.defineProperty(exports, "extractTrajectory", {
22
22
  enumerable: true,
@@ -1,5 +1,5 @@
1
- export { runEvals } from '../chunk-I7VQPDZ7.js';
2
- export { MastraScorer, createScorer } from '../chunk-AGEOFSDZ.js';
1
+ export { runEvals } from '../chunk-NDJMYGSX.js';
2
+ export { MastraScorer, createScorer } from '../chunk-CFYLBHVD.js';
3
3
  export { extractTrajectory, extractTrajectoryFromTrace, extractWorkflowTrajectory, listScoresResponseSchema, saveScorePayloadSchema, scoreResultSchema, scoreRowDataSchema, scoringEntityTypeSchema, scoringExtractStepResultSchema, scoringHookInputSchema, scoringInputSchema, scoringInputWithExtractStepResultAndAnalyzeStepResultSchema, scoringInputWithExtractStepResultAndScoreAndReasonSchema, scoringInputWithExtractStepResultSchema, scoringPromptsSchema, scoringSourceSchema, scoringValueSchema } from '../chunk-5OXVECLF.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkI3Y3GPMU_cjs = require('../../chunk-I3Y3GPMU.cjs');
3
+ var chunkB2PK5R4Q_cjs = require('../../chunk-B2PK5R4Q.cjs');
4
4
  var chunk3UBTJXPW_cjs = require('../../chunk-3UBTJXPW.cjs');
5
5
  var chunkPHSDY5MP_cjs = require('../../chunk-PHSDY5MP.cjs');
6
6
  var chunk4U7ZLI36_cjs = require('../../chunk-4U7ZLI36.cjs');
@@ -234,7 +234,7 @@ function transformTraceToScorerInputAndOutput(trace) {
234
234
  }
235
235
 
236
236
  // src/evals/scoreTraces/scoreTracesWorkflow.ts
237
- var getTraceStep = chunkI3Y3GPMU_cjs.createStep({
237
+ var getTraceStep = chunkB2PK5R4Q_cjs.createStep({
238
238
  id: "__process-trace-scoring",
239
239
  inputSchema: v4.z.object({
240
240
  targets: v4.z.array(
@@ -429,7 +429,7 @@ async function attachScoreToSpan({
429
429
  } catch {
430
430
  }
431
431
  }
432
- var scoreTracesWorkflow = chunkI3Y3GPMU_cjs.createWorkflow({
432
+ var scoreTracesWorkflow = chunkB2PK5R4Q_cjs.createWorkflow({
433
433
  id: "__batch-scoring-traces",
434
434
  inputSchema: v4.z.object({
435
435
  targets: v4.z.array(
@@ -1,4 +1,4 @@
1
- import { createStep, createWorkflow } from '../../chunk-VVGJHIQH.js';
1
+ import { createStep, createWorkflow } from '../../chunk-S2B7VZP2.js';
2
2
  import { saveScorePayloadSchema } from '../../chunk-5OXVECLF.js';
3
3
  import { getEntityTypeForSpan } from '../../chunk-JVXQTSRU.js';
4
4
  import { MastraError } from '../../chunk-FJEVLHJT.js';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkFDZIDJEN_cjs = require('../chunk-FDZIDJEN.cjs');
4
- var chunkON4TYQED_cjs = require('../chunk-ON4TYQED.cjs');
3
+ var chunkC7Y7CU7Z_cjs = require('../chunk-C7Y7CU7Z.cjs');
4
+ var chunkS4FM2VDW_cjs = require('../chunk-S4FM2VDW.cjs');
5
5
  var chunkRNJ2FXGD_cjs = require('../chunk-RNJ2FXGD.cjs');
6
6
  var chunkNAYAEPMW_cjs = require('../chunk-NAYAEPMW.cjs');
7
7
  var chunkLDLHW3QN_cjs = require('../chunk-LDLHW3QN.cjs');
@@ -313,7 +313,7 @@ Use this tool when:
313
313
  };
314
314
  }
315
315
  const workspace = context?.workspace;
316
- const subagent = new chunkON4TYQED_cjs.Agent({
316
+ const subagent = new chunkS4FM2VDW_cjs.Agent({
317
317
  id: `subagent-${definition.id}`,
318
318
  name: `${definition.name} Subagent`,
319
319
  instructions: definition.instructions,
@@ -576,7 +576,7 @@ var Harness = class {
576
576
  */
577
577
  async init() {
578
578
  if (this.config.storage) {
579
- this.#internalMastra = new chunkFDZIDJEN_cjs.Mastra({ logger: false, storage: this.config.storage });
579
+ this.#internalMastra = new chunkC7Y7CU7Z_cjs.Mastra({ logger: false, storage: this.config.storage });
580
580
  await this.#internalMastra.getStorage().init();
581
581
  }
582
582
  if (this.config.workspace && !this.workspaceInitialized && !this.workspaceFn) {
@@ -832,7 +832,7 @@ var Harness = class {
832
832
  }
833
833
  }
834
834
  try {
835
- const { PROVIDER_REGISTRY } = await import('../provider-registry-3AYLGCSG.cjs');
835
+ const { PROVIDER_REGISTRY } = await import('../provider-registry-NOT45GOM.cjs');
836
836
  const registry = PROVIDER_REGISTRY;
837
837
  const providerConfig = registry[provider];
838
838
  const envVars = providerConfig?.apiKeyEnvVar;
@@ -852,7 +852,7 @@ var Harness = class {
852
852
  */
853
853
  async listAvailableModels() {
854
854
  try {
855
- const { PROVIDER_REGISTRY } = await import('../provider-registry-3AYLGCSG.cjs');
855
+ const { PROVIDER_REGISTRY } = await import('../provider-registry-NOT45GOM.cjs');
856
856
  if (!PROVIDER_REGISTRY) return [];
857
857
  const registry = PROVIDER_REGISTRY;
858
858
  const providers = Object.keys(registry);
@@ -911,7 +911,7 @@ var Harness = class {
911
911
  }
912
912
  async getProviderApiKeyEnvVar(provider) {
913
913
  try {
914
- const { PROVIDER_REGISTRY } = await import('../provider-registry-3AYLGCSG.cjs');
914
+ const { PROVIDER_REGISTRY } = await import('../provider-registry-NOT45GOM.cjs');
915
915
  const registry = PROVIDER_REGISTRY;
916
916
  const envVars = registry[provider]?.apiKeyEnvVar;
917
917
  return Array.isArray(envVars) ? envVars[0] : envVars;
@@ -1,5 +1,5 @@
1
- import { Mastra } from '../chunk-6DMP7UU3.js';
2
- import { Agent } from '../chunk-AGEOFSDZ.js';
1
+ import { Mastra } from '../chunk-TF3R5TSU.js';
2
+ import { Agent } from '../chunk-CFYLBHVD.js';
3
3
  import { Workspace, createWorkspaceTools } from '../chunk-TD7IL7ZC.js';
4
4
  import { safeStringify } from '../chunk-OLCO53KU.js';
5
5
  import { createTool } from '../chunk-JTIQYXE2.js';
@@ -830,7 +830,7 @@ var Harness = class {
830
830
  }
831
831
  }
832
832
  try {
833
- const { PROVIDER_REGISTRY } = await import('../provider-registry-5XBG4HYJ.js');
833
+ const { PROVIDER_REGISTRY } = await import('../provider-registry-36IRBNPU.js');
834
834
  const registry = PROVIDER_REGISTRY;
835
835
  const providerConfig = registry[provider];
836
836
  const envVars = providerConfig?.apiKeyEnvVar;
@@ -850,7 +850,7 @@ var Harness = class {
850
850
  */
851
851
  async listAvailableModels() {
852
852
  try {
853
- const { PROVIDER_REGISTRY } = await import('../provider-registry-5XBG4HYJ.js');
853
+ const { PROVIDER_REGISTRY } = await import('../provider-registry-36IRBNPU.js');
854
854
  if (!PROVIDER_REGISTRY) return [];
855
855
  const registry = PROVIDER_REGISTRY;
856
856
  const providers = Object.keys(registry);
@@ -909,7 +909,7 @@ var Harness = class {
909
909
  }
910
910
  async getProviderApiKeyEnvVar(provider) {
911
911
  try {
912
- const { PROVIDER_REGISTRY } = await import('../provider-registry-5XBG4HYJ.js');
912
+ const { PROVIDER_REGISTRY } = await import('../provider-registry-36IRBNPU.js');
913
913
  const registry = PROVIDER_REGISTRY;
914
914
  const envVars = registry[provider]?.apiKeyEnvVar;
915
915
  return Array.isArray(envVars) ? envVars[0] : envVars;
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkFDZIDJEN_cjs = require('./chunk-FDZIDJEN.cjs');
3
+ var chunkC7Y7CU7Z_cjs = require('./chunk-C7Y7CU7Z.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Mastra", {
8
8
  enumerable: true,
9
- get: function () { return chunkFDZIDJEN_cjs.Mastra; }
9
+ get: function () { return chunkC7Y7CU7Z_cjs.Mastra; }
10
10
  });
11
11
  //# sourceMappingURL=index.cjs.map
12
12
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Mastra } from './chunk-6DMP7UU3.js';
1
+ export { Mastra } from './chunk-TF3R5TSU.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map