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
Update docs
Magnus Müllerfad088048e0b
diff --git a/docs/customize/examples/chain-agents.mdx b/docs/customize/examples/follow-up-tasks.mdxsimilarity index 53%rename from docs/customize/examples/chain-agents.mdxrename to docs/customize/examples/follow-up-tasks.mdxindex 0a6c10a34..e971341b4 100644--- a/docs/customize/examples/chain-agents.mdx+++ b/docs/customize/examples/follow-up-tasks.mdx@@ -1,6 +1,6 @@----title: "Chain Agents"-description: "Chain multiple tasks together with the same agent and browser session."+title: "Follow up tasks"+description: "Follow up tasks with the same browser session."icon: "link"mode: "wide"---@@ -10,27 +10,29 @@ mode: "wide"Keep your browser session alive and chain multiple tasks together. Perfect for conversational workflows or multi-step processes.```python-import asynciofrom dotenv import load_dotenv++from browser_use import Agent, Browser++load_dotenv()-from browser_use import Agent, BrowserProfile+import asyncio-profile = BrowserProfile(keep_alive=True)async def main():- agent = Agent(task="Go to reddit.com", browser_profile=profile)- await agent.run(max_steps=1)-- while True:- user_response = input('\n👤 New task or "q" to quit: ')- if user_response.lower() == 'q':- break- agent.add_new_task(f'New task: {user_response}')- await agent.run()--if __name__ == '__main__':- asyncio.run(main())+ browser = Browser(keep_alive=True)++ await browser.start()++ agent = Agent(task='search for browser-use.', browser_session=browser)+ await agent.run(max_steps=2)+ agent.add_new_task('return the title of first result')+ await agent.run()++ await browser.kill()++asyncio.run(main())```## How It Works@@ -38,7 +40,8 @@ if __name__ == '__main__':1. **Persistent Browser**: `BrowserProfile(keep_alive=True)` prevents browser from closing between tasks2. **Task Chaining**: Use `agent.add_new_task()` to add follow-up tasks3. **Context Preservation**: Agent maintains memory and browser state across tasks-4. **Interactive Flow**: Perfect for conversational interfaces or complex workflows+4. **Interactive Flow**: Perfect for conversational interfaces+5. **Break down long flows**: If you have very long flows, you can keep the browser alive and send new agents to it.<Note>The browser session remains active throughout the entire chain, preserving all cookies, local storage, and page state.diff --git a/docs/docs.json b/docs/docs.jsonindex d53b78d3d..84b72c774 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -70,6 +70,10 @@{"source": "/development/hooks","destination": "/customize/hooks"+ },+ {+ "source": "/customize/examples/chain-agents",+ "destination": "/customize/examples/follow-up-tasks"}],"navigation": {@@ -127,7 +131,7 @@"icon": "folder-open","pages": ["customize/examples/fast-agent",- "customize/examples/chain-agents",+ "customize/examples/follow-up-tasks","customize/examples/parallel-browser","customize/examples/playwright-integration","customize/examples/sensitive-data",@@ -249,4 +253,4 @@"linkedin": "https://linkedin.com/company/browser-use"}}-}+}\ No newline at end of filediff --git a/examples/features/follow_up_task.py b/examples/features/follow_up_task.pynew file mode 100644index 000000000..505312dc1--- /dev/null+++ b/examples/features/follow_up_task.py@@ -0,0 +1,24 @@+from dotenv import load_dotenv++from browser_use import Agent, Browser++load_dotenv()++import asyncio+++async def main():+ browser = Browser(keep_alive=True)++ await browser.start()++ agent = Agent(task='search for browser-use.', browser_session=browser)+ await agent.run(max_steps=2)+ agent.add_new_task('return the title of first result')+ await agent.run()++ await browser.kill()+++if __name__ == '__main__':+ asyncio.run(main())