Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Match Rust unsupported vision warnings

Magnus Müllerc5834714e594
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.md
index b1d805a69..cd124d6e9 100644
--- a/RUST_AGENT_INTEGRATION_FEATURES.md
+++ b/RUST_AGENT_INTEGRATION_FEATURES.md
@@ -1056,10 +1056,15 @@ Terminal core branch: `magnus/browser-use-rust-main-integration` at terminal mai
- This preserves the public feedback callers see when automatic URL startup changes the initial action list before the Rust terminal core runs.
- Proof: `test_rust_agent_logs_direct_url_startup_like_browser_use`.
+209. Rust Agent unsupported-vision warning parity
+ - Rust-backed construction now emits Browser Use's exact warning messages, including the warning icon prefix, when DeepSeek or Grok/XAI model families force `use_vision=False`.
+ - Vision disabling behavior is unchanged; this aligns the public constructor feedback seen by callers when their requested model family does not support vision.
+ - Proof: `test_rust_agent_unsupported_vision_warnings_match_browser_use`.
+
## Current Verification
- `python3 -m py_compile browser_use/agent/service.py browser_use/rust/service.py browser_use/rust/__init__.py browser_use/__init__.py tests/ci/test_rust_agent.py examples/rust_agent/basic.py examples/rust_agent/real_v8_smoke.py`
-- `uv run pytest -q tests/ci/test_rust_agent.py` (177 tests)
+- `uv run pytest -q tests/ci/test_rust_agent.py` (178 tests)
- `cargo build -q -p browser-use-cli` on terminal branch `magnus/browser-use-rust-main-integration`
- `cargo test -q -p browser-use-cli run_codex_session_command_accepts_task_id_and_model -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-agent selected_remote_cdp_mode_allows_remote_cdp_connect -- --nocapture`
diff --git a/browser_use/rust/service.py b/browser_use/rust/service.py
index 0708ad6d4..0c92e6189 100644
--- a/browser_use/rust/service.py
+++ b/browser_use/rust/service.py
@@ -2599,10 +2599,10 @@ class Agent(Generic[Context, AgentStructuredOutput]):
self._verify_and_setup_llm()
model_name = str(getattr(self.llm, 'model', self.model) or '').lower()
if 'deepseek' in model_name:
- self.logger.warning('DeepSeek models do not support use_vision=True yet. Setting use_vision=False for now...')
+ self.logger.warning('⚠️ DeepSeek models do not support use_vision=True yet. Setting use_vision=False for now...')
self.settings.use_vision = False
if 'grok' in model_name:
- self.logger.warning('XAI models do not support use_vision=True yet. Setting use_vision=False for now...')
+ self.logger.warning('⚠️ XAI models do not support use_vision=True yet. Setting use_vision=False for now...')
self.settings.use_vision = False
self.token_cost_service = TokenCost(include_cost=calculate_cost)
_register_llm_for_usage(self.token_cost_service, llm)
diff --git a/tests/ci/test_rust_agent.py b/tests/ci/test_rust_agent.py
index dca3fcf59..89d4e0c13 100644
--- a/tests/ci/test_rust_agent.py
+++ b/tests/ci/test_rust_agent.py
@@ -2832,6 +2832,47 @@ def test_rust_agent_disables_vision_for_unsupported_model_families():
assert normal_agent.settings.use_vision is True
+def test_rust_agent_unsupported_vision_warnings_match_browser_use(monkeypatch):
+ from browser_use.agent.service import _PythonAgent as BrowserUseAgent
+ from browser_use.rust import Agent as RustAgent
+
+ class LLM:
+ provider = 'test'
+
+ def __init__(self, model):
+ self.model = model
+
+ async def ainvoke(self, messages, output_format=None, **kwargs):
+ return type('Result', (), {'usage': None})()
+
+ class RecordingLogger:
+ def __init__(self):
+ self.warnings = []
+
+ def info(self, message, *args, **kwargs):
+ pass
+
+ def debug(self, message, *args, **kwargs):
+ pass
+
+ def warning(self, message, *args, **kwargs):
+ self.warnings.append(message)
+
+ def error(self, message, *args, **kwargs):
+ pass
+
+ for model in ['deepseek-chat', 'grok-2']:
+ browser_use_logger = RecordingLogger()
+ rust_logger = RecordingLogger()
+ monkeypatch.setattr(BrowserUseAgent, 'logger', property(lambda self, logger=browser_use_logger: logger))
+ monkeypatch.setattr(RustAgent, 'logger', property(lambda self, logger=rust_logger: logger))
+
+ BrowserUseAgent(task='Inspect vision warning.', llm=LLM(model), directly_open_url=False, use_vision=True)
+ RustAgent(task='Inspect vision warning.', llm=LLM(model), directly_open_url=False, use_vision=True)
+
+ assert rust_logger.warnings == browser_use_logger.warnings
+
+
def test_rust_agent_state_id_defaults_like_browser_use():
from browser_use.agent.service import _PythonAgent as BrowserUseAgent
from browser_use.agent.views import AgentState