You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***api:** tweak branding and fix some config fields ([c48f36e](https://github.com/browserbase/stagehand-ruby/commit/c48f36e307aafd9a2d6ac59d9857be789f29eaa1))
16
+
17
+
18
+
### Chores
19
+
20
+
* configure new SDK language ([3be44a3](https://github.com/browserbase/stagehand-ruby/commit/3be44a344d5bc49e7c2e16129c2b24db175f4eb6))
Copy file name to clipboardExpand all lines: README.md
+33-16Lines changed: 33 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,37 +1,42 @@
1
1
# Stagehand Ruby API library
2
2
3
-
The Stagehand Ruby library provides convenient access to the Stagehand REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/stainless-sdks/stagehand-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
3
+
The Stagehand Ruby library provides convenient access to the Stagehand REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/browserbase/stagehand-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
4
5
5
It is generated with [Stainless](https://www.stainless.com/).
6
6
7
7
## Documentation
8
8
9
9
Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/stagehand).
10
10
11
-
The REST API documentation can be found on [browserbase.com](https://browserbase.com).
11
+
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev).
12
12
13
13
## Installation
14
14
15
15
To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
16
16
17
+
<!-- x-release-please-start-version -->
18
+
17
19
```ruby
18
-
gem "stagehand", "~> 0.0.1"
20
+
gem "stagehand", "~> 0.1.0"
19
21
```
20
22
23
+
<!-- x-release-please-end -->
24
+
21
25
## Usage
22
26
23
27
```ruby
24
28
require"bundler/setup"
25
29
require"stagehand"
26
30
27
31
stagehand =Stagehand::Client.new(
28
-
api_key:ENV["STAGEHAND_API_KEY"], # This is the default and can be omitted
29
-
environment:"environment_1"# defaults to "production"
32
+
browserbase_api_key:ENV["BROWSERBASE_API_KEY"], # This is the default and can be omitted
33
+
browserbase_project_id:ENV["BROWSERBASE_PROJECT_ID"], # This is the default and can be omitted
34
+
model_api_key:ENV["MODEL_API_KEY"] # This is the default and can be omitted
30
35
)
31
36
32
-
response = stagehand.sessions.start(env:"LOCAL")
37
+
response = stagehand.sessions.act("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", input:"click the first link on the page")
33
38
34
-
puts(response.available)
39
+
puts(response.actions)
35
40
```
36
41
37
42
### Handling errors
@@ -40,7 +45,10 @@ When the library is unable to connect to the API, or if the API returns a non-su
40
45
41
46
```ruby
42
47
begin
43
-
session = stagehand.sessions.start(env:"LOCAL")
48
+
session = stagehand.sessions.start(
49
+
browserbase_api_key:"BROWSERBASE_API_KEY",
50
+
browserbase_project_id:"BROWSERBASE_PROJECT_ID"
51
+
)
44
52
rescueStagehand::Errors::APIConnectionError => e
45
53
puts("The server could not be reached")
46
54
puts(e.cause) # an underlying Exception, likely raised within `net/http`
0 commit comments