Skip to content

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

remove simple judge

Saurav Pandacb6fce4d1c0d
diff --git a/browser_use/agent/judge.py b/browser_use/agent/judge.py
index 3d840ef44..8de0c7407 100644
--- a/browser_use/agent/judge.py
+++ b/browser_use/agent/judge.py
@@ -2,7 +2,6 @@
import base64
import logging
-from datetime import datetime, timezone
from pathlib import Path
from typing import Literal
@@ -223,52 +222,3 @@ Evaluate this agent execution given the criteria and respond with the exact JSON
]
-def construct_simple_judge_messages(
- task: str,
- final_result: str,
-) -> list[BaseMessage]:
- """Construct lightweight judge messages to validate agent success claims.
-
- Always runs regardless of use_judge setting. Text-only — no screenshots,
- no trajectory. Just task + final result.
- """
- task_truncated = _truncate_text(task, 20000)
- final_result_truncated = _truncate_text(final_result, 20000)
-
- current_date = datetime.now(timezone.utc).strftime('%Y-%m-%d')
-
- system_prompt = f"""You are a strict verifier checking whether a browser automation agent actually completed its task.
-
-Today's date is {current_date}. The agent ran recently — dates near today are expected and NOT fabricated.
-
-Given the task and the agent's final response, determine if the response genuinely satisfies ALL requirements.
-
-Check for these common failure patterns:
-1. **Incorrect data**: Wrong number of items, missing filters/criteria, wrong format
-2. **Unverified actions**: Agent claims to have submitted a form, posted a comment, or saved a file but there's no evidence
-3. **Incomplete results**: Some requirements from the task are not addressed in the response
-4. **Fabricated content**: Data that looks plausible but wasn't actually extracted from any page. NOTE: dates and times close to today's date ({current_date}) are NOT fabricated — the agent browses live websites and extracts real-time content.
-5. **Partial completion reported as success**: Response acknowledges failure or blockers (captcha, access denied, etc.) but still claims success
-
-Respond with EXACTLY this JSON structure:
-{{
- "is_correct": true or false,
- "reason": "Brief explanation if not correct, empty string if correct"
-}}
-
-Be strict: if the response doesn't clearly satisfy every requirement, set is_correct to false."""
-
- user_prompt = f"""<task>
-{task_truncated or 'No task provided'}
-</task>
-
-<agent_final_response>
-{final_result_truncated or 'No response provided'}
-</agent_final_response>
-
-Does the agent's response fully satisfy all requirements of the task? Respond with the JSON structure."""
-
- return [
- SystemMessage(content=system_prompt),
- UserMessage(content=user_prompt),
- ]
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 34afcf362..04cdfd4ea 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -36,7 +36,7 @@ from pydantic import BaseModel, ValidationError
from uuid_extensions import uuid7str
from browser_use import Browser, BrowserProfile, BrowserSession
-from browser_use.agent.judge import construct_judge_messages, construct_simple_judge_messages
+from browser_use.agent.judge import construct_judge_messages
# Lazy import for gif to avoid heavy agent.views import at startup
# from browser_use.agent.gif import create_history_gif
@@ -59,7 +59,6 @@ from browser_use.agent.views import (
JudgementResult,
MessageCompactionSettings,
PlanItem,
- SimpleJudgeResult,
StepMetadata,
)
from browser_use.browser.events import _get_timeout
@@ -1507,46 +1506,6 @@ class Agent(Generic[Context, AgentStructuredOutput]):
self._message_manager._add_context_message(UserMessage(content=msg))
self.AgentOutput = self.DoneAgentOutput
- async def _run_simple_judge(self) -> None:
- """Lightweight always-on judge that overrides agent success when it overclaims.
-
- Runs regardless of use_judge setting. Only checks tasks where the agent
- claimed success — if the agent already reports failure, there's nothing to correct.
- """
- last_result = self.history.history[-1].result[-1]
- if not last_result.is_done or not last_result.success:
- return
-
- task = self.task
- final_result = self.history.final_result() or ''
-
- messages = construct_simple_judge_messages(
- task=task,
- final_result=final_result,
- )
-
- try:
- response = await self.llm.ainvoke(messages, output_format=SimpleJudgeResult)
- result: SimpleJudgeResult = response.completion # type: ignore[assignment]
- if not result.is_correct:
- reason = result.reason or 'Task requirements not fully met'
- self.logger.info(f'⚠️ Simple judge overriding success to failure: {reason}')
- last_result.success = False
- note = f'[Simple judge: {reason}]'
- # When structured output is expected, don't append judge text to extracted_content
- # as it would corrupt the JSON and break end-user parsers
- if self.output_model_schema is not None:
- if last_result.metadata is None:
- last_result.metadata = {}
- last_result.metadata['simple_judge'] = note
- elif last_result.extracted_content:
- last_result.extracted_content += f'\n\n{note}'
- else:
- last_result.extracted_content = note
- except Exception as e:
- self.logger.warning(f'Simple judge failed with error: {e}')
- # Don't override on error — keep the agent's self-report
-
@observe(ignore_input=True, ignore_output=False)
async def _judge_trace(self) -> JudgementResult | None:
"""Judge the trace of the agent"""
@@ -2228,9 +2187,6 @@ class Agent(Generic[Context, AgentStructuredOutput]):
await self.step(step_info)
if self.history.is_done():
- # Always run simple judge to align agent success with reality
- await self._run_simple_judge()
-
await self.log_completion()
# Run full judge before done callback if enabled
@@ -2432,9 +2388,6 @@ class Agent(Generic[Context, AgentStructuredOutput]):
await on_step_end(self)
if self.history.is_done():
- # Always run simple judge to align agent success with reality
- await self._run_simple_judge()
-
await self.log_completion()
# Run full judge before done callback if enabled
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.py
index a42205483..6f07cbfb9 100644
--- a/browser_use/agent/views.py
+++ b/browser_use/agent/views.py
@@ -303,12 +303,6 @@ class JudgementResult(BaseModel):
)
-class SimpleJudgeResult(BaseModel):
- """Result of lightweight always-on judge that validates agent success claims."""
-
- is_correct: bool = Field(description='True if the agent response genuinely satisfies the task requirements')
- reason: str = Field(default='', description='Brief explanation if not correct')
-
class ActionResult(BaseModel):
"""Result of executing an action"""