Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
tell allowed extensions to the model
mertunsallb2b95b086acb
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 58b2b1c34..9e17b3f10 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -549,7 +549,11 @@ class Agent(Generic[Context]):logger.info(f'💾 File system path: {self.file_system_path}')# if file system is set, add actions to the controller- @self.controller.registry.action('Write content to file_name in file system.')+ extensions_allowed = self.file_system.get_allowed_extensions()++ @self.controller.registry.action(+ f'Write content to file_name in file system. Only use extensions {"|".join(extensions_allowed)}'+ )async def write_file(file_name: str, content: str):result = await self.file_system.write_file(file_name, content)# Update agent state with new file system statediff --git a/browser_use/filesystem/file_system.py b/browser_use/filesystem/file_system.pyindex 772c89c80..cfabd19a6 100644--- a/browser_use/filesystem/file_system.py+++ b/browser_use/filesystem/file_system.py@@ -187,6 +187,10 @@ class FileSystem(BaseModel):if not _restore_mode:self._create_default_files()+ def get_allowed_extensions(self) -> list[str]:+ """Get allowed extensions"""+ return list(self._file_types.keys())+def _create_default_files(self) -> None:"""Create default results and todo files"""default_files = ['results.md', 'todo.md']