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
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.
55
-
56
-
## Why Stagehand?
57
-
58
-
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.
59
-
60
-
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.
61
-
62
-
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.
63
-
64
-
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.
1
+
# Stagehand Ruby API library
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/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
+
5
+
It is generated with [Stainless](https://www.stainless.com/).
6
+
7
+
## MCP Server
8
+
9
+
Use the Stagehand MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
10
+
11
+
[](https://cursor.com/en-US/install-mcp?name=stagehand-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInN0YWdlaGFuZC1tY3AiXX0)
12
+
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22stagehand-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22stagehand-mcp%22%5D%7D)
13
+
14
+
> Note: You may need to set environment variables in your MCP client.
15
+
16
+
## Documentation
17
+
18
+
Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/stagehand).
19
+
20
+
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev).
65
21
66
22
## Installation
67
23
@@ -81,115 +37,15 @@ gem "stagehand", "~> 3.0.1"
81
37
require"bundler/setup"
82
38
require"stagehand"
83
39
84
-
# Create a new Stagehand client with your credentials
85
-
client =Stagehand::Client.new(
86
-
browserbase_api_key:ENV["BROWSERBASE_API_KEY"], # defaults to ENV["BROWSERBASE_API_KEY"]
87
-
browserbase_project_id:ENV["BROWSERBASE_PROJECT_ID"], # defaults to ENV["BROWSERBASE_PROJECT_ID"]
88
-
model_api_key:ENV["MODEL_API_KEY"] # defaults to ENV["MODEL_API_KEY"]
Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
0 commit comments