Getting Started with Amazon Bedrock AgentCore Browser Tool
Introduction
AI agents become significantly more useful when they can browse the web. Instead of relying solely on a model’s training data, you can give your agent the ability to navigate to specific URLs, interact with page elements, and extract content from web pages in real time.
The Amazon Bedrock AgentCore Browser Tool provides a managed, secure, cloud-based browser runtime on AWS infrastructure. When an agent needs to access a web page, it opens a remote browser session, navigates to the target URL, and interacts with the page just as a human would. The session is isolated and automatically cleaned up when done.
This article is part of a series I am writing about different aspects of Amazon Bedrock AgentCore. Here, we focus on how to use the Browser Tool to give agents the ability to navigate and extract content from web pages. For a broader understanding of AgentCore and its components, check out the other articles in this series:
- Getting Started with Amazon Bedrock AgentCore Harness and Runtime
- Getting Started with Amazon Bedrock AgentCore Code Interpreter
- Getting Started with Amazon Bedrock AgentCore Gateway
- Getting Started with Observability for Amazon Bedrock AgentCore
- Getting Started with Amazon Bedrock AgentCore Web Search Tool
In this article, we explore the Browser Tool from two perspectives:
- First, we invoke the tool locally using the Strands Agents SDK, demonstrating how developers can use it in isolation outside of a Harness.
- Then, we connect the tool to the car dealership Harness introduced in the first article and let the AI agent use it autonomously.
What is the Browser Tool?
The AgentCore Browser Tool provides a managed, secure, cloud-based browser runtime on AWS infrastructure. Unlike the Web Search Tool (covered in the previous article), which searches the web and returns results, the Browser Tool navigates to a specific URL and interacts with the page directly.
Key capabilities:
- Navigate to any URL
- Read page content and extract text
- Click elements, fill forms, and interact with the page
- Take screenshots
- Handle authentication flows
- Session recording for debugging
You can use the system default browser or create a custom Browser Tool with specific configurations (such as a browser profile for persisting cookies across sessions).
Use the Browser Tool when you know the URL and need to extract specific content, fill forms, or interact with web applications.
Prerequisites
- AWS account with credentials configured
- Python 3.12 installed (Python 3.14 has known compatibility issues with Playwright)
- IAM user or role with permissions to use Amazon Bedrock AgentCore Browser and invoke Bedrock models
- Model access enabled for Amazon Nova Pro in the Amazon Bedrock console
- AWS Region where AgentCore is available (us-east-1, us-west-2, ap-southeast-2, or eu-central-1)
Step 1: Clone the Repository and Install Dependencies
Clone the companion repository and set up the Python environment:
git clone https://github.com/biagolini/PythonAwsBedrockAgentCoreBrowserTool.git
cd PythonAwsBedrockAgentCoreBrowserTool
python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtOn Windows, replace the activation command with .venv\Scripts\activate.
Step 2: Create the Browser Tool Execution Role
Before creating the Browser Tool, you need an IAM role that allows the AgentCore Browser service to access resources on your behalf (such as writing session recordings to S3).
2.1. Navigate to IAM > Roles in the AWS Console
2.2. Click Create role
2.3. Select Custom trust policy and enter the following trust policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AssumeRolePolicy",
"Effect": "Allow",
"Principal": {
"Service": "bedrock-agentcore.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"aws:SourceAccount": "<your-account-id>"
},
"ArnLike": {
"aws:SourceArn": "arn:aws:bedrock-agentcore:<your-region>:<your-account-id>:*"
}
}
}
]
}2.4. Click Next. Skip managed policies for now. Click Next.
2.5. In the Role name field, enter AgentCoreBrowser-S3-Recording
2.6. Click Create role
2.7. After creation, open the role and click Add permissions > Create inline policy. Select the JSON tab and enter the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "S3Permissions",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:ListMultipartUploadParts",
"s3:AbortMultipartUpload"
],
"Resource": [
"arn:aws:s3:::<your-recording-bucket-name>",
"arn:aws:s3:::<your-recording-bucket-name>/*"
]
},
{
"Sid": "CloudWatchLogsPermissions",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams"
],
"Resource": "*"
}
]
}Replace <your-recording-bucket-name> with the S3 bucket name you plan to use for session recordings. If you do not plan to enable recording, you can omit the S3 permissions and keep only the CloudWatch Logs permissions.
2.8. Click Next, name the policy AgentCoreBrowser-S3-RecordingPolicy, and click Create policy
Step 3: Create a Browser Tool in the Console
Before your agent can browse the web, you need to create a Browser Tool resource. You can use the system default browser (no setup required) or create a custom one for additional control.
3.1 Navigate to Browser Tool
3.1.1. Open the Amazon Bedrock AgentCore console
3.1.2. In the left navigation pane, under Built-in tools, click Browser
3.1.3. Click the Create button
3.2 Configure the Browser Tool
3.2.1. In the Browser name field, enter a name for your browser (example: browser_tool_demo). Valid characters are a-z, A-Z, 0-9, hyphen, and underscore.
3.2.2. Optionally, configure a recording S3 bucket to save session recordings for debugging. This is useful during development to see exactly what the browser did during a session.
3.2.3. Under Permissions, select Use an existing role and choose the AgentCoreBrowser-S3-Recording role created in Step 2.
3.2.4. Leave remaining settings at their defaults.
Get Carlos Biagolini’s stories in your inbox
Join Medium for free to get updates from this writer.
3.2.5. Click Create
3.3 Copy the Browser Tool ID
After creation, the console displays the browser details page. Copy the Browser ID value. You will use this identifier in all API calls.
Step 4: Test the Browser Tool Locally
The script browser_agent.py demonstrates how to use the Browser Tool with the Strands Agents SDK. It creates an agent that navigates to the AgentCore documentation page and extracts a summary.
4.1 Configure Environment Variables
Copy the example environment file and add your Browser Tool ID:
cp .env.example .envEdit .env:
AWS_REGION=us-east-1
BROWSER_ID=<your-browser-tool-id>4.2 Understanding the Script
import os
import sys
import logging
import warnings
from dotenv import load_dotenv
# Suppress asyncio and Playwright noise
logging.getLogger("asyncio").setLevel(logging.CRITICAL)
warnings.filterwarnings("ignore", category=DeprecationWarning)
load_dotenv()
REGION = os.getenv("AWS_REGION", "us-east-1")
BROWSER_ID = os.getenv("BROWSER_ID")
if not BROWSER_ID:
print("Error: BROWSER_ID not set in .env file")
sys.exit(1)
from strands import Agent
from strands.models.bedrock import BedrockModel
from strands_tools.browser import AgentCoreBrowser
browser_tool = AgentCoreBrowser(region=REGION, identifier=BROWSER_ID)
model = BedrockModel(
model_id="us.amazon.nova-pro-v1:0",
region_name=REGION,
)
agent = Agent(
model=model,
tools=[browser_tool.browser],
system_prompt=(
"You are a research assistant. You MUST use the browser tool to navigate "
"to URLs and read their content. Never answer from memory — always use "
"the browser tool to fetch the page content first, then summarize what you read."
),
)
prompt = (
"Use the browser tool to go to "
"https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html "
"and based on what you read on that page, provide a short explanation (3-4 sentences) "
"of what Amazon Bedrock AgentCore is and its main purpose."
)
print(f"Prompt: {prompt}\n")
try:
response = agent(prompt)
print("\n--- Agent Response ---")
print(response.message["content"][0]["text"])
except Exception as e:
print(f"\nError: {e}")
finally:
print("\nDone.")
os._exit(0)The key components are:
AgentCoreBrowserfromstrands_tools.browser— initializes the browser tool client with your custom Browser ID- The agent’s system prompt instructs it to always use the browser tool rather than answering from memory
- The prompt asks the agent to navigate to a specific URL and extract information
Note that we target an HTML documentation page rather than a PDF. Complex SPAs with heavy JavaScript and asynchronous rendering can sometimes cause issues with current library versions. Static or server-rendered pages provide the most reliable results. These limitations are expected to improve in future versions.
4.3 Run the Script
python browser_agent.pyExpected behavior:
Prompt: Use the browser tool to go to https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html and based on what you read on that page, provide a short explanation (3-4 sentences) of what Amazon Bedrock AgentCore is and its main purpose.
Tool #1: browser
Tool #2: browser
Tool #3: browser
...
--- Agent Response ---
Amazon Bedrock AgentCore is an agentic platform that enables developers to build, deploy, and operate highly effective agents securely at scale using any framework and foundation model. Its main purpose is to allow agents to take actions across tools and data with the right permissions and governance, run agents securely at scale, and monitor agent performance and quality in production without requiring infrastructure management.
Done.The agent invokes the browser tool multiple times (session initialization, navigation, content extraction) and returns an accurate summary based on the actual page content. The process exits cleanly after printing the response.
Step 5: Browser Sessions and Observability
After running the script, you can verify the browser session in the AgentCore console.
5.1 View Sessions
Navigate to Amazon Bedrock AgentCore > Built-in tools > Browser, select your browser, and check the Sessions tab. You will see the session that was created during the test, along with its status and duration.
5.2 Live View (Optional)
If you configured session recording, you can also access a live view of what the browser is doing during an active session. This is invaluable for debugging complex navigation scenarios.
Step 6: Integrating with the Harness
Now we connect the Browser Tool to the Harness so the agent can use it autonomously.
6.1 Edit the Harness to Add the Browser Tool
6.1.1. Navigate to Amazon Bedrock AgentCore > Harness
6.1.2. Click on your Harness name (car_agent) to open its details page
6.1.3. Click Edit in the top-right area
6.1.4. In the Tools section, enable Browser tool and select your custom browser (browser_tool_demo) from the dropdown
6.1.5. Click Save Harness and wait for the status to return to Ready
6.2 Test the Browser Tool via Harness
6.2.1. Once the Harness is Ready, click the Test Harness button
6.2.2. Before testing, check if the Session ID field already has a value from a previous test. If so, click New session and then Stop current session and create new session to start fresh. This avoids interference from previous conversation context.
6.2.3. Enter a prompt that requires URL navigation:
Use the browser to go to https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html and based on what you read on that page, provide a short explanation of what Amazon Bedrock AgentCore is.6.2.4. The agent will invoke the browser tool, navigate to the URL, read the page content, and return a summary. You should see indicators confirming the tool was used.
6.2.5. Optionally, try editing the Harness to use a different model and repeat the test. Different models may produce different results in terms of speed and accuracy.
Conclusion
In this article, you learned how to use the Amazon Bedrock AgentCore Browser Tool to give agents the ability to navigate and interact with web pages:
- The Browser Tool provides a managed, secure browser runtime that agents control to navigate URLs, interact with pages, and extract content. You created a custom Browser Tool, configured the Strands Agents SDK to use it, and demonstrated how the agent navigates to a documentation page and summarizes its content.
- Local invocation lets developers test the tool in isolation using the Strands Agents SDK with
AgentCoreBrowser. - Harness integration allows the agent to use the Browser Tool autonomously, deciding when to browse based on the conversation context.
The key takeaways are:
- Browser Tool is for targeted navigation. Use it when you know the URL and need to extract specific content, fill forms, or interact with web applications.
- Static pages work best. Complex SPAs with heavy JavaScript may cause issues with current versions. This is expected to improve over time.
- Model choice matters. Larger models produce more reliable tool invocations with fewer retries.
- Combine with Web Search. In a production agent, use the Web Search Tool to discover relevant pages, and the Browser Tool to navigate to those pages and extract detailed content.
References
Stay Connected
If you found this article helpful and want to learn more about AWS, cloud architecture, AI, infrastructure as code, and cloud security, follow the author for future content and tutorials:
- LinkedIn: https://www.linkedin.com/in/biagolini
- Medium: https://medium.com/@biagolini
- GitHub: https://github.com/biagolini
- YouTube (PT-BR): https://www.youtube.com/@BiagoliniTech
- AWS Builder Center (PT-BR): https://builder.aws.com/community/@cbiagolini
Stay tuned for more practical walkthroughs and solutions for cloud infrastructure and DevOps challenges.
Happy building on AWS! 🚀☁️










