Skip to content

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

Eval for claude and no-vision

Magnus Müller01a01312d6d2
diff --git a/eval/claude.py b/eval/claude.py
new file mode 100644
index 000000000..b34c668c4
--- /dev/null
+++ b/eval/claude.py
@@ -0,0 +1,18 @@
+from dotenv import load_dotenv
+from langchain_anthropic import ChatAnthropic
+
+from browser_use import Agent
+
+load_dotenv()
+
+
+async def run_agent(task: str, max_steps: int = 38):
+ llm = ChatAnthropic(
+ model_name='claude-3-5-sonnet-20240620',
+ temperature=0.0,
+ timeout=100,
+ stop=None,
+ )
+ agent = Agent(task=task, llm=llm)
+ result = await agent.run(max_steps=max_steps)
+ return result
diff --git a/eval/gpt-4o-no-vision.py b/eval/gpt-4o-no-vision.py
new file mode 100644
index 000000000..47a5c21fe
--- /dev/null
+++ b/eval/gpt-4o-no-vision.py
@@ -0,0 +1,16 @@
+from dotenv import load_dotenv
+from langchain_openai import ChatOpenAI
+
+from browser_use import Agent
+
+load_dotenv()
+
+
+async def run_agent(task: str, max_steps: int = 38):
+ llm = ChatOpenAI(
+ model='gpt-4o',
+ temperature=0.0,
+ )
+ agent = Agent(task=task, llm=llm, use_vision=False)
+ result = await agent.run(max_steps=max_steps)
+ return result
diff --git a/eval/gpt-4o.py b/eval/gpt-4o.py
index 15ce9a1bc..b43951d53 100644
--- a/eval/gpt-4o.py
+++ b/eval/gpt-4o.py
@@ -1,29 +1,16 @@
-import asyncio
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
-from browser_use import Agent, Controller
+
+from browser_use import Agent
+
load_dotenv()
+
+
async def run_agent(task: str, max_steps: int = 38):
- llm = ChatOpenAI(
- model='gpt-4o',
- temperature=0.0,
- )
- agent = Agent(
- task=task,
- llm=llm,
- include_attributes=[
- 'title',
- 'type',
- 'name',
- 'role',
- 'tabindex',
- 'aria-label',
- 'placeholder',
- 'value',
- 'alt',
- 'aria-expanded',
- 'href',
- ],
- )
- result = await agent.run(max_steps=max_steps)
- return result, result.history
+ llm = ChatOpenAI(
+ model='gpt-4o',
+ temperature=0.0,
+ )
+ agent = Agent(task=task, llm=llm)
+ result = await agent.run(max_steps=max_steps)
+ return result