Skip to content

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

Eval file

magmueller7fb04ed9f16a
diff --git a/eval/gpt-4o.py b/eval/gpt-4o.py
new file mode 100644
index 000000000..4fa0504ef
--- /dev/null
+++ b/eval/gpt-4o.py
@@ -0,0 +1,36 @@
+import asyncio
+
+from dotenv import load_dotenv
+from langchain_openai import ChatOpenAI
+
+from browser_use import Agent, Controller
+
+load_dotenv()
+
+
+async def run_agent(task: str):
+ 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',
+ ],
+ )
+
+ history = await agent.run()
+ final_response = history.final_result()
+ return final_response, history.history