Agentry
25 µs per request instead of 126 µs with browser, 2.0 µs once a user agent was seen (YJIT). Of the 882 crawler user agents added to crawler-user-agents since 2024 (test drivers and scanners left out), browser misses 353 and Agentry 11.
gem "agentry"
In numbers
Ruby 4.0.9, Apple M4 Max, measured on 2026-11-04: browser 6.2.0 at dd88933, Agentry 1.0.0 at e8bdc86. Each figure is the median of 7 runs. YJIT on.
The benchmark, and how to reproduce it · Coverage per category
What changes
Nothing in your code
Every predicate, every require path and the Browser namespace of browser keep working unchanged. The upstream test suite runs unmodified.
Detected once per user agent
Each process caches what it detected for the last 1,000 user agents, so a returning visitor costs a hash lookup. Browser.cache_size sizes it.
A bot list that stays fresh
Synced every week from crawler-user-agents and ai.robots.txt, both MIT, through a pull request that lists every answer it changes.
Bots by category
bot.category tells an AI crawler from a search engine or a scanner, bot.ai? and bot.user_triggered? an agent acting for a person. Test drivers never become bots.
The same answers, proven
Both gems run over 20,328 user agents on every pull request: an answer that differs from browser’s is either listed as intended or fails the CI.
Current Ruby and Rails
Ruby 3.3 or later, tested on Rails 8.0 and 8.1. Bundler’s auto-require loads the gem, and the railtie no longer needs a preloaded ActiveSupport.
Quick start
Gemfile
gem "agentry" # instead of gem "browser"
Ruby
require "browser"
browser = Browser.new(user_agent, accept_language: "en-us")
browser.chrome?
browser.bot?
browser.device.mobile?