Skip to content

Commit 92d3b6f

Browse files
authored
Update README and License with missing/incorrect info (#223)
* Fix company name typo in license * Remove broken evals badge from readme * Update readme * save without formatting
1 parent e1c5abb commit 92d3b6f

File tree

2 files changed

+72
-18
lines changed

2 files changed

+72
-18
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Browseerbase Inc.
3+
Copyright (c) 2024 Browserbase Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</p>
1212

1313
<p align="center">
14-
<a href="https://github.com/browserbase/stagehand/actions/workflows/ci.yml"><img alt="Build Status" src="https://github.com/browserbase/stagehand/actions/workflows/ci.yml/badge.svg" /></a>
1514
<a href="https://www.npmjs.com/package/@browserbasehq/stagehand"><img alt="NPM" src="https://img.shields.io/npm/v/@browserbasehq/stagehand.svg" /></a>
1615
<a href="https://github.com/browserbase/stagehand/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
1716
<a href="https://join.slack.com/t/stagehand-dev/shared_invite/zt-2tdncfgkk-fF8y5U0uJzR2y2_M9c9OJA"><img alt="Slack Community" src="https://img.shields.io/badge/slack-Join%20our%20community-FEC89A.svg?logo=slack" /></a>
@@ -131,22 +130,49 @@ This constructor is used to create an instance of Stagehand.
131130

132131
- **Arguments:**
133132

134-
- `env`: `'LOCAL'` or `'BROWSERBASE'`.
133+
- `env`: `'LOCAL'` or `'BROWSERBASE'`. Defaults to `'BROWSERBASE'`.
134+
- `modelName`: (optional) an `AvailableModel` string to specify the default model to use.
135+
- `modelClientOptions`: (optional) configuration options for the model client.
136+
- `enableCaching`: a `boolean` that enables caching of LLM responses. When set to `true`, the LLM requests will be cached on disk and reused for identical requests. Defaults to `false`.
137+
- `headless`: a `boolean` that determines if the browser runs in headless mode. Defaults to `false`. When the env is set to `BROWSERBASE`, this will be ignored.
138+
- `domSettleTimeoutMs`: an `integer` that specifies the timeout in milliseconds for waiting for the DOM to settle. Defaults to 30000 (30 seconds).
139+
- `apiKey`: (optional) your Browserbase API key. Defaults to `BROWSERBASE_API_KEY` environment variable.
140+
- `projectId`: (optional) your Browserbase project ID. Defaults to `BROWSERBASE_PROJECT_ID` environment variable.
141+
- `browserBaseSessionCreateParams`: configuration options for creating new Browserbase sessions.
142+
- `browserbaseResumeSessionID`: ID of an existing Browserbase session to resume.
143+
- `logger`: a function that handles log messages. Useful for custom logging implementations.
135144
- `verbose`: an `integer` that enables several levels of logging during automation:
136145
- `0`: limited to no logging
137146
- `1`: SDK-level logging
138147
- `2`: LLM-client level logging (most granular)
139148
- `debugDom`: a `boolean` that draws bounding boxes around elements presented to the LLM during automation.
140-
- `domSettleTimeoutMs`: an `integer` that specifies the timeout in milliseconds for waiting for the DOM to settle. It can be overriden in individual function calls if needed. Defaults to 30000 (30 seconds).
141-
- `enableCaching`: a `boolean` that enables caching of LLM responses. When set to `true`, the LLM requests will be cached on disk and reused for identical requests. Defaults to `false`.
142149

143150
- **Returns:**
144151

145152
- An instance of the `Stagehand` class configured with the specified options.
146153

147154
- **Example:**
155+
148156
```javascript
157+
// Basic usage
149158
const stagehand = new Stagehand();
159+
160+
// Custom configuration
161+
const stagehand = new Stagehand({
162+
env: "LOCAL",
163+
verbose: 1,
164+
headless: true,
165+
enableCaching: true,
166+
logger: (logLine) => {
167+
console.log(`[${logLine.category}] ${logLine.message}`);
168+
},
169+
});
170+
171+
// Resume existing Browserbase session
172+
const stagehand = new Stagehand({
173+
env: "BROWSERBASE",
174+
browserbaseResumeSessionID: "existing-session-id",
175+
});
150176
```
151177

152178
### Methods
@@ -157,7 +183,9 @@ This constructor is used to create an instance of Stagehand.
157183

158184
- **Arguments:**
159185

160-
- `modelName`: (optional) an `AvailableModel` string to specify the model to use. This will be used for all other methods unless overridden. Defaults to `"gpt-4o"`.
186+
- `modelName`: (optional) an `AvailableModel` string to specify the model to use. This will be used for all other methods unless overridden.
187+
- `modelClientOptions`: (optional) configuration options for the model client
188+
- `domSettleTimeoutMs`: (optional) timeout in milliseconds for waiting for the DOM to settle
161189

162190
- **Returns:**
163191

@@ -176,10 +204,12 @@ This constructor is used to create an instance of Stagehand.
176204

177205
- **Arguments:**
178206

179-
- `action`: a `string` describing the action to perform, e.g., `"search for 'x'"`.
180-
- `modelName`: (optional) an `AvailableModel` string to specify the model to use.
181-
- `useVision`: (optional) a `boolean` or `"fallback"` to determine if vision-based processing should be used. Defaults to `"fallback"`.
182-
- `domSettleTimeoutMs`: (optional) an `integer` that specifies the timeout in milliseconds for waiting for the DOM to settle. If not set, defaults to the timeout value specified during initialization.
207+
- `action`: a `string` describing the action to perform
208+
- `modelName`: (optional) an `AvailableModel` string to specify the model to use
209+
- `modelClientOptions`: (optional) configuration options for the model client
210+
- `useVision`: (optional) a `boolean` or `"fallback"` to determine if vision-based processing should be used. Defaults to `"fallback"`
211+
- `variables`: (optional) a `Record<string, string>` of variables to use in the action. Variables in the action string are referenced using `%variable_name%`
212+
- `domSettleTimeoutMs`: (optional) timeout in milliseconds for waiting for the DOM to settle
183213

184214
- **Returns:**
185215

@@ -189,8 +219,27 @@ This constructor is used to create an instance of Stagehand.
189219
- `action`: a `string` describing the action performed.
190220

191221
- **Example:**
222+
192223
```javascript
224+
// Basic usage
193225
await stagehand.act({ action: "click on add to cart" });
226+
227+
// Using variables
228+
await stagehand.act({
229+
action: "enter %username% into the username field",
230+
variables: {
231+
username: "[email protected]",
232+
},
233+
});
234+
235+
// Multiple variables
236+
await stagehand.act({
237+
action: "fill in the form with %username% and %password%",
238+
variables: {
239+
username: "john.doe",
240+
password: "secretpass123",
241+
},
242+
});
194243
```
195244

196245
#### `extract()`
@@ -199,10 +248,11 @@ This constructor is used to create an instance of Stagehand.
199248

200249
- **Arguments:**
201250

202-
- `instruction`: a `string` providing instructions for extraction.
203-
- `schema`: a `z.AnyZodObject` defining the structure of the data to extract.
204-
- `modelName`: (optional) an `AvailableModel` string to specify the model to use.
205-
- `domSettleTimeoutMs`: (optional) an `integer` that specifies the timeout in milliseconds for waiting for the DOM to settle. If not set, defaults to the timeout value specified during initialization.
251+
- `instruction`: a `string` providing instructions for extraction
252+
- `schema`: a `z.AnyZodObject` defining the structure of the data to extract
253+
- `modelName`: (optional) an `AvailableModel` string to specify the model to use
254+
- `modelClientOptions`: (optional) configuration options for the model client
255+
- `domSettleTimeoutMs`: (optional) timeout in milliseconds for waiting for the DOM to settle
206256

207257
- **Returns:**
208258

@@ -229,13 +279,17 @@ If you are looking for a specific element, you can also pass in an instruction t
229279

230280
- **Arguments:**
231281

232-
- `instruction`: a `string` providing instructions for the observation.
233-
- `useVision`: (optional) a `boolean` or `"fallback"` to determine if vision-based processing should be used. Defaults to `"fallback"`.
234-
- `domSettleTimeoutMs`: (optional) an `integer` that specifies the timeout in milliseconds for waiting for the DOM to settle. If not set, defaults to the timeout value specified during initialization.
282+
- `instruction`: (optional) a `string` providing instructions for the observation. Defaults to "Find actions that can be performed on this page."
283+
- `modelName`: (optional) an `AvailableModel` string to specify the model to use
284+
- `modelClientOptions`: (optional) configuration options for the model client
285+
- `useVision`: (optional) a `boolean` to determine if vision-based processing should be used. Defaults to `false`
286+
- `domSettleTimeoutMs`: (optional) timeout in milliseconds for waiting for the DOM to settle
235287

236288
- **Returns:**
237289

238-
- A `Promise` that resolves to an array of `string`s representing the actions that can be taken on the current page.
290+
- A `Promise` that resolves to an array of objects containing:
291+
- `selector`: a `string` representing the element selector
292+
- `description`: a `string` describing the possible action
239293

240294
- **Example:**
241295
```javascript

0 commit comments

Comments
 (0)