Skip to content

Browser AI Agent

powered by a Locally running LLM

# this is an AI agent that uses your browser and a locally installed LLM

from langchain_ollama import ChatOllama
from browser_use import Agent, BrowserConfig, Browser
import asyncio

# make sure https://ollama.com/ is installed
# and llama3.1:latest is downloaded in your local machine
llm = ChatOllama(model="llama3.1:latest")

# install chrome canary
config = BrowserConfig(
    chrome_instance_path="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
)

browser = Browser(config=config)


async def main():
    # credit https://github.com/browser-use
    agent = Agent(
        task="Check when is the next Coldplay concert in Google.",
        llm=llm,
        browser=browser
    )
    result = await agent.run()
    # Manually close the browser
    await browser.close()
    print(result)

asyncio.run(main())