This example demonstrates using AgentCore Browser with the Strands Agents framework for web automation and research tasks.
- AWS-managed browser - No custom browser configuration needed
- Strands integration - Uses
strands_tools.browser.AgentCoreBrowser - Streaming responses - Real-time output via
agent.stream_async() - Financial analysis - Example use case for stock data extraction
strands-browser/
├── serverless.yml # Serverless configuration
├── agent.py # Strands agent with browser tool
├── pyproject.toml # Python dependencies
├── Dockerfile # Container configuration
├── test-invoke.py # Test script
└── README.md # This file
serverless deployAfter deployment, note the runtime endpoint URL from the output (the ARN is embedded in the URL path):
ai:
agents:
browserAgent: https://bedrock-agentcore.us-east-1.amazonaws.com/runtimes/arn:aws:bedrock-agentcore:us-east-1:123456789012:runtime/xxx/invocationsexport RUNTIME_ARN="arn:aws:bedrock-agentcore:us-east-1:123456789012:runtime/xxx"
python test-invoke.pyThis example uses the AWS-managed default browser. No ai.browsers configuration is needed in serverless.yml:
ai:
agents:
browserAgent: {} # Auto-detects DockerfileThe agent uses AgentCoreBrowser from strands_tools.browser:
from strands_tools.browser import AgentCoreBrowser
# Initialize browser (uses AWS-managed infrastructure)
browser_tool = AgentCoreBrowser(region="us-east-1")
# Create agent with browser capability (default: global.anthropic.claude-sonnet-5, override via MODEL_ID)
agent = Agent(
tools=[browser_tool.browser],
model=MODEL_ID
)Web Search:
Search for the latest news about AWS and summarize the top 3 headlines
Financial Analysis:
Analyze the Tesla stock page at https://www.marketwatch.com/investing/stock/tsla
and provide key financial metrics
Data Extraction:
Visit https://aws.amazon.com/about-aws/whats-new/ and list the 5 most recent announcements
If you need session recording, VPC access, or request signing, define a custom browser:
ai:
browsers:
customBrowser:
network:
mode: PUBLIC
recording:
enabled: true
s3Location:
bucket: my-recordings
prefix: sessions/
agents:
browserAgent: {}See the Browser documentation for full configuration options.
serverless remove- Browser Documentation - Full configuration reference
- Memory Example - Add conversation persistence
- Gateway Example - Add custom Lambda tools