Skip to content

Feature request: Option to run a native browser instead of playwright #1

@Eloitor

Description

@Eloitor

I tried this and it worked. It would be nice if there was an option to enable this without modifying the code.

diff --git a/operator_agent.py b/operator_agent.py
index 3ce6401..1bc7f73 100644
--- a/operator_agent.py
+++ b/operator_agent.py
@@ -5,11 +5,14 @@ import httpx
 import asyncio
 from langchain_openai import ChatOpenAI
 from langchain_community.llms import Ollama
-from browser_use import Agent
+from browser_use import Agent, Browser, BrowserConfig
 # from dotenv import load_dotenv
 
 # load_dotenv()
 from api_secrets import DEEPSEEK_API_KEY, OPENROUTER_API_KEY
+browser = Browser(
+    config=BrowserConfig(chrome_instance_path='/usr/bin/chromium')
+)
 
 class OllamaOperator:
     def __init__(self, model="deepseek-r1:1.5b"):
@@ -22,7 +25,7 @@ class OllamaOperator:
         
     async def execute_task(self, task, max_steps=20):
         try:
-            agent = Agent(task=task, llm=self.client)
+            agent = Agent(task=task, llm=self.client, browser=browser)
             result = await agent.run(max_steps=max_steps)
             return f"Execution Result:\n{result}"
         except Exception as e:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions