You can connect the agent to your real Chrome browser instance, allowing it to access your existing browser profile with all your logged-in accounts and settings. This is particularly useful when you want the agent to interact with services where you’re already authenticated.
First make sure to close all running Chrome instances.
To connect to your real Chrome browser, you’ll need to specify the path to your Chrome executable when creating the Browser instance:
Copy
from openoperator import Agent, Browser, BrowserConfig, LLMimport asyncio# Configure the browser to connect to your Chrome instancebrowser = Browser( config=BrowserConfig( # Specify the path to your Chrome executable chrome_instance_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', # macOS path # For Windows, typically: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' # For Linux, typically: '/usr/bin/google-chrome' ))# Create the agent with your configured browseragent = Agent( llm=ChatOpenAI(model='gpt-4o'), browser=browser,)async def main(): agent.add_task("Open the most recent Hacksmith Industries video on youtube.") await agent.run() input('Press Enter to close the browser...') await browser.close()if __name__ == '__main__': asyncio.run(main())
When using your real browser, the agent will have access to all your logged-in sessions. Make sure to review the task you’re giving to the agent and ensure it aligns with your security requirements.