Open, provider-agnostic browser execution kernel for AI agents.
Any agent can wrap it. No vendor lock-in. No API key required.
This runtime sits between your agent and Chromium:
Your agent / LLM / script
│
│ intent or JSON plan
▼
Browser Execution Runtime
• semantic state + diffs
• recovery + site plugins
• experience memory
• optional LLM planner
│
│ CDP
▼
Chrome / Chromium
Your model plans rarely. The runtime executes often — so you stop paying computer-use / vision tokens on every click.
Most “AI browser” setups either:
- re-send screenshots to a model on every step (slow + expensive), or
- lock you into one vendor SDK / API key.
This project is a local execution wrapper:
| You bring | This runtime provides |
|---|---|
| Any agent (OpenAI tools, Hermes, custom scripts, Python…) | CDP browser control |
| Optional OpenAI-compatible LLM | Plan execution + recovery |
| Explicit JSON plans (no LLM at all) | Semantic state, diffs, memory |
- CDP browser control — launch, attach, persistent profile, multi-tab
- Deterministic plans —
navigate,click,type,wait,extract, … - Semantic page state — roles/text/signals instead of raw HTML dumps
- State diffs — cheap context for agents
- Self-healing recovery — cookie banners, overlays, retries; typed modals (
modal:login,modal:otp,modal:payment, …) - Experience memory — SQLite store of problem → fix (+ confidence)
- L3 similarity — local hashing embeddings by default; optional neural
/embeddings - Site plugins —
cookie-consent,auth-modal,github,google,amazon,media-sites,content-sites - Dynamic settle — waits for SPA/DOM quiet after navigate/click;
wait.settle - Infinite scroll —
scrollwithuntilText/untilCss/untilCountAtLeast - Media actions —
mediaplay/pause/mute/skip_ad for video/audio sites - Cross-origin frames —
frameUrl/frameName/frameIndexvia Playwright frame tree - Closed-shadow pierce — CDP pierce during observe (
BER_PIERCE_SHADOW=0to disable) - Rust core (experimental) —
crates/ber-corefingerprint/embed CLI - Event bus — step/recovery/run events via
GET /eventsor SSE stream - Iframe targets —
frame/frameUrlfor consent CMPs and nested UI - Open tool bridge — OpenAI-style
browser_*tools any agent can register - Optional LLM planner — any OpenAI-compatible endpoint; key optional
- Debug Chrome extension — attach-only bridge (no AI inside)
- Safety policy — domain allowlist, purchase blocking
- One-command start —
npm start(setup + daemon)
- Node.js 20+
- npm
- Chromium (via Playwright install)
One command (installs Chromium if needed, writes config once, starts the daemon):
npm install
npm startThat is all for first startup. The engine listens on http://127.0.0.1:8787.
60-second walkthrough: examples/QUICK_DEMO.md
In another terminal:
# run an explicit plan (no LLM needed)
npm run dev -- run-plan examples/sample-plan.json
# or call the daemon
curl -s http://127.0.0.1:8787/health
bash examples/integrations/curl-demo.shSetup only (no daemon):
npm run setup# daemon must already be running
PYTHONPATH=sdk/python python3 - <<'PY'
from browser_execution_runtime import BrowserRuntimeClient
client = BrowserRuntimeClient()
print(client.health())
client.attach(start_url="https://example.com")
print(client.run({
"goal": "open example",
"steps": [{"action": {"type": "navigate", "url": "https://example.com"}}],
}))
PYBest default. Your agent/script sends JSON plans.
npm run daemon
npm run dev -- run-plan examples/sample-plan.jsonBER_LLM_API_BASE=http://127.0.0.1:11434/v1 \
BER_LLM_MODEL=llama3.2 \
npm run daemonWorks with Ollama, vLLM, LM Studio, and other OpenAI-compatible servers.
BER_LLM_API_BASE=https://api.openai.com/v1 \
BER_LLM_API_KEY=sk-... \
BER_LLM_MODEL=gpt-4.1-mini \
npm run daemonKeys are only needed if your provider requires them. This runtime never requires a key by itself.
More provider examples: examples/ber.config.example.json
Full integration guide: INTEGRATING.md
npm run daemon
npm run tools -- examples/agent-tools.json- Repo rule:
.cursor/rules/ber-runtime.mdc - Copy/paste snippet:
examples/integrations/cursor-rules.md
- Prompt template:
examples/integrations/codex-prompt.md
node examples/integrations/openai-tools.mjsRegister the exported tools in your agent, then prefer them over computer-use:
| Tool | Purpose |
|---|---|
browser_attach |
Launch/attach browser |
browser_execute |
High-level intent → plan → run |
browser_run_plan |
Execute explicit JSON plan |
browser_observe |
Compact semantic state |
browser_diff |
What changed |
browser_resume |
Resume last failed run |
browser_status |
Runtime + memory status |
browser_tabs |
List tabs |
browser_events |
Recent step/recovery/run events |
JS example:
node examples/integrations/openai-tools.mjsCLI bridge:
npm run dev -- call browser_attach '{"startUrl":"https://example.com"}'
npm run dev -- call browser_observe '{}'npm start # ONE command: setup + start daemon (:8787)
npm run setup # setup only (no daemon)
npm run daemon # daemon only (after setup)
npm run doctor # show resolved config / planner mode
npm run init-config # write ber.config.json
npm run tools # print OpenAI-style tool schemas
npm run bench:replay # cookie-banner replay benchmark
npm run dev -- observe https://example.com
npm run dev -- execute "open https://example.com"
npm run dev -- run-plan examples/sample-plan.json
npm run dev -- run-plan examples/multi-tab-plan.json
npm run dev -- run-plan examples/media-search-plan.json
npm run dev -- run-plan examples/media-watch-plan.json
npm run dev -- run-plan examples/scroll-until-plan.json
npm run dev -- call <tool> '<json>'After npm run build, the ber binary is available via node dist/cli.js / package bin.
Base URL: http://127.0.0.1:8787
| Method | Path | Description |
|---|---|---|
GET |
/health |
Liveness |
GET |
/status |
Runtime + memory status |
GET |
/observe |
Semantic state |
GET |
/diff |
State diff |
GET |
/tabs |
Open tabs |
GET |
/plugins |
Loaded plugins |
GET |
/experiences |
Stored experiences |
GET |
/metrics |
Run metrics |
GET |
/events |
Recent runtime events (afterId, limit, type) |
GET |
/events/stream |
Server-Sent Events stream of runtime events |
GET |
/extension/info |
Debug extension metadata |
POST |
/attach |
Launch/attach browser |
POST |
/run |
Execute plan |
POST |
/execute |
Intent → plan → run |
POST |
/act |
Single action |
POST |
/resume |
Resume failed plan |
POST |
/policy |
Update safety policy |
POST |
/remember |
Store experience |
POST |
/tabs/new /tabs/switch /tabs/close |
Tab controls |
Attach example:
curl -X POST http://127.0.0.1:8787/attach \
-H 'content-type: application/json' \
-d '{"startUrl":"https://example.com","profile":"persistent"}'Run example:
curl -X POST http://127.0.0.1:8787/run \
-H 'content-type: application/json' \
-d @- <<'EOF'
{
"plan": {
"goal": "Open example.com and extract heading",
"steps": [
{ "action": { "type": "navigate", "url": "https://example.com" } },
{
"action": {
"type": "extract",
"target": { "role": "heading", "name": "Example Domain" },
"key": "heading"
}
}
]
}
}
EOF{
"goal": "Open example.com and extract the main heading",
"steps": [
{
"id": "go",
"action": { "type": "navigate", "url": "https://example.com" },
"expect": { "urlIncludes": "example.com" }
},
{
"action": { "type": "dismiss_overlays" },
"optional": true
},
{
"action": {
"type": "extract",
"target": { "role": "heading", "name": "Example Domain" },
"key": "heading"
}
}
]
}navigate · click · type · select · wait · scroll · extract · press · dismiss_overlays · observe · new_tab · switch_tab · close_tab
Targets prefer accessibility signals:
{ "role": "button", "name": "Accept all" }Optional project file:
npm run init-config # writes ber.config.json
npm run doctor # shows what will actually be used- Env vars always win over file values
apiKeymay be omitted,null, or"env:MY_VAR"ber.config.jsonis gitignored
See examples/ber.config.example.json.
| Variable | Required | Description |
|---|---|---|
BER_PORT |
no | Daemon port (default 8787) |
BER_HOST |
no | Daemon host (default 127.0.0.1) |
BER_URL |
no | Daemon URL for CLI call |
BER_DATA_DIR |
no | Data directory (default ./data) |
BER_HEADLESS=0 |
no | Show browser window |
BER_ALLOW_PURCHASE=1 |
no | Allow purchase-like goals/clicks |
BER_DOMAINS |
no | Comma-separated domain allowlist |
BER_CONFIG |
no | Path to config file |
BER_PROVIDER |
no | Select providers.<name> from config |
BER_LLM_API_BASE |
no | OpenAI-compatible planner base URL |
BER_LLM_API_KEY |
no | Only if provider needs auth |
BER_LLM_MODEL |
no | Model id (default llama3.2) |
BER_EMBEDDINGS_API_BASE |
no | Optional neural embeddings endpoint |
BER_EMBEDDINGS_MODEL |
no | Embeddings model id |
BER_EMBEDDINGS=hash |
no | Force local hashing embeddings |
BER_HERMES_* |
no | Legacy aliases |
| Layer | Storage | Contents |
|---|---|---|
| L1 | RAM | Current session state / recent actions |
| L2 | SQLite (data/experiences.db) |
Problem → fix experiences + confidence |
| L3 | Vectors in SQLite | Similarity search (hash by default) |
Important:
- Not a chat-log dump
- Not “save everything as JSON files”
- Fix steps are stored as a JSON column inside SQLite
- Neural embeddings are optional and provider-agnostic
import {
createRuntimeFromEnv,
BrowserRuntime,
LlmPlanner,
} from "browser-execution-runtime";
// A) env / ber.config.json
const runtime = createRuntimeFromEnv();
await runtime.attach({ startUrl: "https://example.com" });
const result = await runtime.run({
goal: "extract heading",
steps: [
{ action: { type: "navigate", url: "https://example.com" } },
{
action: {
type: "extract",
target: { role: "heading", name: "Example Domain" },
key: "heading",
},
},
],
});
console.log(result.ok, result.steps.at(-1)?.extracted);
await runtime.close();
// B) inject your own planner (any OpenAI-compatible server)
const custom = new BrowserRuntime({
planner: new LlmPlanner({
apiBase: "http://127.0.0.1:11434/v1",
// apiKey omitted on purpose for local providers
model: "llama3.2",
}),
});Attach-only helper. No model runs in the extension.
npm run daemon- Chrome →
chrome://extensions→ Developer mode → Load unpacked - Select the
extension/folder
Details: extension/README.md
For full control of an already-open Chrome:
google-chrome --remote-debugging-port=9222
curl -X POST http://127.0.0.1:8787/attach \
-H 'content-type: application/json' \
-d '{"cdpUrl":"http://127.0.0.1:9222"}'browser-execution-runtime/
├── src/
│ ├── runtime.ts # public facade
│ ├── api/ # local HTTP daemon
│ ├── agent/ # tool schemas + client bridge
│ ├── browser/ # CDP session + tabs
│ ├── planner/ # builtin + LLM planner
│ ├── executor/ # actions + plan runner
│ ├── state/ # observe / diff / fingerprint
│ ├── recovery/ # failure classification
│ ├── experience/ # SQLite memory
│ ├── memory/ # L1 cache + embeddings
│ ├── plugins/ # site skills
│ ├── fallback/ # optional computer-use cascade
│ └── telemetry/ # metrics
├── examples/ # plans, tools, integrations
├── extension/ # Chrome debug bridge
├── sdk/python/ # thin Python client
├── benchmarks/ # replay benchmark
├── INTEGRATING.md # bring-your-own-agent guide
├── ARCHITECTURE.md # decided vs shipped matrix
└── PUBLISHING.md # npm / PyPI notes
We welcome issues and pull requests. See CONTRIBUTING.md for setup, test commands, and high-impact areas (site plugins, recovery, examples, Python SDK, Rust core). Please follow the CODE_OF_CONDUCT.
- Starter tasks:
GOOD_FIRST_ISSUES.md· issues labeledgood first issue - Roadmap:
ROADMAP.md - Q&A: GitHub Discussions · moderator FAQ draft in
docs/DISCUSSIONS_FAQ.md - Why not screenshot-every-step:
docs/COMPARISON.md
Early-stage OSS — if you ship BER with your agent or product, open a Discussion or PR to add a one-line link here.
| Integration | Link |
|---|---|
| Cursor | examples/integrations/cursor-rules.md |
| OpenAI Codex | examples/integrations/codex-prompt.md |
| Local Ollama planner | examples/integrations/ollama-demo.sh |
Shareable contributor pitch: docs/CONTRIBUTOR_CALL.md
Maintainers: GitHub topics, Discussions, and labels — docs/GITHUB_MAINTAINER_SETUP.md
npm install
npx playwright install chromium
npm test # unit tests (no browser)
npm run test:browser # Playwright smoke (example.com + fixtures)
# headed smoke on the cloud desktop (XFCE on DISPLAY :1):
# DISPLAY=:1 BER_HEADLESS=0 npm run test:browser
npm run typecheck
npm run build
npm run bench:replayUseful docs:
INTEGRATING.md— wire any agent/providerARCHITECTURE.md— design statusROADMAP.md— prioritiesPUBLISHING.md— release checklistLICENSE— MIT
- Plan once, execute many — keep the LLM off the hot path
- Semantic state over screenshots — diffs beat pixels for most steps
- Remember recoveries — don’t re-ask the model for the same cookie wall
- Computer-use is fallback — not the default loop
- Stay open — wrapper interface, not a locked SaaS client
MIT — free to use, wrap, fork, and ship.