|
| 1 | +<picture> |
| 2 | + <source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/2ccdb752-22fb-41c7-8948-857fc1ad7e24"> |
| 3 | + <source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/774a46d5-27a0-490c-b7d0-e65fcbbfa358"> |
| 4 | + <img alt="Shows a black Browser Use Logo in light color mode and a white one in dark color mode." src="https://github.com/user-attachments/assets/2ccdb752-22fb-41c7-8948-857fc1ad7e24" width="100%"> |
| 5 | +</picture> |
| 6 | + |
| 7 | +<div align="center"> |
| 8 | +<h2>The browser-native agent framework.</h2> |
| 9 | +</div> |
| 10 | + |
| 11 | +<div align="center"> |
| 12 | +<a href="#demos"><img src="https://media.browser-use.tools/badges/demos" alt="Demos"></a> |
| 13 | +<img width="16" height="1" alt=""> |
| 14 | +<a href="https://docs.browser-use.com"><img src="https://media.browser-use.tools/badges/docs" alt="Docs"></a> |
| 15 | +<img width="16" height="1" alt=""> |
| 16 | +<a href="https://browser-use.com/posts"><img src="https://media.browser-use.tools/badges/blog" alt="Blog"></a> |
| 17 | +<img width="280" height="1" alt=""> |
| 18 | +<a href="https://github.com/browser-use/browser-use"><img src="https://media.browser-use.tools/badges/github" alt="Github Stars"></a> |
| 19 | +<img width="4" height="1" alt=""> |
| 20 | +<a href="https://x.com/intent/user?screen_name=browser_use"><img src="https://media.browser-use.tools/badges/twitter" alt="Twitter"></a> |
| 21 | +<img width="4" height="1" alt=""> |
| 22 | +<a href="https://link.browser-use.com/discord"><img src="https://media.browser-use.tools/badges/discord" alt="Discord"></a> |
| 23 | +</div> |
| 24 | + |
| 25 | +<br/> |
| 26 | + |
1 | 27 | # BrowserCode |
2 | 28 |
|
3 | | -An AI coding agent that drives real browsers. Forks |
4 | | -[anomalyco/opencode](https://github.com/anomalyco/opencode) and ships a |
5 | | -TypeScript port of |
6 | | -[browser-use/browser-harness](https://github.com/browser-use/browser-harness). |
| 29 | +A streamlined coding agent that drives real browsers through unconstrained CDP. |
| 30 | + |
| 31 | +The unbounded power of the browser working seamlessly with your code. The agent adapts to every site at runtime and writes scripts to reuse later. |
| 32 | + |
| 33 | +<span id="demos"></span> |
| 34 | +<!-- DEMO VIDEO HERE --> |
7 | 35 |
|
8 | | -## Install |
| 36 | +## One-Line Install Command |
| 37 | + |
| 38 | +Run this in a terminal that supports bash: |
9 | 39 |
|
10 | 40 | ```sh |
11 | 41 | curl -fsSL https://bcode.sh/install | bash |
12 | 42 | ``` |
13 | 43 |
|
14 | | -Installs `bcode` to `~/.bcode/bin`. macOS, Linux, and Windows (Git Bash). |
15 | | -Requires Chrome with `chrome://inspect` enabled (or `BU_CDP_WS` set to a |
16 | | -remote CDP endpoint). |
| 44 | +## Usage |
17 | 45 |
|
18 | | -## What's different from opencode |
| 46 | +Open the TUI: |
19 | 47 |
|
20 | | -- One new tool, `browser_execute(code)`, that runs JavaScript/TypeScript |
21 | | - in a real browser via CDP. The CDP session persists across calls within |
22 | | - an agent session. |
23 | | -- Everything else from opencode works the same. Same providers, same TUI, |
24 | | - same config (`opencode.json`). |
| 48 | +```sh |
| 49 | +bcode |
| 50 | +``` |
25 | 51 |
|
26 | | -## Run from source |
| 52 | +Run an agent headlessly: |
27 | 53 |
|
28 | 54 | ```sh |
29 | | -git clone https://github.com/browser-use/browsercode.git |
30 | | -cd browsercode |
31 | | -bun install |
32 | | -bun run --cwd packages/opencode dev |
| 55 | +bcode run "Connect to my browser and find the cheapest way to SF via any bus/train/rideshare" |
33 | 56 | ``` |
34 | 57 |
|
35 | | -Needs `bun >= 1.3.13` plus the runtime prereqs above. |
| 58 | +### Connect an LLM |
| 59 | + |
| 60 | +BrowserCode supports any model you can reach with an API key, plus every provider OpenCode supports. |
| 61 | + |
| 62 | +[OpenCode provider docs](https://opencode.ai/docs/providers) |
36 | 63 |
|
37 | | -## Configure browser permission |
| 64 | +Use `/connect` in the TUI, or set provider API keys in your environment. |
38 | 65 |
|
39 | | -`browser_execute` is enabled by default. To disable or gate it, edit |
40 | | -`opencode.json`: |
| 66 | +<picture> |
| 67 | + <source media="(prefers-color-scheme: light)" srcset="static/browser_harness_by_model_light.png"> |
| 68 | + <source media="(prefers-color-scheme: dark)" srcset="static/browser_harness_by_model_dark.png"> |
| 69 | + <img alt="BU Bench V1 Browser Harness bcode v0.0.3 accuracy by model, led by claude-opus-4-7, gpt-5.5, mimo-v2.5-pro, and glm-5.1" src="static/browser_harness_by_model_light.png" width="100%"> |
| 70 | +</picture> |
41 | 71 |
|
42 | | -```jsonc |
43 | | -{ |
44 | | - // disable entirely |
45 | | - "tools": { "browser_execute": false } |
| 72 | +Recommended models from current BrowserCode evals: |
46 | 73 |
|
47 | | - // or prompt every call |
48 | | - "permission": { "browser_execute": "ask" } |
49 | | -} |
| 74 | +- Frontier: `claude-opus-4-7`, `gpt-5.5` |
| 75 | +- Value: `glm-5.1`, `mimo-v2.5-pro` |
| 76 | +- Budget: `gemini-3-flash-preview` |
| 77 | + |
| 78 | +### Connect a Browser |
| 79 | + |
| 80 | +Let the agent connect for you. It knows how. You can prompt: |
| 81 | + |
| 82 | +```text |
| 83 | +Connect to my current tab at https://amazon.com and look for a better deal for 64GB DDR5 RAM and return the URLs |
| 84 | +``` |
| 85 | + |
| 86 | +The agent will take control of your actual browser. |
| 87 | + |
| 88 | +```text |
| 89 | +Make a new browser profile and work in the background to QA test http://localhost:3000, fix any bugs and open a PR |
50 | 90 | ``` |
51 | 91 |
|
52 | | -## Repo layout |
| 92 | +The agent will work locally in its own browser profile. |
| 93 | + |
| 94 | +```text |
| 95 | +Open a remote browser and extract every item sold at https://mcdonalds.com in SF |
| 96 | +``` |
| 97 | + |
| 98 | +The agent will control a Browser Use Cloud browser and give you a link to watch it. |
| 99 | + |
| 100 | +#### Cloud Browsers |
| 101 | + |
| 102 | +- Browser Use Cloud offers unlimited free browsers, limited to 3 concurrent sessions, with stealth, captcha solving, and proxies. |
| 103 | +- Just set `BROWSER_USE_API_KEY` in your environment. The agent can sign up completely autonomously; just ask it to. To upgrade further, go to [cloud.browser-use.com](https://cloud.browser-use.com). |
53 | 104 |
|
54 | | -- `packages/opencode/` — vendored from `anomalyco/opencode` (treat as |
55 | | - upstream; modifications are deliberate exceptions). |
56 | | -- `packages/bcode-browser/` — BrowserCode-specific code: in-process CDP |
57 | | - harness, `browser_execute` implementation, embedded skills. |
| 105 | +## Philosophy |
58 | 106 |
|
59 | | -## Maintenance docs |
| 107 | +Browser ability and code-writing ability are deeply connected. |
60 | 108 |
|
61 | | -- `UPSTREAM.md` — modification zones, sync log. |
62 | | -- `opencode-sync.md` — runbook for syncing from anomalyco/opencode. |
63 | | -- `AGENTS.md` — code style + maintenance notes for agents working in this repo. |
64 | | -- `install.sh` — what `bcode.sh/install` serves. |
| 109 | +We turned browser interaction into a coding problem; the agent writes JavaScript that drives Chrome directly through CDP. Maximal power to the agent. Minimal abstractions. |
| 110 | + |
| 111 | +#### Do more with less. |
| 112 | + |
| 113 | +*BrowserCode outperforms every browser agent we have tested it against.* |
| 114 | + |
| 115 | +## Architecture |
| 116 | + |
| 117 | +BrowserCode is a fork of [OpenCode](https://github.com/anomalyco/opencode) with a vendored TypeScript port of [Browser Harness](https://github.com/browser-use/browser-harness). |
| 118 | + |
| 119 | +It adds one core browser primitive: |
| 120 | + |
| 121 | +```text |
| 122 | +browser_execute(code) |
| 123 | + -> runs JavaScript in-process |
| 124 | + -> talks to Chrome through the DevTools Protocol |
| 125 | + -> keeps the browser session alive across calls |
| 126 | + -> returns logs, values, and screenshots to the agent |
| 127 | +``` |
| 128 | + |
| 129 | +Reusable browser scripts are written to: |
| 130 | + |
| 131 | +```text |
| 132 | +.bcode/agent-workspace/ |
| 133 | +``` |
| 134 | + |
| 135 | +*BrowserCode is not built by the OpenCode team and is not affiliated with OpenCode in any way.* |
65 | 136 |
|
66 | 137 | ## Telemetry |
67 | 138 |
|
68 | | -BrowserCode sends anonymous usage traces to help improve the project. To opt |
69 | | -out, set `DO_NOT_TRACK=1` in your environment. |
| 139 | +BrowserCode sends anonymous usage traces to help improve the project. To opt out, set `DO_NOT_TRACK=1` in your environment. |
| 140 | + |
| 141 | +## Contributing |
| 142 | + |
| 143 | +Most upstream contributions belong in one of the projects BrowserCode builds on: |
| 144 | + |
| 145 | +- Browser automation: [browser-use/browser-harness](https://github.com/browser-use/browser-harness) |
| 146 | +- Core coding-agent: [anomalyco/opencode](https://github.com/anomalyco/opencode) |
| 147 | + |
| 148 | +Run from source: |
| 149 | + |
| 150 | +```sh |
| 151 | +git clone https://github.com/browser-use/browsercode.git |
| 152 | +cd browsercode |
| 153 | +bun install |
| 154 | +bun run --cwd packages/opencode dev |
| 155 | +``` |
| 156 | + |
| 157 | +--- |
70 | 158 |
|
71 | | -## License |
| 159 | +<p align="center">Tell your computer what to do, and it gets it done.</p> |
72 | 160 |
|
73 | | -MIT. See `LICENSE`. |
| 161 | +<!-- FOOTER IMAGE HERE --> |
0 commit comments