The project is in a healthy, maintained state
An unofficial community extension for RubyLLM. It adds policy-bound, read-only browser Inspect and Extract tools with an offline FakeBackend. The Stagehand Ruby SDK adapter is present but unsupported for live operations until provider egress and cleanup are qualified. The first release also includes explicit URL/SSRF policy, bounded and sanitized results with provenance, durable operation and session lifecycle bookkeeping, budgets, offline Act simulation, and an optional Rails 8 / Active Job adapter. The full live Act protocol is deferred to a later version. The Gem core works in plain Ruby without Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.4.2, < 1
>= 0.7.2, < 1
>= 2.0, < 3
~> 3.21.0
>= 1.0.4, < 2
>= 3.2.3, < 4
 Project Readme

ruby_llm-browser

An unofficial RubyLLM extension for read-only browser inspection and schema-checked extraction, with an optional Rails 8 adapter.

0.2.0 supports offline use only. FakeBackend runs without credentials or network requests. The experimental Stagehand adapter refuses live operations; Act is an offline simulation. This project is not maintained or endorsed by RubyLLM or Browserbase.

Documentation · Getting started · Roadmap to 1.0

Install

Use Ruby 3.2+ and RubyLLM 2.x. Add to your Gemfile, then run bundle install:

gem "ruby_llm-browser", "~> 0.2.0"

Try it offline

# smoke-test: offline
require "ruby_llm/browser"

# Test resolver for this offline example only.
class OfflineResolver
  def getaddresses(_host) = [ "93.184.216.34" ]
end

context = RubyLLM::Browser::Context.new(
  actor_id: "demo-actor", run_id: "demo-run",
  backend: RubyLLM::Browser::FakeBackend.new,
  source_policy: RubyLLM::Browser::Policy.new(
    allowed_hosts: [ "docs.example.com" ], resolver: OfflineResolver.new
  ),
  operation_store: RubyLLM::Browser::InMemoryOperationStore.new
)
schema = {
  "type" => "object", "properties" => { "title" => { "type" => "string" } },
  "required" => [ "title" ], "additionalProperties" => false
}
inspect_tool, extract_tool = RubyLLM::Browser.tools(context: context, schema: schema)
puts inspect_tool.execute(url: "https://docs.example.com/")[:status] # => ok
puts extract_tool.execute(url: "https://docs.example.com/")[:data]   # => {"title"=>"Example"}

Register these tools on your configured chat with chat.with_tools(inspect_tool, extract_tool). The host owns identity, authorization, source policy, schema, and budgets. Tool calls return hashes; page data remains untrusted.

Learn more

Use the documentation site for configuration, Rails jobs, API details, and security boundaries. The same guides ship as Markdown in the gem; docs/README.md indexes their source files.

Contributing

Run bin/setup, then bundle exec rake. Tests block unmocked network requests. See CONTRIBUTING.md for development and the roadmap for the next iterations.

License

MIT. See third-party notices.