mirror of
https://github.com/browser-use/browser-use
synced 2026-05-06 17:52:15 +02:00
Example/simple (#1724)
### Example Task Update:
*
[`examples/simple.py`](diffhunk://#diff-7fc9f71ba0fe3a9a223587549462f41d40b57cb9d9097a0349eb7abeb9d04e39L20-R20):
Modified the example task description to specify finding the cheapest
one-way flight in 3 weeks, making it more realistic and time-relative.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Updated the example task to search for the cheapest one-way flight in 3
weeks, added a default browser profile fallback, and ignored temp
directories in git.
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -40,3 +40,5 @@ private_example.py
|
||||
private_example
|
||||
|
||||
uv.lock
|
||||
temp
|
||||
tmp
|
||||
|
||||
@@ -13,6 +13,8 @@ from typing import Any, Generic, TypeVar
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from browser_use.browser.session import DEFAULT_BROWSER_PROFILE
|
||||
|
||||
load_dotenv()
|
||||
|
||||
from langchain_core.language_models.chat_models import BaseChatModel
|
||||
@@ -291,7 +293,7 @@ class Agent(Generic[Context]):
|
||||
assert not (browser_profile and browser_context), 'Cannot provide both browser_profile and browser_context'
|
||||
assert not (browser and browser_context), 'Cannot provide both browser and browser_context'
|
||||
assert not (browser_session and browser_context), 'Cannot provide both browser_session and browser_context'
|
||||
|
||||
browser_profile = browser_profile or DEFAULT_BROWSER_PROFILE
|
||||
self.browser_session = browser_session or BrowserSession(
|
||||
profile=browser_profile, browser=browser, browser_context=browser_context
|
||||
)
|
||||
|
||||
@@ -17,8 +17,7 @@ llm = ChatOpenAI(
|
||||
model='gpt-4o',
|
||||
temperature=0.0,
|
||||
)
|
||||
task = 'Go to kayak.com and find the cheapest flight from Zurich to San Francisco on 2025-05-01'
|
||||
|
||||
task = 'Go to kayak.com and find the cheapest one-way flight from Zurich to San Francisco in 3 weeks.'
|
||||
agent = Agent(task=task, llm=llm)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user