@natewong1313/stagehand 3.0.8

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Browserbase Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,164 @@
1
+ <div id="toc" align="center" style="margin-bottom: 0;">
2
+ <ul style="list-style: none; margin: 0; padding: 0;">
3
+ <a href="https://stagehand.dev">
4
+ <picture>
5
+ <source media="(prefers-color-scheme: dark)" srcset="../../media/dark_logo.png" />
6
+ <img alt="Stagehand" src="../../media/light_logo.png" width="200" style="margin-right: 30px;" />
7
+ </picture>
8
+ </a>
9
+ </ul>
10
+ </div>
11
+ <p align="center">
12
+ <strong>The AI Browser Automation Framework</strong><br>
13
+ <a href="https://docs.stagehand.dev">Read the Docs</a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://github.com/browserbase/stagehand/tree/main?tab=MIT-1-ov-file#MIT-1-ov-file">
18
+ <picture>
19
+ <source media="(prefers-color-scheme: dark)" srcset="../../media/dark_license.svg" />
20
+ <img alt="MIT License" src="../../media/light_license.svg" />
21
+ </picture>
22
+ </a>
23
+ <a href="https://stagehand.dev/discord">
24
+ <picture>
25
+ <source media="(prefers-color-scheme: dark)" srcset="../../media/dark_discord.svg" />
26
+ <img alt="Discord Community" src="../../media/light_discord.svg" />
27
+ </picture>
28
+ </a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="https://trendshift.io/repositories/12122" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12122" alt="browserbase%2Fstagehand | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
33
+ </p>
34
+
35
+ <p align="center">
36
+ <a href="https://deepwiki.com/browserbase/stagehand">
37
+ <img alt="Ask DeepWiki" src="https://deepwiki.com/badge.svg" />
38
+ </a>
39
+ </p>
40
+
41
+ <p align="center">
42
+ If you're looking for the Python implementation, you can find it
43
+ <a href="https://github.com/browserbase/stagehand-python"> here</a>
44
+ </p>
45
+
46
+ <div align="center" style="display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 0;">
47
+ <b>Vibe code</b>
48
+ <span style="font-size: 1.05em;"> Stagehand with </span>
49
+ <a href="https://director.ai" style="display: flex; align-items: center;">
50
+ <span>Director</span>
51
+ </a>
52
+ <span> </span>
53
+ <picture>
54
+ <img alt="Director" src="../../media/director_icon.svg" width="25" />
55
+ </picture>
56
+ </div>
57
+
58
+ ## What is Stagehand?
59
+
60
+ Stagehand is a browser automation framework used to control web browsers with natural language and code. By combining the power of AI with the precision of code, Stagehand makes web automation flexible, maintainable, and actually reliable.
61
+
62
+ ## Why Stagehand?
63
+
64
+ Most existing browser automation tools either require you to write low-level code in a framework like Selenium, Playwright, or Puppeteer, or use high-level agents that can be unpredictable in production. By letting developers choose what to write in code vs. natural language (and bridging the gap between the two) Stagehand is the natural choice for browser automations in production.
65
+
66
+ 1. **Choose when to write code vs. natural language**: use AI when you want to navigate unfamiliar pages, and use code when you know exactly what you want to do.
67
+
68
+ 2. **Go from AI-driven to repeatable workflows**: Stagehand lets you preview AI actions before running them, and also helps you easily cache repeatable actions to save time and tokens.
69
+
70
+ 3. **Write once, run forever**: Stagehand's auto-caching combined with self-healing remembers previous actions, runs without LLM inference, and knows when to involve AI whenever the website changes and your automation breaks.
71
+
72
+ ## Getting Started
73
+
74
+ Start with Stagehand with one line of code, or check out our [Quickstart Guide](https://docs.stagehand.dev/v3/first-steps/quickstart) for more information:
75
+
76
+ ```bash
77
+ npx create-browser-app
78
+ ```
79
+
80
+ ## Example
81
+
82
+ Here's how to build a sample browser automation with Stagehand:
83
+
84
+ ```typescript
85
+ // Stagehand's CDP engine provides an optimized, low level interface to the browser built for automation
86
+ const page = stagehand.context.pages()[0];
87
+ await page.goto("https://github.com/browserbase");
88
+
89
+ // Use act() to execute individual actions
90
+ await stagehand.act("click on the stagehand repo");
91
+
92
+ // Use agent() for multi-step tasks
93
+ const agent = stagehand.agent();
94
+ await agent.execute("Get to the latest PR");
95
+
96
+ // Use extract() to get structured data from the page
97
+ const { author, title } = await stagehand.extract(
98
+ "extract the author and title of the PR",
99
+ z.object({
100
+ author: z.string().describe("The username of the PR author"),
101
+ title: z.string().describe("The title of the PR"),
102
+ }),
103
+ );
104
+ ```
105
+
106
+ ## Documentation
107
+
108
+ Visit [docs.stagehand.dev](https://docs.stagehand.dev) to view the full documentation.
109
+
110
+ ### Build and Run from Source
111
+
112
+ ```bash
113
+ git clone https://github.com/browserbase/stagehand.git
114
+ cd stagehand
115
+ pnpm install
116
+ pnpm run build
117
+ pnpm run example # run the blank script at ./examples/example.ts
118
+ ```
119
+
120
+ Stagehand is best when you have an API key for an LLM provider and Browserbase credentials. To add these to your project, run:
121
+
122
+ ```bash
123
+ cp .env.example .env
124
+ nano .env # Edit the .env file to add API keys
125
+ ```
126
+
127
+ ### Installing from a branch
128
+
129
+ You can install and build Stagehand directly from a github branch using [gitpkg](https://github.com/EqualMa/gitpkg)
130
+
131
+ In your project's `package.json` set:
132
+
133
+ ```json
134
+ "@browserbasehq/stagehand": "https://gitpkg.now.sh/browserbase/stagehand/packages/core?<branchName>",
135
+ ```
136
+
137
+ ## Contributing
138
+
139
+ > [!NOTE]
140
+ > We highly value contributions to Stagehand! For questions or support, please join our [Discord community](https://stagehand.dev/discord).
141
+
142
+ At a high level, we're focused on improving reliability, extensibility, speed, and cost in that order of priority. If you're interested in contributing, **bug fixes and small improvements are the best way to get started**. For more involved features, we strongly recommend reaching out to [Miguel Gonzalez](https://x.com/miguel_gonzf) or [Paul Klein](https://x.com/pk_iv) in our [Discord community](https://stagehand.dev/discord) before starting to ensure that your contribution aligns with our goals.
143
+
144
+ <!-- For more information, please see our [Contributing Guide](https://docs.stagehand.dev/examples/contributing). -->
145
+
146
+ ## Acknowledgements
147
+
148
+ We'd like to thank the following people for their major contributions to Stagehand:
149
+
150
+ - [Paul Klein](https://github.com/pkiv)
151
+ - [Sean McGuire](https://github.com/seanmcguire12)
152
+ - [Miguel Gonzalez](https://github.com/miguelg719)
153
+ - [Sameel Arif](https://github.com/sameelarif)
154
+ - [Thomas Katwan](https://github.com/tkattkat)
155
+ - [Filip Michalsky](https://github.com/filip-michalsky)
156
+ - [Anirudh Kamath](https://github.com/kamath)
157
+ - [Jeremy Press](https://x.com/jeremypress)
158
+ - [Navid Pour](https://github.com/navidpour)
159
+
160
+ ## License
161
+
162
+ Licensed under the MIT License.
163
+
164
+ Copyright 2025 Browserbase, Inc.