mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
29 lines
557 B
Python
29 lines
557 B
Python
"""
|
|
Simple try of the agent.
|
|
|
|
@dev You need to add OPENAI_API_KEY to your environment variables.
|
|
"""
|
|
|
|
import asyncio
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from browser_use import Agent, ChatOpenAI
|
|
|
|
load_dotenv()
|
|
|
|
# All the models are type safe from OpenAI in case you need a list of supported models
|
|
llm = ChatOpenAI(model='gpt-4.1-mini')
|
|
agent = Agent(
|
|
task='Go to amazon.com, click on the first link, and give me the title of the page',
|
|
llm=llm,
|
|
)
|
|
|
|
|
|
async def main():
|
|
await agent.run(max_steps=10)
|
|
input('Press Enter to continue...')
|
|
|
|
|
|
asyncio.run(main())
|