Fix simple example

This commit is contained in:
Magnus Müller
2025-08-26 14:23:40 -07:00
parent 29685aa7ce
commit 9463e4eb1e
3 changed files with 7 additions and 21 deletions

View File

@@ -76,7 +76,7 @@ _LAZY_IMPORTS = {
'BrowserProfile': ('browser_use.browser', 'BrowserProfile'),
# Tools (moderate weight)
'Tools': ('browser_use.tools.service', 'Tools'),
'Controller': ('browser_use.tools.service', 'Controller'),
'Controller': ('browser_use.tools.service', 'Controller'), # alias
# DOM service (moderate weight)
'DomService': ('browser_use.dom.service', 'DomService'),
# Chat models (very heavy imports)

View File

@@ -0,0 +1,3 @@
from browser_use.tools.service import Controller
__all__ = ['Controller']

View File

@@ -1,25 +1,8 @@
import asyncio
from browser_use import Agent, Controller
tools = Controller()
@tools.action('Ask human for help with a question')
def ask_human(question: str) -> str:
answer = input(f'{question} > ')
return f'The human responded with: {answer}'
from browser_use import Agent, ChatOpenAI
agent = Agent(
task='Ask human for help',
tools=tools,
llm=ChatOpenAI(model='gpt-4.1-mini'),
)
async def main():
await agent.run()
if __name__ == '__main__':
asyncio.run(main())
agent.run_sync()