Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

AWS Logo
Menu
Enhancing AI Agent Capabilities with Browser Use and Amazon Bedrock

Enhancing AI Agent Capabilities with Browser Use and Amazon Bedrock

Learn how to build AI agents with Browser Use and Amazon Bedrock to automate web interactions using GenAI, Playwright, and Claude for seamless automation.

Rajesh Sitaraman
Amazon Employee
Published Apr 1, 2025
AI-powered automation is changing how we interact with the web, but most solutions are either too complex or too rigid. Meet Browser Use, a simple yet powerful tool that lets AI agents seamlessly interact with websites. It extracts HTML, navigates elements, and supports multi-step workflows—all with an intuitive API.
Now, imagine combining this with Amazon Bedrock, AWS’s fully managed service for generative AI. With Bedrock’s foundation models and Browser Use’s automation capabilities, you can build intelligent agents that browse, extract data, and take action autonomously.
In this guide, I’ll show you how to integrate Browser Use with Amazon Bedrock, step by step. Get ready to unlock a new level of AI-driven browser automation! For setup details, check out the Browser Use documentation.

Use cases

One of the most practical applications of AI-powered browser automation is event planning. Let’s explore how we can use Amazon Bedrock with Browser Use to automate sports event searches on Google and find the best options based on specific user preferences.

Scenario 1: Finding Kids Sports Events in the City

Imagine a user wants to find Sports workshops/training events in San Francisco with the following constraints:
  1. Find particular Sports events like Volleyball in San Francisco.
  2. Type: Boot Camp, Workshop or Tryout trainings.
  3. Suitable for age group 11 to 15.
  4. Event location within 15 miles radius.
  5. Structured Output - List of sports events, formatted in a table with details like name, date, time, location, contact details, age group and cost.

Why Use Amazon Bedrock with Browser Use?

This task requires both structured reasoning and browser interaction:
  • Amazon Bedrock provides powerful generative AI models to interpret the user’s intent, extract key details, and structure the query for a browser-based agent.
  • Browser Use allows us to automate web interactions, extract flight details from Google Flights, and return results in the desired format.

Agent implementation

Configuring the Amazon Bedrock LLM

1
2
3
4
from langchain_aws import ChatBedrock
llm = ChatBedrock(
model_id="us.anthropic.claude-3-5-sonnet-20241022-v2:0",
)
Here, we use LangChain’s ChatBedrock to connect to Amazon Bedrock, selecting Claude 3.5 Sonnet as the foundation model. Amazon Bedrock provides fully managed foundation models, allowing seamless integration of LLMs (like Claude, Titan, or Mistral) into applications.
Claude 3.5 Sonnet is optimized for reasoning and task execution, making it a great choice for understanding flight search queries and structuring outputs.
Defining the Events Agent
1
2
from browser_use import Agent
import asyncio
We import Agent from browser_use and asyncio to handle asynchronous operations, and create agent.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
agent = Agent(
task="""
1. Find all volleyball events in San Francisco.
2. Events may be of the following types:
- Boot camp
- Workshop
- Tryout trainings
3. Find events suitable for age group 11 to 15.
4. All event should be in 15 miles radius.
5. Provide me the list of events with details like event name, date, time, location, contact details and age group.
6. Format result in a table.
"""
,
browser=Browser(config=BrowserConfig(headless=True)),
llm=llm,
)
Here’s what happens:
The task string is the core prompt given to the AI model.
  • It provides structured instructions for the sports event search.
  • Ensures the agent looks for Volleyball event in San Francisco within 11 to 15 age group and 15 miles radius.
  • Requests results in a structured table format.
The llm parameter connects the agent to Amazon Bedrock, enabling it to use Claude 3.5 for understanding and processing the task.

Running the Agent

Once you’ve cloned the GitHub repository (link below), navigate to the project directory and run:
uv run event.py
Agent Execution Console View
Image not found
Sports Event Agents Tasks
Response
Image not found
Sports Event Response

Scenario 2: Finding the Best Flights for a Vacation

The user is looking to book affordable flights from San Francisco (SFO) to Chennai (MAA). In the past, a headless browser was used to perform this search. This time, we will utilize the Chromium browser to observe the flight search process in action..
1
2
3
4
5
6
7
8
9
10
11
12
agent = Agent(
task="""
1. Find me low price flight from San Francisco to Chennai with shortest duration for my vacation.
2. I want to travel in last week of May and return in June 3rd week, any day is fine.
3. Economy or Economy plus is fine.
4. Use google.com/flights to find the flight.
5. Provide me the top 3 flights with the details like price, duration, and departure time.
6. Format result in a table with columns: Flight, Price, Duration, Departure Time, Return date.
7. Provide me the source link to book the flight.
"""
,
llm=llm,
)
Run the agent with below command,
uv run main.py
This command launches the Browser Use agent, powered by Amazon Bedrock’s Claude 3.5 Sonnet, and opens Google Flights in a Chromium browser using Playwright.
  1. Launches Chromium using Playwright.
  2. Navigates to Google Flights (https://www.google.com/flights).
  3. Inputs flight details based on the user’s prompt:
    • Departure: San Francisco (SFO)
    • Arrival: Chennai (MAA)
    • Departure Window: Last week of May
    • Return Window: Third week of June
    • Cabin Class: Economy / Economy Plus
    • Sorts by lowest price and shortest duration.
    • Extracts the top 3 flight details and formats them into a structured Markdown table.
    • Provides direct booking link for the selected flights.
Agent Execution Chrome View
Image not found
Agent Execution Chrome View

Response

Image not found
Agent Response

Conclusion

By combining the capabilities of Amazon Bedrock and Browser Use, you can develop advanced AI-driven browser automation applications. This integration allows for efficient handling of complex tasks, leveraging the strengths of both platforms to create robust and scalable solutions.

Reference

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments

Log in to comment