Repository navigation
feat(agents): the Browser Use agent runs browser-use 1.0.3 - #659
Conversation
browser-use 1.0 replaces Browser Use Pi: the agent now runs browser-use's Python library, pinned to 1.0.3, in an environment of its own in the image, since it pins mcp 2 and the protocol's agent extra needs mcp 1. A Claude model goes through the endpoint's Anthropic Messages route, as browser-use runs Claude, with the profile of its bare name, so its adaptive thinking and effort apply; any other model goes through the OpenAI-compatible route. Telemetry is off, the turn's usage reports browser-use's tokens, and its trajectory is the run's messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…ys when the turn ends browser-use's daemon closes the tab it opened for itself when it stops, so a run in it left the screen blank and its last page out of reach. When the browser has one tab open, as a browser computer does, the agent attaches to it, as browser-use attaches a kept-alive run's tab. Agent folders count as container-only for the runtime-dependency check, since their images install their own requirements; the integration test reads the title of the tab the agent drives, and browser-use's cell output as it gives it, a list of lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| text = "\n".join(getattr(part, "text", None) or json.dumps(part.model_dump(mode="json")) | ||
| for part in result.content) | ||
| if result.isError: | ||
| raise ModelRetry(text) | ||
| return text |
There was a problem hiding this comment.
_caller turns MCP images into JSON text. When a task supplies an image-returning tool such as computer_screenshot, the model receives base64 text instead of an image it can inspect. The previous bridge preserved image parts. Return images through Pydantic AI's image support rather than joining every part into a string.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/agents/agents/browser-use/agent.py
Line: 83-87
Comment:
**MCP images become text**
`_caller` turns MCP images into JSON text. When a task supplies an image-returning tool such as `computer_screenshot`, the model receives base64 text instead of an image it can inspect. The previous bridge preserved image parts. Return images through Pydantic AI's image support rather than joining every part into a string.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| await browser.start() | ||
|
|
||
| def attach() -> None: | ||
| own = _daemon_request(browser.name, {"meta": "current_tab"}, timeout=5)["targetId"] |
There was a problem hiding this comment.
The new tab lookup embeds its five-second deadline as timeout=5. The repository requires magic numbers to have descriptive names. Give this deadline a named setting so readers can find and tune it. This requirement must be satisfied before merging.
Rule Used: Store magic numbers as class or instance variables with descriptive names rather than using them inline in the code. (source)
Learned From
scaleapi/scaleapi#126388
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/agents/agents/browser-use/agent.py
Line: 98
Comment:
**Tab deadline lacks a name**
The new tab lookup embeds its five-second deadline as `timeout=5`. The repository requires magic numbers to have descriptive names. Give this deadline a named setting so readers can find and tune it. This requirement must be satisfied before merging.
**Rule Used:** Store magic numbers as class or instance variables with descriptive names rather than using them inline in the code. ([source](https://app.greptile.com/-/switch-tenant?tenant=scale-ai&next=%2Fcustom-context%3Fmemory%3D002e0051-41ad-46c1-9098-47433c580150))
**Learned From**
[scaleapi/scaleapi#126388](https://github.com/scaleapi/scaleapi/pull/126388)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
What
The agents bundle's Browser Use agent (
browser-use) now runs browser-use 1.0 instead of Browser Use Pi, pinned tobrowser-use==1.0.3, the latest release.browser-use 1.0 is the Python library rewritten so its agent writes Python in one persistent REPL, straight on CDP. Its release benchmarks it against Browser Use Pi at the same quality, cheaper and faster.
How
mcp==2.3.0, and the protocol'sagentextra needsmcp<2. So the image installs it in/opt/browser-use. The A2A server runsagent.pythere once per turn, as it rannode agent.mjs.effort(medium when unset, browser-use's default) and caches the prompt.anthropic/claude-haiku-5-5, Pydantic AI doesn't know the model supports adaptive thinking and effort. It would send budget thinking, which Haiku 5.5 refuses.effortasreasoning_effort.cdp-config/v1endpoint, throughBrowser(cdp_url=...). When the browser has one tab open, as a browser computer does, the agent drives that tab, which is the computer's screen, as Browser Use Pi did. With several, browser-use opens a tab of its own.Browser._agent_tab,_attach_agent_tab).<server>__<tool>. They get browser-use's own retry budget, so a tool error goes back to the model.Agent._history,_compactedand_continue, asadd_new_taskdoes in process; there's no public API for it across processes. It's tied to the pinned 1.0.3, and the integration test's second turn covers it.ANONYMIZED_TELEMETRY=falseandBH_TELEMETRY=0, in the image and on every turn.Behavior that changes for this agent
efforttakeslow,mediumorhigh, browser-use's values. Pi'sminimalandxhighare refused.modesetting (defaultorultrafast).max_stepsunset is browser-use's 100, not 40.max_stepsor its timeout gets browser-use's forced delivery turn, and completes with that answer.browser-use-messages/1, given when the turn ends, so it's no longer live.Verification
tst/unit/agents/browser_usepasses (9). It covers the turn the agent passes, telemetry off, usage, the trajectory, the refused effort, a crash, a timeout and the CDP refusals.agent-env run agents --task browser-use-smoke --model anthropic/claude-haiku-5-5passes against a fresh store, in 8.8 s. The trajectory shows the Anthropic route with a prompt-cache write, then a read.thinking: {type: adaptive, display: summarized},output_config: {effort: medium},max_tokens: 128000and cache control. That's the same effort and thinking Claude Code 2.1.322 sends by default.tst/integration/cli/run_bundle_browser_use_test.pyis rewritten for thepythonandfinishtools. It passes locally (2 passed, 6 min):http_url;wsandhttp;cdparm (Apple, Trader Joe's, Target). Their exports show the agent's steps and end on the agent's page. The benchmarks exporter now drops tab bookkeeping no one saw (earakely-scale/agentenv-benchmarks@36b0719).tst/unit/test_runtime_dependencies_are_imported.pynow counts the agent folders as container-only, as it counts the gateway, since their images install their own requirements.🤖 Generated with Claude Code
Fix MCP image results and satisfy the named-number requirement before merging.
Fix with agent prompt
Summary
Replaces Browser Use Pi with
browser-use==1.0.3in a private Python environment.Intentional changes stated by
earakely-scale: narrower effort values, a new mode setting, the upstream step default, forced delivery, and non-live trajectories. These were not treated as defects.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[A2A turn] --> S[a2a_server.py] S --> P[agent.py in private Python environment] H[Saved message history] --> P P --> M{Model name} M --> C[Anthropic Messages] M --> O[OpenAI-compatible endpoint] P --> B[Task browser through CDP] P --> T[Task MCP tools] P --> H P --> R[Answer, usage, and messages] R --> SReviews (1) · Last reviewed commit: "fix(agents): browser-use drives the brow..." · Reviewed by Greptile