Toolkit for navigating web with AWS browser with thread support.
This toolkit provides a set of tools for working with a remote browser and supports multiple threads by maintaining separate browser sessions for each thread ID. Browsers are created lazily only when needed.
BrowserToolkit(
self,
region: str = 'us-west-2',
)Example:
import asyncio
from langchain.agents import create_agent
from langchain_aws.tools import create_browser_toolkit
async def main():
# Create and setup the browser toolkit
toolkit, browser_tools = create_browser_toolkit(region="us-west-2")
# Create a ReAct agent using the browser tools
agent = create_agent(
"bedrock_converse:us.anthropic.claude-haiku-4-5-20251001-v1:0",
tools=browser_tools
)
# Create runnable config with thread ID
config = {
"configurable": {
"thread_id": "session123"
}
}
# Invoke the agent with a specific task using thread ID
result = await agent.ainvoke(
"Navigate to https://www.example.com and tell me the main heading "
"on the page.",
config=config
)
# Clean up browser resources when done
await toolkit.cleanup()
return result
# Run the example
asyncio.run(main())| Name | Type | Description |
|---|---|---|
region | str | Default: 'us-west-2'AWS region for the browser client |
| Name | Type |
|---|---|
| region | str |