
Browserbash
io.github.PramodDuttaPublished by GitHub account PramodDuttav1.5.1Updated Oct 24, 2026
Plain-English browser tests for AI agents: real Chrome, deterministic verdicts. Free, no API keys.
Overview
Lets an assistant run plain-English browser tests in real Chrome and return structured pass/fail verdicts.
- What you can do
- BrowserBash exposes three MCP tools: run_objective (one plain-English objective), run_test_file (a *_test.md file) and run_suite (a folder, run in parallel). Each returns structured verdict JSON with status, summary, final_state, assertions, cost_usd and duration_ms. An AI agent drives a real Chrome browser step by step with no selectors or scripts, and a failed test is reported as a successful validation so the agent can read the verdict.
- When to use it
- Use it when a coding agent builds a feature and you want proof it works in a real browser, or when you want committable plain-English browser tests and CI checks. It also suits teams that want local, free test runs without sending data to a cloud service.
- Requirements
- Runs as a local stdio process installed from the npm package browserbash-cli; needs Node 18 or newer and Google Chrome stable for the local provider. By default it resolves a free local Ollama model; otherwise it can use ANTHROPIC_API_KEY, OPENAI_API_KEY or OPENROUTER_API_KEY. Cloud providers need their own credentials, such as BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID, LT_USERNAME and LT_ACCESS_KEY, or BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY.
Installation
In SourceWeft
- Open Browserbash in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
BrowserBash
Plain-English browser automation. No selectors. Free and open-source.
[npm version] [npm downloads] [license] [Node]
You write a plain-English objective. An AI agent drives a real Chrome browser step by step — no selectors, no scripts. Ollama-first, so it runs on free local models with no API keys and nothing ever leaves your machine.
Website · Docs / Learn · Tutorials · npm
Both layers are swappable: the engine interprets the English, the provider runs the browser.
Engines (who interprets the English)
Providers (where the browser runs)
LLM backends (who does the thinking) — open source first
Default model is auto, resolved in this order:
- Ollama running locally →
ollama/<OLLAMA_MODEL or first installed model>— free, open source, no keys ANTHROPIC_API_KEYset →claude-opus-4-8OPENAI_API_KEYset →openai/gpt-4.1- otherwise: error with setup guidance
Fully free / open-source stack (the default)
Stagehand engine (MIT) + local Chromium + Ollama (MIT) — zero cloud cost, no API keys. Tip: small models (≤8B) are flaky on multi-step objectives; Qwen3 / Llama 3.3 70B class works best.
Note: cloud-grid providers (lambdatest, browserstack) use the builtin engine, which speaks the Anthropic API — pair them with ANTHROPIC_API_KEY or an ANTHROPIC_BASE_URL gateway.
Install
Requires Node ≥ 18 and Google Chrome stable (for the local provider).
Quick start
Agent mode (for AI coding tools & CI)
--agent switches stdout to NDJSON — one JSON object per line, stable schema:
- Progress events:
{"type":"step","step":1,"status":"passed","action":"navigate","remark":"...","cached":false} - Terminal event:
{"type":"run_end","status":"passed|failed|error|timeout","summary":"...","final_state":{...},"duration_ms":...,"provider":"local","cache":"hit|miss|off","tokens_in":...,"tokens_out":...,"test_url":"..."}
Exit codes: 0 passed · 1 failed · 2 error · 3 timeout. cached, cache, tokens_in/tokens_out are additive fields (present when relevant), so existing consumers are unaffected.
Full agent integration guide: docs/agents.md.
MCP server (agents consume BrowserBash natively)
BrowserBash is a validation layer for AI agents: your coding agent builds a feature, BrowserBash proves it works in a real browser. One line plugs it into any MCP host:
Tools exposed: run_objective (one plain-English objective), run_test_file (a *_test.md), run_suite (a folder, parallel). Each returns the structured verdict JSON: status, summary, final_state, assertions, cost_usd, duration_ms. A failed test is a successful validation, so the tool call succeeds and the agent reads the verdict. No extra dependencies, stdio only, nothing leaves your machine.
Dashboards
Every run is kept in a private on-disk store (~/.browserbash/runs, secrets masked, capped at 200). Two ways to see them:
Local dashboard — free, no account, fully local:
Left panel lists your runs; the main pane shows the verdict, extracted values and the recording — with --record you get a screenshot plus a session video (stagehand engine, video needs ffmpeg, bundled) or a native Playwright trace you can open at trace.playwright.dev (builtin engine). Nothing leaves your machine.
Cloud dashboard — optional, opt-in per run: a hosted dashboard at browserbash.com/dashboard with run history across machines and shareable per-run pages.
Without --upload nothing is sent to the cloud. BrowserBash is free and open source; cloud runs are kept 15 days.
Replay cache (warm runs skip the model)
A green run records the actions it took. The next identical run replays them with zero model calls, and the agent only steps back in when the page actually changed. Steady-state suites run at close to script speed and cost.
run_end.cache reports hit / miss / off. On by default; config set cache.enabled false to disable, cache.dir to relocate (default .browserbash/cache, gitignored by init). Secrets never enter the cache: values arrive through the variables channel (Stagehand) or are re-templatized to {{name}} tokens (builtin), and any cached action that types a secret is origin-pinned — replaying it on a different origin fails closed. Builtin journals are also HMAC-signed with a per-machine key (~/.browserbash/cache.key); an edited or foreign journal is ignored and simply re-recorded. CI fleets that want to share committed caches can set the same BROWSERBASH_CACHE_KEY (64 hex chars) on every runner.
Parallel suites (run-all)
Run a whole folder of *_test.md files at once with memory-aware scheduling:
- Concurrency is auto-derived from CPU and free memory (
min(requested, cpus, floor((mem - 2GB) / budget))), so big suites do not thrash the machine. Override with--concurrency, tune the estimate with--memory-budget <mb>. A hard watchdog also kills any test whose whole process tree (Node + Chromium) exceeds--memory-cap <mb>(default 2x the budget,0disables); the test is reported as an infra error with atest_killevent, and retried per--retries. - Each test runs as an isolated child process with its own
Result.md; a failure never leaks state to the next test. --retries <n>retries infra errors only (not real failures),--max-failures <n>stops early,--stagger <ms>softens burst load.- Outputs: a merged NDJSON stream (
--events, add--agentto also stream on stdout), JUnit XML (--junit), and aRunAll-Result.mdwith a flaky column. - Run history in
.browserbash/memory/history.jsonorders the next run (previously-failed first, then slowest first) and flags flaky tests.--no-memoryopts out. - Sharding:
--shard 2/4runs a deterministic slice, computed on sorted discovery order so parallel CI machines agree without coordination. - Viewport matrix:
--matrix-viewport 1280x720,390x844runs every test once per viewport; cells are labeled in events, JUnit and results. Single runs take--viewport WxHtoo. - Budgets:
--budget-usd 2.50(or--budget-tokens) stops launching new tests once estimated spend crosses the budget; the rest are reportedskippedand the suite exits2. Spend lands inRunAll-Result.mdand JUnit<properties>. - Webhooks:
--notify <url>POSTs the suite verdict when it ends (Slack URLs get Slack formatting). - Exit code:
0all passed ·1any failed ·2infra error or budget stop ·3suite timeout.
Cheap-model routing
Plan on a strong model, execute on a cheap one, escalate back automatically after a failed step:
run_end reports tokens_in / tokens_out (builtin engine) so you can see what a run costs, plus a cost_usd estimate from a bundled per-model price table (override at ~/.browserbash/pricing.json; unknown models get no estimate rather than a wrong one). Set persistently with config set routing.executionModel <id>.
Test files (*_test.md)
Committable, reviewable Markdown tests:
Composition via @import ./helpers/login.md (steps are spliced in place). After every run a Result.md is written next to the test file.
testmd v2: assertions and API steps that never lie
Add version: 2 frontmatter and steps execute ONE AT A TIME against a single browser session, with two deterministic step types that never touch a model:
- API steps (
GET/POST/PUT/DELETE/PATCH url [with body {...}]+Expect status N[, store $.path as 'name']) run as plain HTTP: seed data, then verify through the UI. Stored values feed{{variables}}in later steps. Verifysteps compile to real Playwright checks (URL contains, title is/contains, text visible,'name' button|link|headingvisible, element counts, stored equals). A pass means the condition held; a fail comes with expected vs actual evidence inrun_end.assertionsand theResult.mdassertion table. Verify lines outside the grammar still run, agent-judged and flaggedjudged: true.- Consecutive plain-English steps run as grouped agent blocks on the same page, so login state and navigation carry through.
- v1 files (no frontmatter) behave exactly as before. v2 currently drives the builtin engine (needs
ANTHROPIC_API_KEYor anANTHROPIC_BASE_URLgateway).
Variables
{{key}} placeholders are substituted in objectives and test steps. Load order (highest priority last):
- Global:
~/.browserbash/variables/*.json - Project:
./.browserbash/variables/*.json --variables-file <path>--variables '<json>'
Mark sensitive values {"value": "...", "secret": true} — they are masked as ***** in all logs and NDJSON output.
Saved logins (browserbash auth)
Real suites live behind a login. Log in once, reuse the session everywhere:
Sessions are Playwright storageState files in ~/.browserbash/auth/ (mode 0600, they hold live credentials). Test files can pin their own profile with auth: staging frontmatter. A profile whose saved origins do not cover the target URL prints a warning instead of silently doing nothing.
Author tests without writing them
record captures clicks, typing and navigation (password values never leave the page; the generated step reads Type {{password}} into ...). import translates common Playwright calls deterministically and writes everything it could NOT translate to IMPORT-REPORT.md instead of guessing. Both outputs are starting points to review, not gospel.
Monitoring (browserbash monitor)
The same tests double as production checks:
Alerts fire on pass<->fail STATE CHANGES only, both directions, never on every green run. Slack webhook URLs get Slack formatting; any other URL receives the raw JSON payload. With the replay cache warm, a monitor makes zero model calls until the page actually changes.
Configuration
Precedence: flags > env vars > ~/.browserbash/config.json defaults.
CI recipe (GitHub Actions)
The process exit code is the test verdict — no output parsing needed.
Or use the official GitHub Action (PR verdict comment, artifacts, sharded matrix jobs, budget stop):
Full guide: docs/github-action.md.
Architecture
Adding a vendor = one file implementing BrowserProvider (connect() returning a Playwright Browser/Page) + one registry line in providers/index.ts.
License
Apache-2.0
Source: README.md at commit b95a07a
Tools
0Version history
1- v1.5.1LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.