Skip to content

Commit c48f36e

Browse files
feat(api): tweak branding and fix some config fields
1 parent 655f517 commit c48f36e

13 files changed

Lines changed: 101 additions & 82 deletions

File tree

.github/workflows/publish-gem.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
bash ./bin/publish-gem
2828
env:
2929
# `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org
30-
RUBYGEMS_HOST: ${{ secrets.STAGEHAND_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
31-
GEM_HOST_API_KEY: ${{ secrets.STAGEHAND_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
30+
RUBYGEMS_HOST: ${{ secrets.BROWSERBASE_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
31+
GEM_HOST_API_KEY: ${{ secrets.BROWSERBASE_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}

.github/workflows/release-doctor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21-
RUBYGEMS_HOST: ${{ secrets.STAGEHAND_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
22-
GEM_HOST_API_KEY: ${{ secrets.STAGEHAND_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
21+
RUBYGEMS_HOST: ${{ secrets.BROWSERBASE_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
22+
GEM_HOST_API_KEY: ${{ secrets.BROWSERBASE_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-0c12f985340be2a9287e8e01ff8733f7f2d02e019149d1ae95f1a8f8798c6690.yml
33
openapi_spec_hash: efb79934e1dc63763dd4e8493b825273
4-
config_hash: cb2b1795c195a63201c8ef7a617934d1
4+
config_hash: 1548ab91b7e8621f7fa79e8cff0c3f93

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Stagehand
189+
Copyright 2025 Browserbase
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Stagehand Ruby API library
1+
# Browserbase Ruby API library
22

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.
3+
The Browserbase Ruby library provides convenient access to the Browserbase 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.
44

55
It is generated with [Stainless](https://www.stainless.com/).
66

@@ -28,12 +28,12 @@ gem "stagehand", "~> 0.0.1"
2828
require "bundler/setup"
2929
require "stagehand"
3030

31-
stagehand = Stagehand::Client.new(
31+
browserbase = Stagehand::Client.new(
3232
api_key: ENV["STAGEHAND_API_KEY"], # This is the default and can be omitted
33-
environment: "environment_1" # defaults to "production"
33+
environment: "dev" # or "production" | "local"; defaults to "production"
3434
)
3535

36-
response = stagehand.sessions.start(env: "LOCAL")
36+
response = browserbase.sessions.start(env: "LOCAL")
3737

3838
puts(response.available)
3939
```
@@ -44,7 +44,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
4444

4545
```ruby
4646
begin
47-
session = stagehand.sessions.start(env: "LOCAL")
47+
session = browserbase.sessions.start(env: "LOCAL")
4848
rescue Stagehand::Errors::APIConnectionError => e
4949
puts("The server could not be reached")
5050
puts(e.cause) # an underlying Exception, likely raised within `net/http`
@@ -82,12 +82,12 @@ You can use the `max_retries` option to configure or disable this:
8282

8383
```ruby
8484
# Configure the default for all requests:
85-
stagehand = Stagehand::Client.new(
85+
browserbase = Stagehand::Client.new(
8686
max_retries: 0 # default is 2
8787
)
8888

8989
# Or, configure per-request:
90-
stagehand.sessions.start(env: "LOCAL", request_options: {max_retries: 5})
90+
browserbase.sessions.start(env: "LOCAL", request_options: {max_retries: 5})
9191
```
9292

9393
### Timeouts
@@ -96,12 +96,12 @@ By default, requests will time out after 60 seconds. You can use the timeout opt
9696

9797
```ruby
9898
# Configure the default for all requests:
99-
stagehand = Stagehand::Client.new(
99+
browserbase = Stagehand::Client.new(
100100
timeout: nil # default is 60
101101
)
102102

103103
# Or, configure per-request:
104-
stagehand.sessions.start(env: "LOCAL", request_options: {timeout: 5})
104+
browserbase.sessions.start(env: "LOCAL", request_options: {timeout: 5})
105105
```
106106

107107
On timeout, `Stagehand::Errors::APITimeoutError` is raised.
@@ -132,7 +132,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
132132

133133
```ruby
134134
response =
135-
stagehand.sessions.start(
135+
browserbase.sessions.start(
136136
env: "LOCAL",
137137
request_options: {
138138
extra_query: {my_query_parameter: value},
@@ -179,18 +179,18 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
179179
You can provide typesafe request parameters like so:
180180

181181
```ruby
182-
stagehand.sessions.start(env: "LOCAL")
182+
browserbase.sessions.start(env: "LOCAL")
183183
```
184184

185185
Or, equivalently:
186186

187187
```ruby
188188
# Hashes work, but are not typesafe:
189-
stagehand.sessions.start(env: "LOCAL")
189+
browserbase.sessions.start(env: "LOCAL")
190190

191191
# You can also splat a full Params class:
192192
params = Stagehand::SessionStartParams.new(env: "LOCAL")
193-
stagehand.sessions.start(**params)
193+
browserbase.sessions.start(**params)
194194
```
195195

196196
### Enums
@@ -209,13 +209,13 @@ Enum parameters have a "relaxed" type, so you can either pass in enum constants
209209

210210
```ruby
211211
# Using the enum constants preserves the tagged type information:
212-
stagehand.sessions.act(
212+
browserbase.sessions.act(
213213
x_stream_response: Stagehand::SessionActParams::XStreamResponse::TRUE,
214214
#
215215
)
216216

217217
# Literal values are also permissible:
218-
stagehand.sessions.act(
218+
browserbase.sessions.act(
219219
x_stream_response: :true,
220220
#
221221
)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Stagehand, please follow the respective company's security reporting guidelines.
19+
or products provided by Browserbase, please follow the respective company's security reporting guidelines.
2020

2121
---
2222

lib/stagehand/client.rb

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ class Client < Stagehand::Internal::Transport::BaseClient
1818
# rubocop:disable Style/MutableConstant
1919
# @type [Hash{Symbol=>String}]
2020
ENVIRONMENTS =
21-
{production: "http://localhost:3000/v1", environment_1: "https://api.stagehand.browserbase.com/v1"}
21+
{
22+
production: "https://api.stagehand.browserbase.com/v1",
23+
dev: "https://api.stagehand.dev.browserbase.com/v1",
24+
local: "http://localhost:5000/v1"
25+
}
2226
# rubocop:enable Style/MutableConstant
2327

24-
# @return [String, nil]
28+
# @return [String]
2529
attr_reader :api_key
2630

2731
# @return [Stagehand::Resources::Sessions]
@@ -40,15 +44,16 @@ class Client < Stagehand::Internal::Transport::BaseClient
4044
#
4145
# @param api_key [String, nil] Defaults to `ENV["STAGEHAND_API_KEY"]`
4246
#
43-
# @param environment [:production, :environment_1, nil] Specifies the environment to use for the API.
47+
# @param environment [:production, :dev, :local, nil] Specifies the environment to use for the API.
4448
#
4549
# Each environment maps to a different base URL:
4650
#
47-
# - `production` corresponds to `http://localhost:3000/v1`
48-
# - `environment_1` corresponds to `https://api.stagehand.browserbase.com/v1`
51+
# - `production` corresponds to `https://api.stagehand.browserbase.com/v1`
52+
# - `dev` corresponds to `https://api.stagehand.dev.browserbase.com/v1`
53+
# - `local` corresponds to `http://localhost:5000/v1`
4954
#
5055
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
51-
# `"https://api.example.com/v2/"`. Defaults to `ENV["STAGEHAND_BASE_URL"]`
56+
# `"https://api.example.com/v2/"`. Defaults to `ENV["BROWSERBASE_BASE_URL"]`
5257
#
5358
# @param max_retries [Integer] Max number of retries to attempt after a failed retryable request.
5459
#
@@ -60,7 +65,7 @@ class Client < Stagehand::Internal::Transport::BaseClient
6065
def initialize(
6166
api_key: ENV["STAGEHAND_API_KEY"],
6267
environment: nil,
63-
base_url: ENV["STAGEHAND_BASE_URL"],
68+
base_url: ENV["BROWSERBASE_BASE_URL"],
6469
max_retries: self.class::DEFAULT_MAX_RETRIES,
6570
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
6671
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
@@ -71,7 +76,11 @@ def initialize(
7176
raise ArgumentError.new(message)
7277
end
7378

74-
@api_key = api_key&.to_s
79+
if api_key.nil?
80+
raise ArgumentError.new("api_key is required, and can be set via environ: \"STAGEHAND_API_KEY\"")
81+
end
82+
83+
@api_key = api_key.to_s
7584

7685
super(
7786
base_url: base_url,

rbi/stagehand/client.rbi

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ module Stagehand
1313
ENVIRONMENTS =
1414
T.let(
1515
{
16-
production: "http://localhost:3000/v1",
17-
environment_1: "https://api.stagehand.browserbase.com/v1"
16+
production: "https://api.stagehand.browserbase.com/v1",
17+
dev: "https://api.stagehand.dev.browserbase.com/v1",
18+
local: "http://localhost:5000/v1"
1819
},
1920
T::Hash[Symbol, String]
2021
)
2122

22-
sig { returns(T.nilable(String)) }
23+
sig { returns(String) }
2324
attr_reader :api_key
2425

2526
sig { returns(Stagehand::Resources::Sessions) }
@@ -49,12 +50,13 @@ module Stagehand
4950
#
5051
# Each environment maps to a different base URL:
5152
#
52-
# - `production` corresponds to `http://localhost:3000/v1`
53-
# - `environment_1` corresponds to `https://api.stagehand.browserbase.com/v1`
53+
# - `production` corresponds to `https://api.stagehand.browserbase.com/v1`
54+
# - `dev` corresponds to `https://api.stagehand.dev.browserbase.com/v1`
55+
# - `local` corresponds to `http://localhost:5000/v1`
5456
environment: nil,
5557
# Override the default base URL for the API, e.g.,
56-
# `"https://api.example.com/v2/"`. Defaults to `ENV["STAGEHAND_BASE_URL"]`
57-
base_url: ENV["STAGEHAND_BASE_URL"],
58+
# `"https://api.example.com/v2/"`. Defaults to `ENV["BROWSERBASE_BASE_URL"]`
59+
base_url: ENV["BROWSERBASE_BASE_URL"],
5860
# Max number of retries to attempt after a failed retryable request.
5961
max_retries: Stagehand::Client::DEFAULT_MAX_RETRIES,
6062
timeout: Stagehand::Client::DEFAULT_TIMEOUT_IN_SECONDS,

sig/stagehand/client.rbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ module Stagehand
99
DEFAULT_MAX_RETRY_DELAY: Float
1010

1111
ENVIRONMENTS: {
12-
production: "http://localhost:3000/v1",
13-
:environment_1 => "https://api.stagehand.browserbase.com/v1"
12+
production: "https://api.stagehand.browserbase.com/v1",
13+
dev: "https://api.stagehand.dev.browserbase.com/v1",
14+
local: "http://localhost:5000/v1"
1415
}
1516

16-
attr_reader api_key: String?
17+
attr_reader api_key: String
1718

1819
attr_reader sessions: Stagehand::Resources::Sessions
1920

2021
private def auth_headers: -> ::Hash[String, String]
2122

2223
def initialize: (
2324
?api_key: String?,
24-
?environment: :production | :environment_1 | nil,
25+
?environment: :production | :dev | :local | nil,
2526
?base_url: String?,
2627
?max_retries: Integer,
2728
?timeout: Float,

stagehand.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ require_relative "lib/stagehand/version"
55
Gem::Specification.new do |s|
66
s.name = "stagehand"
77
s.version = Stagehand::VERSION
8-
s.summary = "Ruby library to access the Stagehand API"
9-
s.authors = ["Stagehand"]
8+
s.summary = "Ruby library to access the Browserbase API"
9+
s.authors = ["Browserbase"]
1010
s.email = ""
1111
s.homepage = "https://gemdocs.org/gems/stagehand"
1212
s.metadata["homepage_uri"] = s.homepage

0 commit comments

Comments
 (0)