ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: "Get Help"
|
||||
description: "More than 20k developers help each other"
|
||||
icon: "circle-question"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
|
||||
1. Check our [GitHub Issues](https://github.com/browser-use/browser-use/issues)
|
||||
2. Ask in our [Discord community](https://link.browser-use.com/discord)
|
||||
3. Get support for your enterprise with support@browser-use.com
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
title: "Observability"
|
||||
description: "Trace Browser Use's agent execution steps and browser sessions"
|
||||
icon: "eye"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Browser Use has a native integration with [Laminar](https://lmnr.ai) - open-source platform for tracing, evals and labeling of AI agents.
|
||||
Read more about Laminar in the [Laminar docs](https://docs.lmnr.ai).
|
||||
|
||||
## Setup
|
||||
|
||||
|
||||
|
||||
Register on [Laminar Cloud](https://lmnr.ai) and get the key from your project settings.
|
||||
Set the `LMNR_PROJECT_API_KEY` environment variable.
|
||||
```bash
|
||||
pip install 'lmnr[all]'
|
||||
export LMNR_PROJECT_API_KEY=<your-project-api-key>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Then, you simply initialize the Laminar at the top of your project and both Browser Use and session recordings will be automatically traced.
|
||||
|
||||
```python {5-8}
|
||||
from browser_use import Agent, ChatOpenAI
|
||||
import asyncio
|
||||
|
||||
from lmnr import Laminar, Instruments
|
||||
# this line auto-instruments Browser Use and any browser you use (local or remote)
|
||||
Laminar.initialize(project_api_key="...", disabled_instruments={Instruments.BROWSER_USE})
|
||||
|
||||
async def main():
|
||||
agent = Agent(
|
||||
task="open google, search Laminar AI",
|
||||
llm=ChatOpenAI(model="gpt-4.1-mini"),
|
||||
)
|
||||
await agent.run()
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
## Viewing Traces
|
||||
|
||||
You can view traces in the Laminar UI by going to the traces tab in your project.
|
||||
When you select a trace, you can see both the browser session recording and the agent execution steps.
|
||||
|
||||
Timeline of the browser session is synced with the agent execution steps, timeline highlights indicate the agent's current step synced with the browser session.
|
||||
In the trace view, you can also see the agent's current step, the tool it's using, and the tool's input and output. Tools are highlighted in the timeline with a yellow color.
|
||||
|
||||
<img className="block" src="/images/laminar.png" alt="Laminar" />
|
||||
|
||||
## Laminar
|
||||
|
||||
To learn more about tracing and evaluating your browser agents, check out the [Laminar docs](https://docs.lmnr.ai).
|
||||
|
||||
## Browser Use Cloud Authentication
|
||||
|
||||
Browser Use can sync your agent runs to the cloud for easy viewing and sharing. Authentication is required to protect your data.
|
||||
|
||||
### Quick Setup
|
||||
|
||||
```bash
|
||||
# Authenticate once to enable cloud sync for all future runs
|
||||
browser-use auth
|
||||
# Or if using module directly:
|
||||
python -m browser_use.cli auth
|
||||
```
|
||||
|
||||
**Note**: Cloud sync is enabled by default. If you've disabled it, you can re-enable with `export BROWSER_USE_CLOUD_SYNC=true`.
|
||||
|
||||
### Manual Authentication
|
||||
|
||||
```python
|
||||
# Authenticate from code after task completion
|
||||
from browser_use import Agent
|
||||
|
||||
agent = Agent(task="your task")
|
||||
await agent.run()
|
||||
|
||||
# Later, authenticate for future runs
|
||||
await agent.authenticate_cloud_sync()
|
||||
```
|
||||
|
||||
### Reset Authentication
|
||||
|
||||
```bash
|
||||
# Force re-authentication with a different account
|
||||
rm ~/.config/browseruse/cloud_auth.json
|
||||
browser-use auth
|
||||
```
|
||||
|
||||
**Note**: Authentication uses OAuth Device Flow - you must complete the auth process while the command is running. Links expire when the polling stops.
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "Telemetry"
|
||||
description: "Understanding Browser Use's telemetry"
|
||||
icon: "chart-mixed"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Browser Use is free under the MIT license. To help us continue improving the library, we collect anonymous usage data with [PostHog](https://posthog.com) . This information helps us understand how the library is used, fix bugs more quickly, and prioritize new features.
|
||||
|
||||
|
||||
## Opting Out
|
||||
|
||||
You can disable telemetry by setting the environment variable:
|
||||
|
||||
```bash .env
|
||||
ANONYMIZED_TELEMETRY=false
|
||||
```
|
||||
|
||||
Or in your Python code:
|
||||
|
||||
```python
|
||||
import os
|
||||
os.environ["ANONYMIZED_TELEMETRY"] = "false"
|
||||
```
|
||||
|
||||
<Note>
|
||||
Even when enabled, telemetry has zero impact on the library's performance. Code is available in [Telemetry
|
||||
Service](https://github.com/browser-use/browser-use/tree/main/browser_use/telemetry).
|
||||
</Note>
|
||||
@@ -0,0 +1,123 @@
|
||||
---
|
||||
title: 'n8n Integration'
|
||||
description: 'Learn how to integrate Browser Use with n8n workflows'
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
# Browser Use n8n Integration
|
||||
|
||||
Browser Use can be integrated with [n8n](https://n8n.io), a workflow automation platform, using our community node. This integration allows you to trigger browser automation tasks directly from your n8n workflows.
|
||||
|
||||
## Installing the n8n Community Node
|
||||
|
||||
There are several ways to install the Browser Use community node in n8n:
|
||||
|
||||
### Using n8n Desktop or Cloud
|
||||
|
||||
1. Navigate to **Settings > Community Nodes**
|
||||
2. Click on **Install**
|
||||
3. Enter `n8n-nodes-browser-use` in the **Name** field
|
||||
4. Click **Install**
|
||||
|
||||
### Using a Self-hosted n8n Instance
|
||||
|
||||
Run the following command in your n8n installation directory:
|
||||
|
||||
```bash
|
||||
npm install n8n-nodes-browser-use
|
||||
```
|
||||
|
||||
### For Development
|
||||
|
||||
If you want to develop with the n8n node:
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/draphonix/n8n-nodes-browser-use.git
|
||||
```
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
cd n8n-nodes-browser-use
|
||||
npm install
|
||||
```
|
||||
3. Build the code:
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
4. Link to your n8n installation:
|
||||
```bash
|
||||
npm link
|
||||
```
|
||||
5. In your n8n installation directory:
|
||||
```bash
|
||||
npm link n8n-nodes-browser-use
|
||||
```
|
||||
|
||||
## Setting Up Browser Use Cloud API Credentials
|
||||
|
||||
To use the Browser Use node in n8n, you need to configure API credentials:
|
||||
|
||||
1. Sign up for an account at [Browser Use Cloud](https://cloud.browser-use.com)
|
||||
2. Navigate to the Settings or API section
|
||||
3. Generate or copy your API key
|
||||
4. In n8n, create a new credential:
|
||||
- Go to **Credentials** tab
|
||||
- Click **Create New**
|
||||
- Select **Browser Use Cloud API**
|
||||
- Enter your API key
|
||||
- Save the credential
|
||||
|
||||
## Using the Browser Use Node
|
||||
|
||||
Once installed, you can add the Browser Use node to your workflows:
|
||||
|
||||
1. In your workflow editor, search for "Browser Use" in the nodes panel
|
||||
2. Add the node to your workflow
|
||||
3. Set-up the credentials
|
||||
4. Choose your saved credentials
|
||||
5. Select an operation:
|
||||
- **Run Task**: Execute a browser automation task with natural language instructions
|
||||
- **Get Task**: Retrieve task details
|
||||
- **Get Task Status**: Check task execution status
|
||||
- **Pause/Resume/Stop Task**: Control running tasks
|
||||
- **Get Task Media**: Retrieve screenshots, videos, or PDFs
|
||||
- **List Tasks**: Get a list of tasks
|
||||
|
||||
### Example: Running a Browser Task
|
||||
|
||||
Here's a simple example of how to use the Browser Use node to run a browser task:
|
||||
|
||||
1. Add the Browser Use node to your workflow
|
||||
2. Select the "Run Task" operation
|
||||
3. In the "Instructions" field, enter a natural language description of what you want the browser to do, for example:
|
||||
```
|
||||
Go to example.com, take a screenshot of the homepage, and extract all the main heading texts
|
||||
```
|
||||
4. Optionally enable "Save Browser Data" to preserve cookies and session information
|
||||
5. Connect the node to subsequent nodes to process the results
|
||||
|
||||
## Workflow Examples
|
||||
|
||||
The Browser Use n8n node enables various automation scenarios:
|
||||
|
||||
- **Web Scraping**: Extract data from websites on a schedule
|
||||
- **Form Filling**: Automate data entry across web applications
|
||||
- **Monitoring**: Check website status and capture visual evidence
|
||||
- **Report Generation**: Generate PDFs or screenshots of web dashboards
|
||||
- **Multi-step Processes**: Chain browser tasks together using session persistence
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter issues with the Browser Use node:
|
||||
|
||||
- Verify your API key is valid and has sufficient credits
|
||||
- Check that your instructions are clear and specific
|
||||
- For complex tasks, consider breaking them into multiple steps
|
||||
- Refer to the [Browser Use documentation](https://docs.browser-use.com) for instruction best practices
|
||||
|
||||
## Resources
|
||||
|
||||
- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
|
||||
- [Browser Use Documentation](https://docs.browser-use.com)
|
||||
- [Browser Use Cloud](https://cloud.browser-use.com)
|
||||
- [n8n-nodes-browser-use GitHub Repository](https://github.com/draphonix/n8n-nodes-browser-use)
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: "Roadmap"
|
||||
description: "Future plans and upcoming features for Browser Use"
|
||||
icon: "road"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
Big things coming soon!
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: "Contribution Guide"
|
||||
description: ""
|
||||
icon: "handshake"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
## Mission
|
||||
|
||||
- Make developers happy
|
||||
- Do more clicks than human
|
||||
- Tell your computer what to do, and it gets it done.
|
||||
- Make agents faster and more reliable.
|
||||
|
||||
|
||||
## What to work on?
|
||||
|
||||
- This space is moving fast. We have 10 ideas daily. Let's exchange some.
|
||||
- Browse our [GitHub Issues](https://github.com/browser-use/browser-use/issues)
|
||||
- Check out our most active issues on [Discord](https://discord.gg/zXJJHtJf3k)
|
||||
- Get inspiration in [`#showcase-your-work`](https://discord.com/channels/1303749220842340412/1305549200678850642) channel
|
||||
|
||||
|
||||
## What makes a great PR?
|
||||
|
||||
1. Why do we need this PR?
|
||||
2. Include a demo screenshot/gif
|
||||
3. Make sure the PR passes all CI tests
|
||||
4. Keep your PR focused on a single feature
|
||||
|
||||
|
||||
## How?
|
||||
1. Fork the repository
|
||||
2. Create a new branch for your feature
|
||||
3. Submit a PR
|
||||
|
||||
We are overwhelmed with Issues. Feel free to bump your issues/PRs with comments periodically if you need faster feedback.
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: "Local Setup"
|
||||
description: "We're excited to have you join our community of contributors. "
|
||||
icon: "laptop-code"
|
||||
mode: "wide"
|
||||
---
|
||||
|
||||
## Welcome to Browser Use Development!
|
||||
|
||||
```bash
|
||||
git clone https://github.com/browser-use/browser-use
|
||||
cd browser-use
|
||||
uv sync --all-extras --dev
|
||||
# or pip install -U git+https://github.com/browser-use/browser-use.git@main
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Set up your environment variables:
|
||||
|
||||
```bash
|
||||
# Copy the example environment file
|
||||
cp .env.example .env
|
||||
|
||||
# set logging level
|
||||
# BROWSER_USE_LOGGING_LEVEL=debug
|
||||
```
|
||||
|
||||
|
||||
## Helper Scripts
|
||||
For common development tasks
|
||||
```bash
|
||||
# Complete setup script - installs uv, creates a venv, and installs dependencies
|
||||
./bin/setup.sh
|
||||
|
||||
# Run all pre-commit hooks (formatting, linting, type checking)
|
||||
./bin/lint.sh
|
||||
|
||||
# Run the core test suite that's executed in CI
|
||||
./bin/test.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Run examples
|
||||
|
||||
```bash
|
||||
uv run examples/simple.py
|
||||
```
|
||||
Reference in New Issue
Block a user