@mastra/stagehand 0.0.0-async-hooks-fix-20260405144639

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,88 @@
1
+ # @mastra/stagehand
2
+
3
+ ## 0.0.0-async-hooks-fix-20260405144639
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`f32b9e1`](https://github.com/mastra-ai/mastra/commit/f32b9e115a3c754d1c8cfa3f4256fba87b09cfb7), [`ed425d7`](https://github.com/mastra-ai/mastra/commit/ed425d78e7c66cbda8209fee910856f98c6c6b82), [`ba6f7e9`](https://github.com/mastra-ai/mastra/commit/ba6f7e9086d8281393f2acae60fda61de3bff1f9), [`7eb2596`](https://github.com/mastra-ai/mastra/commit/7eb25960d607e07468c9a10c5437abd2deaf1e9a), [`1805ddc`](https://github.com/mastra-ai/mastra/commit/1805ddc9c9b3b14b63749735a13c05a45af43a80), [`6c68328`](https://github.com/mastra-ai/mastra/commit/6c683282779fdb12d75044c3f5db33886cf4a1f4)]:
8
+ - @mastra/core@0.0.0-async-hooks-fix-20260405144639
9
+
10
+ ## 0.1.0
11
+
12
+ ### Minor Changes
13
+
14
+ - Add AI-powered browser automation with Stagehand SDK integration ([#14938](https://github.com/mastra-ai/mastra/pull/14938))
15
+
16
+ **New Features:**
17
+ - AI-powered browser automation using Stagehand's act/extract/observe primitives
18
+ - Native Browserbase integration for cloud browser sessions
19
+ - Real-time screencast streaming via WebSocket
20
+ - Mouse and keyboard input injection
21
+ - Thread-scoped browser isolation (`scope: 'thread'`)
22
+ - State persistence and restoration across sessions
23
+
24
+ **Configuration:**
25
+
26
+ ```typescript
27
+ import { StagehandBrowser } from '@mastra/stagehand';
28
+
29
+ // Local browser
30
+ const browser = new StagehandBrowser({
31
+ headless: true,
32
+ scope: 'thread',
33
+ });
34
+
35
+ // Browserbase cloud
36
+ const browser = new StagehandBrowser({
37
+ env: 'BROWSERBASE',
38
+ apiKey: process.env.BROWSERBASE_API_KEY,
39
+ projectId: process.env.BROWSERBASE_PROJECT_ID,
40
+ });
41
+
42
+ const agent = mastra.getAgent('my-agent', { browser });
43
+ ```
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [[`cb15509`](https://github.com/mastra-ai/mastra/commit/cb15509b58f6a83e11b765c945082afc027db972), [`81e4259`](https://github.com/mastra-ai/mastra/commit/81e425939b4ceeb4f586e9b6d89c3b1c1f2d2fe7), [`951b8a1`](https://github.com/mastra-ai/mastra/commit/951b8a1b5ef7e1474c59dc4f2b9fc1a8b1e508b6), [`80c5668`](https://github.com/mastra-ai/mastra/commit/80c5668e365470d3a96d3e953868fd7a643ff67c), [`3d478c1`](https://github.com/mastra-ai/mastra/commit/3d478c1e13f17b80f330ac49d7aa42ef929b93ff), [`2b4ea10`](https://github.com/mastra-ai/mastra/commit/2b4ea10b053e4ea1ab232d536933a4a3c4cba999), [`a0544f0`](https://github.com/mastra-ai/mastra/commit/a0544f0a1e6bd52ac12676228967c1938e43648d), [`6039f17`](https://github.com/mastra-ai/mastra/commit/6039f176f9c457304825ff1df8c83b8e457376c0), [`06b928d`](https://github.com/mastra-ai/mastra/commit/06b928dfc2f5630d023467476cc5919dfa858d0a), [`6a8d984`](https://github.com/mastra-ai/mastra/commit/6a8d9841f2933456ee1598099f488d742b600054), [`c8c86aa`](https://github.com/mastra-ai/mastra/commit/c8c86aa1458017fbd1c0776fdc0c520d129df8a6)]:
48
+ - @mastra/core@1.22.0
49
+
50
+ ## 0.1.0-alpha.0
51
+
52
+ ### Minor Changes
53
+
54
+ - Add AI-powered browser automation with Stagehand SDK integration ([#14938](https://github.com/mastra-ai/mastra/pull/14938))
55
+
56
+ **New Features:**
57
+ - AI-powered browser automation using Stagehand's act/extract/observe primitives
58
+ - Native Browserbase integration for cloud browser sessions
59
+ - Real-time screencast streaming via WebSocket
60
+ - Mouse and keyboard input injection
61
+ - Thread-scoped browser isolation (`scope: 'thread'`)
62
+ - State persistence and restoration across sessions
63
+
64
+ **Configuration:**
65
+
66
+ ```typescript
67
+ import { StagehandBrowser } from '@mastra/stagehand';
68
+
69
+ // Local browser
70
+ const browser = new StagehandBrowser({
71
+ headless: true,
72
+ scope: 'thread',
73
+ });
74
+
75
+ // Browserbase cloud
76
+ const browser = new StagehandBrowser({
77
+ env: 'BROWSERBASE',
78
+ apiKey: process.env.BROWSERBASE_API_KEY,
79
+ projectId: process.env.BROWSERBASE_PROJECT_ID,
80
+ });
81
+
82
+ const agent = mastra.getAgent('my-agent', { browser });
83
+ ```
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [[`cb15509`](https://github.com/mastra-ai/mastra/commit/cb15509b58f6a83e11b765c945082afc027db972), [`80c5668`](https://github.com/mastra-ai/mastra/commit/80c5668e365470d3a96d3e953868fd7a643ff67c), [`3d478c1`](https://github.com/mastra-ai/mastra/commit/3d478c1e13f17b80f330ac49d7aa42ef929b93ff), [`6039f17`](https://github.com/mastra-ai/mastra/commit/6039f176f9c457304825ff1df8c83b8e457376c0), [`06b928d`](https://github.com/mastra-ai/mastra/commit/06b928dfc2f5630d023467476cc5919dfa858d0a), [`6a8d984`](https://github.com/mastra-ai/mastra/commit/6a8d9841f2933456ee1598099f488d742b600054)]:
88
+ - @mastra/core@1.22.0-alpha.2
package/LICENSE.md ADDED
@@ -0,0 +1,30 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named "ee/" within this
4
+ repository, including but not limited to:
5
+ - `packages/core/src/auth/ee/`
6
+ - `packages/server/src/server/auth/ee/`
7
+ is licensed under the license defined in `ee/LICENSE`.
8
+
9
+ - All third-party components incorporated into the Mastra Software are
10
+ licensed under the original license provided by the owner of the
11
+ applicable component.
12
+
13
+ - Content outside of the above-mentioned directories or restrictions is
14
+ available under the "Apache License 2.0" as defined below.
15
+
16
+ # Apache License 2.0
17
+
18
+ Copyright (c) 2025 Kepler Software, Inc.
19
+
20
+ Licensed under the Apache License, Version 2.0 (the "License");
21
+ you may not use this file except in compliance with the License.
22
+ You may obtain a copy of the License at
23
+
24
+ http://www.apache.org/licenses/LICENSE-2.0
25
+
26
+ Unless required by applicable law or agreed to in writing, software
27
+ distributed under the License is distributed on an "AS IS" BASIS,
28
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
+ See the License for the specific language governing permissions and
30
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @mastra/stagehand
2
+
3
+ AI-powered browser automation for Mastra agents using [Stagehand](https://github.com/browserbase/stagehand).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/stagehand
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Agent } from '@mastra/core';
15
+ import { StagehandBrowser } from '@mastra/stagehand';
16
+
17
+ // Create a Stagehand browser
18
+ const browser = new StagehandBrowser({
19
+ model: 'openai/gpt-4o',
20
+ headless: true,
21
+ });
22
+
23
+ // Create an agent with the browser
24
+ const agent = new Agent({
25
+ name: 'web-agent',
26
+ instructions: 'You are a helpful web assistant.',
27
+ model: { provider: 'openai', modelId: 'gpt-4o' },
28
+ browser,
29
+ });
30
+
31
+ // Use the agent to browse the web with natural language
32
+ const result = await agent.generate('Go to google.com and search for "Mastra AI"');
33
+ ```
34
+
35
+ ## Configuration
36
+
37
+ ```typescript
38
+ const browser = new StagehandBrowser({
39
+ // Environment: 'LOCAL' or 'BROWSERBASE'
40
+ env: 'LOCAL',
41
+
42
+ // Model for AI operations (default: 'openai/gpt-4o')
43
+ model: 'openai/gpt-4o',
44
+ // Or with custom config:
45
+ model: {
46
+ modelName: 'openai/gpt-4o',
47
+ apiKey: process.env.OPENAI_API_KEY,
48
+ },
49
+
50
+ // Run headless (default: true)
51
+ headless: true,
52
+
53
+ // CDP URL for connecting to existing browser
54
+ cdpUrl: 'ws://localhost:9222',
55
+
56
+ // Browserbase config (when env: 'BROWSERBASE')
57
+ apiKey: process.env.BROWSERBASE_API_KEY,
58
+ projectId: process.env.BROWSERBASE_PROJECT_ID,
59
+
60
+ // Logging verbosity (0: silent, 1: errors, 2: verbose)
61
+ verbose: 1,
62
+ });
63
+ ```
64
+
65
+ ## Tools
66
+
67
+ StagehandBrowser exposes 6 AI-powered tools:
68
+
69
+ ### Core AI Tools
70
+
71
+ - **stagehand_act** - Perform actions using natural language
72
+ - **stagehand_extract** - Extract structured data from pages
73
+ - **stagehand_observe** - Discover actionable elements
74
+
75
+ ### Navigation & State
76
+
77
+ - **stagehand_navigate** - Navigate to a URL
78
+ - **stagehand_screenshot** - Take screenshots
79
+ - **stagehand_close** - Close the browser
80
+
81
+ ## Comparison with AgentBrowser
82
+
83
+ | Feature | AgentBrowser | StagehandBrowser |
84
+ | ----------- | ----------------------------- | ---------------------------- |
85
+ | Approach | Deterministic refs ([ref=e1]) | Natural language |
86
+ | Token cost | Low | Higher (LLM calls) |
87
+ | Speed | Fast | Slower |
88
+ | Reliability | High (exact refs) | Variable (AI interpretation) |
89
+ | Best for | Structured workflows | Unknown/dynamic pages |
90
+
91
+ ## License
92
+
93
+ Apache-2.0