Skip to content

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

Add grok eval

Siddhant Somani1f9386d636cc
diff --git a/eval/grok.py b/eval/grok.py
new file mode 100644
index 000000000..6a32669c7
--- /dev/null
+++ b/eval/grok.py
@@ -0,0 +1,22 @@
+import os
+from langchain_openai import ChatOpenAI
+from pydantic import SecretStr
+from browser_use import Agent
+import asyncio
+from dotenv import load_dotenv
+load_dotenv()
+
+api_key = os.getenv('GROK_API_KEY', '')
+if not api_key:
+ raise ValueError('GROK_API_KEY is not set')
+
+async def main():
+ agent = Agent(
+ task='Go to https://www.google.com and search for "python" and click on the first result',
+ use_vision=False,
+ llm=ChatOpenAI(model="grok-2-1212",base_url="https://api.x.ai/v1",api_key=SecretStr(api_key)),
+ )
+
+ await agent.run()
+
+asyncio.run(main())
\ No newline at end of file