fix link docs

This commit is contained in:
Magnus Müller
2025-10-23 23:22:32 -07:00
parent b288841892
commit cfb3dbdb98
2 changed files with 25 additions and 1 deletions

View File

@@ -150,3 +150,26 @@ if __name__ == "__main__":
</CodeGroup>
<Note> Custom browsers can be configured in one line. Check out <a href = "customize/browser/basics">browsers</a> for more. </Note>
## Advanced: CodeAgent for Local Code Execution
For tasks that require combining browser automation with local code execution (like processing data, saving files, or running computations), use the `CodeAgent`:
```python
import asyncio
from browser_use.code_use import CodeAgent
async def main():
task = "Go to Hacker News, extract the top 10 posts, and save them to posts.json"
agent = CodeAgent(task=task, max_steps=25)
try:
session = await agent.run()
finally:
await agent.close()
if __name__ == "__main__":
asyncio.run(main())
```
The `CodeAgent` executes Python code locally (like Claude Code) while having full access to browser automation capabilities. Learn more in the <a href="customize/agent/code-agent">CodeAgent documentation</a>.

View File

@@ -11,7 +11,8 @@ from browser_use import Agent, ChatBrowserUse
load_dotenv()
agent = Agent(
task='Find the number of stars of the following repos: browser-use, playwright, stagehand, react, nextjs',
task='https://wcpdev.wd101.myworkday.com/wday/authgwy/nayyabow_wcpdev2/login.html?returnTo=%2fnayyabow_wcpdev2%2fd%2fhome.html go here click and then fill with example data, use only send keys ',
# task='go to duckduckgo.com search for browser-use but use only send keys validate the results, go to first link',
llm=ChatBrowserUse(),
)
agent.run_sync()