Skip to content

Instantly share code, notes, and snippets.

@tweibley
Created January 28, 2025 01:45
Show Gist options
  • Save tweibley/c05731d6953e0e1916fde981fc75c67f to your computer and use it in GitHub Desktop.
Save tweibley/c05731d6953e0e1916fde981fc75c67f to your computer and use it in GitHub Desktop.
An example browser-use script for deepseek-r1 hosted locally via ollama
import asyncio
from browser_use import Agent
from browser_use.agent.views import AgentHistoryList
from langchain_ollama import ChatOllama
async def run_search():
agent = Agent(
task=('search for browser-use and summarize the first three results on google.com (do not click or attempt to sign in)'),
llm=ChatOllama(
base_url="http://localhost:11434/",
model='deepseek-r1:7b',
),
tool_calling_method="json_schema",
use_vision=False,
max_failures=3,
max_actions_per_step=2,
)
# Execute the task
result = await agent.run()
print(result)
# Run the function in an event loop
if __name__ == "__main__":
import asyncio
asyncio.run(run_search())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment