This project is tailored for the AWS Community event workshop.
Hands-on Workshop: Using Browser-Use SDK with Amazon Bedrock AgentCore Browser Tool to automate browsers with Live View
- Overview
- Architecture
- Technology Stack
- Prerequisites
- Installation
- Usage
- Configuration
- Troubleshooting
- Contributing
- License
- Contact
- Acknowledgments
Amazon Bedrock AgentCore Browser Tool provides AI agents with a secure, fully managed way to interact with websites just like humans do. It allows agents to navigate web pages, fill out forms, and complete complex tasks without requiring developers to write and maintain custom automation scripts.
Provides AI agents with a secure, fully managed way to interact with websites, allowing navigation, form filling, and complex task completion without requiring custom automation scripts.
Provides VM-level isolation with 1:1 mapping between user session and browser session, offering enterprise-grade security. Each browser session runs in an isolated sandbox environment to meet enterprise security needs.
Supports various AI models and frameworks while providing natural language abstractions for browser actions through tools like interact(), parse(), and discover(), making it particularly suitable for enterprise environments.
A browser tool sandbox is a secure execution environment that enables AI agents to safely interact with web browsers. When a user makes a request:
- LLM Selection: Large Language Model (LLM) selects appropriate tools and translates commands
- Sandbox Execution: Commands are executed within a controlled sandbox environment containing a headless browser and hosted library server (using tools like Playwright)
- Security Isolation: Sandbox provides isolation and security by containing web interactions within a restricted space, preventing unauthorized system access
- Feedback Loop: Agent receives feedback through screenshots and can perform automated tasks while maintaining system security
┌─────────────────┐
│ User Prompt │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Browser-Use │
│ Agent │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌──────────────────┐
│ Bedrock │◄─────►│ Live Viewer │
│ AgentCore │ │ (DCV Server) │
│ Browser Tool │ └──────────────────┘
└─────────────────┘
- AWS Bedrock AgentCore: Generative AI agents.
- Python 3.11+: Core programming language.
- Browser-Use SDK: Browser automation.
- Playwright: Headless browser control.
- Amazon DCV: Remote visualization.
- Python: 3.11 or higher
- AWS Account: With access to Amazon Bedrock AgentCore
- AWS Credentials: Properly configured (AWS CLI or environment variables)
Your IAM role/user needs the following permissions:
- Access to Amazon Bedrock AgentCore Browser Tool
- See details at: Browser Tool Credentials Configuration
All dependencies are listed in requirements.txt:
bedrock-agentcore- Amazon Bedrock AgentCore SDKbrowser-use- Browser-Use SDK for browser automationboto3- AWS SDK for Pythonrich- Terminal formattingfastapi&uvicorn- Web server for live viewer- And other packages...
git clone <repository-url>
cd BedrockAgentCoreYou can create a virtual environment using one of the following methods:
# Install uv (if not already installed)
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Then create venv
uv venv --python 3.13
# Or specify a specific Python version
uv venv --python 3.11
# Activate venv
.venv\Scripts\activateNote: uv will automatically detect the Python interpreter and create venv faster than standard venv.
# Windows
python -m venv .venv
.venv\Scripts\activate
# Linux/Mac
python3 -m venv .venv
source .venv/bin/activateAfter activating the virtual environment, install the required packages:
# Upgrade pip
pip install --upgrade pip
# Install all dependencies from requirements.txt
pip install --force-reinstall -U -r requirements.txtNote: If you're using uv, you can install faster:
# Use uv to install (faster than pip)
uv pip install -r requirements.txtThe Amazon DCV Web Client SDK is required for the live browser viewer. Install it using the automated script:
python install_dcv_sdk.pyThis script will:
- Download the DCV SDK from AWS
- Automatically select the UMD build (required for browsers without ES Modules) and install it to
static/dcvjs/ - Verify the installation
static/dcvjs/is generated content and is now ignored via.gitignore. Feel free to delete that directory and re-run the installer at any time.
Manual Installation (Alternative):
If the automated script fails, you can manually install:
-
Download DCV SDK:
# Download the SDK curl -O https://d1uj6qtbmh3dt5.cloudfront.net/webclientsdk/nice-dcv-web-client-sdk-1.9.100-952.zip -
Extract and copy files:
# Extract the zip file unzip nice-dcv-web-client-sdk-1.9.100-952.zip # Copy dcvjs-umd contents to static/dcvjs/ mkdir -p static/dcvjs cp -r nice-dcv-web-client-sdk-*/dcvjs-umd/* static/dcvjs/
-
Verify installation:
# Check that dcv.js exists ls -lh static/dcvjs/dcv.js # Should show a file > 100KB
Expected Directory Structure:
static/
└── dcvjs/
├── dcv.js
├── dcv/
│ ├── broadwayh264decoder-worker.js
│ ├── jsmpegdecoder-worker.js
│ ├── lz4decoder-worker.js
│ └── microphoneprocessor.js
└── lib/
├── broadway/
├── jsmpeg/
└── lz4/
# Using AWS CLI
aws configure
# Or set environment variables
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-west-2This workshop uses Jupyter Notebook: Bedrock_AgentCore_Browser-use_LiveView.ipynb
The notebook contains:
- Step-by-step detailed instructions
- Code cells to run directly
- Workflow and architecture explanations
- Real-world examples of browser automation
Notebook Structure:
- Overview & Prerequisites - Introduction and system requirements
- Installation - Installing dependencies and patching browser-use
- Main Script - Main code to run browser automation with live view
- Execution - Instructions for running and viewing results
# In the activated virtual environment
pip install jupyter jupyterlabjupyter notebook Bedrock_AgentCore_Browser-use_LiveView.ipynbOr use JupyterLab (more modern interface):
jupyter lab Bedrock_AgentCore_Browser-use_LiveView.ipynb-
Cell 1: Install dependencies
!pip install --force-reinstall -U -r requirements.txt
-
Cell 2: Install DCV SDK (Required for live viewer)
# This script will download and install the Amazon DCV Web Client SDK !python install_dcv_sdk.py
-
Cell 3: Run patch script for browser-use
# This script will automatically patch browser_use to be compatible with Bedrock AgentCore !python patch_browser_use.py
-
Cell 4: Restart kernel (if needed)
import IPython IPython.Application.instance().kernel.do_shutdown(True)
-
Cell 5: Run script with your prompt
!python live_view_with_browser_use.py --prompt "Search for macbooks on amazon.com and extract the details of the first one"
- Script will automatically open browser viewer at
http://localhost:8000 - You can view the browser session running in real-time
- You can control Take/Release control from the web interface
python live_view_with_browser_use.py --prompt "Your task description here" --region us-west-2Parameters:
--prompt(required): Natural language task description--region(optional): AWS region, defaults tous-west-2
Examples:
# Search for products on Amazon
python live_view_with_browser_use.py --prompt "Search for macbooks on amazon.com and extract the details of the first one"
# Fill out registration form
python live_view_with_browser_use.py --prompt "Navigate to example.com and fill out the contact form with test data"
# Collect data
python live_view_with_browser_use.py --prompt "Go to news website and extract the top 5 headlines"See Prerequisites and Installation for credential setup.
Refer to .env.example (if available) for required environment variables.
Solution:
- Run the DCV SDK installer:
python install_dcv_sdk.py - Or manually download and install DCV SDK (see Step 4 in Installation section)
- Verify that
static/dcvjs/dcv.jsexists and is > 100KB in size - Check that the directory structure matches the expected layout
- If you need to refresh the SDK, simply delete
static/dcvjs/and runpython install_dcv_sdk.pyagain (the folder is ignored by git)
Solution:
- Ensure you have cloned the complete repository, including the
interactive_toolsdirectory - Or create the
browser_viewer.pyfile in theinteractive_tools/directory with theBrowserViewerServerclass - Note:
browser_viewer.pyshould be in the root directory of the project
Solution:
- Increase timeout in
BrowserProfile(currently 1500 seconds) - Check network connection and AWS credentials
Solution:
- Ensure
BrowserClienthas been started successfully - Check WebSocket URL and headers from
generate_ws_headers() - Ensure the patch script has run successfully
Solution:
# Check credentials
aws sts get-caller-identity
# Or set environment variables
export AWS_ACCESS_KEY_ID=your_key
export AWS_SECRET_ACCESS_KEY=your_secret
export AWS_DEFAULT_REGION=us-west-2Solution:
- Check if port 8000 is already in use
- Manually open browser at
http://localhost:8000 - Check firewall settings
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
For support, please create an issue on the repository.
- Amazon Bedrock AgentCore team
- Browser-Use community
- Playwright team

