2025-05-13 16:42:26 -07:00
|
|
|
import asyncio
|
2024-12-27 15:49:52 +01:00
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
|
2025-05-13 16:42:26 -07:00
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
|
|
|
|
|
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
load_dotenv()
|
2024-12-27 15:49:52 +01:00
|
|
|
|
2025-08-18 18:27:39 -07:00
|
|
|
from browser_use import Agent, BrowserProfile, BrowserSession, ChatOpenAI
|
|
|
|
|
|
2025-05-25 14:33:09 -07:00
|
|
|
browser_profile = BrowserProfile(
|
2025-05-26 18:37:52 -07:00
|
|
|
executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
2025-08-23 11:38:34 +01:00
|
|
|
user_data_dir='~/Library/Application Support/Google/Chrome',
|
|
|
|
|
profile_directory='Default',
|
2024-12-27 15:49:52 +01:00
|
|
|
)
|
2025-05-25 14:33:09 -07:00
|
|
|
browser_session = BrowserSession(browser_profile=browser_profile)
|
2024-12-27 15:49:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
|
agent = Agent(
|
2025-08-18 18:27:39 -07:00
|
|
|
llm=ChatOpenAI(model='gpt-4.1-mini'),
|
|
|
|
|
task='Visit https://duckduckgo.com and search for "browser-use founders"',
|
2025-05-25 14:33:09 -07:00
|
|
|
browser_session=browser_session,
|
2024-12-27 15:49:52 +01:00
|
|
|
)
|
|
|
|
|
await agent.run()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
asyncio.run(main())
|