Read-only by default
Inspect and Extract do not dispatch browser actions, and page content remains untrusted evidence.
Inspect and extract
An unofficial RubyLLM extension for offline bounded browser inspection and schema-checked extraction.
The first release is 0.1.0 and supports only the offline FakeBackend. The built-in
Stagehand adapter is unsupported until provider egress and confirmed cleanup are
qualified. The full live Act protocol is deferred to a later version.
bundle add ruby_llm-browser --git https://github.com/yorzi/ruby_llm-browser --branch main
This offline example makes no network request and needs no API key.
require "ruby_llm/browser"
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 = RubyLLM::Browser::Inspect.new(context: context)
extract_tool = RubyLLM::Browser::Extract.new(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"}
The fake backend proves only that the Ruby API can run offline. It says nothing about a real browser provider’s egress, session cleanup, or billing. Read the security model before evaluating a live backend.
Get started or read how the gem works.