Using Browser Tool
Creating an AgentCore Browser
You can create a Browser Tool using the Amazon Bedrock AgentCore console, AWS CLI, or AWS SDK.
- Console
-
To create a Browser Tool using the console
-
Open the AgentCore console at https://console.aws.amazon.com/bedrock-agentcore/home#
. -
In the navigation pane, choose Built-in tools.
-
Choose Create browser tool.
-
Provide a unique Tool name and optional Description.
-
Under Network settings, choose Public network which allows access to public internet resources.
-
Under Session recording, you can enable recording of browser sessions to an S3 bucket for later review.
-
Under Permissions, specify an IAM execution role that defines what AWS resources the Browser Tool can access.
-
Choose Create.
-
- AWS CLI
-
To create a Browser Tool using the AWS CLI, use the
create-browsercommand:aws bedrock-agentcore-control create-browser \ --region <Region> \ --name "my-browser" \ --description "My browser for web interaction" \ --network-configuration '{ "networkMode": "PUBLIC" }' \ --recording '{ "enabled": true, "s3Location": { "bucket": "my-bucket-name", "prefix": "sessionreplay" } }' \ --execution-role-arn "arn:aws:iam::123456789012:role/my-execution-role" - Boto3
-
To create a Browser Tool using the AWS SDK for Python (Boto3), use the
create_browsermethod:Request Syntax
The following shows the request syntax:
response = cp_client.create_browser( name="my_custom_browser", description="Test browser for development", networkConfiguration={ "networkMode": "PUBLIC" }, executionRoleArn="arn:aws:iam::123456789012:role/Sessionreplay", clientToken=str(uuid.uuid4()), recording={ "enabled": True, "s3Location": { "bucket": "session-record-123456789012", "prefix": "replay-data" } } ) - API
-
To create a new browser instance using the API, use the following call:
# Using awscurl awscurl -X PUT \ "https://bedrock-agentcore-control.<Region>.amazonaws.com/browsers" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --service bedrock-agentcore \ --region <Region> \ -d '{ "name": "test_browser_1", "description": "Test sandbox for development", "networkConfiguration": { "networkMode": "PUBLIC" }, "recording": { "enabled": true, "s3Location": { "bucket": "<your-bucket-name>", "prefix": "sessionreplay" } }, "executionRoleArn": "arn:aws:iam::123456789012:role/my-execution-role" }'
Get AgentCore Browser tool
You can get information about the Browser tool in your account and view their details, status, and configurations.
- Console
-
To get information about the Browser tool using the console
-
Open the AgentCore console at https://console.aws.amazon.com/bedrock-agentcore/home#
. -
In the navigation pane, choose Built-in tools.
-
The browser tools are listed in the Browser tools section.
-
You can choose a tool that you created to view it's details such as name, ID, status, and creation date for each browser tool.
-
- AWS CLI
-
To get information about a Browser tool using the AWS CLI, use the
get-browsercommand:aws bedrock-agentcore-control get-browser \ --region <Region> \ --browser-id "<your-browser-id>" - Boto3
-
To get information about the Browser tool using the AWS SDK for Python (Boto3), use the
get_browsermethod:Request Syntax
The following shows the request syntax:
response = cp_client.get_browser( browserId="<your-browser-id>" ) - API
-
To get the browser tool using the API, use the following call:
# Using awscurl awscurl -X GET \ "https://bedrock-agentcore-control.<Region>.amazonaws.com/browsers/<your-browser-id>" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --service bedrock-agentcore \ --region <Region>
Listing AgentCore Browser tools
You can list all browser tools in your account to view their details, status, and configurations.
- Console
-
To list browser tools using the console
-
Open the AgentCore console at https://console.aws.amazon.com/bedrock-agentcore/home#
. -
In the navigation pane, choose Built-in tools.
-
The browser tools are listed in the Browser tools section.
-
You can view details such as name, ID, status, and creation date for each browser tool.
-
- AWS CLI
-
To list browser tools using the AWS CLI, use the
list-browserscommand:aws bedrock-agentcore-control list-browsers \ --region <Region>You can filter the results by type:
aws bedrock-agentcore-control list-browsers \ --region <Region> \ --type SYSTEMYou can also limit the number of results and use pagination:
aws bedrock-agentcore-control list-browsers \ --region <Region> \ --max-results 10 \ --next-token "<your-pagination-token>" - Boto3
-
To list browser tools using the AWS SDK for Python (Boto3), use the
list_browsersmethod:Request Syntax
The following shows the request syntax:
response = cp_client.list_browsers(type="CUSTOM") - API
-
To list browser tools using the API, use the following call:
# Using awscurl awscurl -X POST \ "https://bedrock-agentcore-control.<Region>.amazonaws.com/browsers" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --service bedrock-agentcore \ --region <Region>You can filter the results by type:
awscurl -X POST \ "https://bedrock-agentcore-control.<Region>.amazonaws.com/browsers?type=SYSTEM" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --service bedrock-agentcore \ --region <Region>You can also limit the number of results and use pagination:
awscurl -X POST \ "https://bedrock-agentcore-control.<Region>.amazonaws.com/browsers?maxResults=1&nextToken=<your-pagination-token>" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --service bedrock-agentcore \ --region <Region>
Deleting an AgentCore Browser
When you no longer need a browser tool, you can delete it to free up resources. Before deleting a browser tool, make sure to stop all active sessions associated with it.
- Console
-
To delete a Browser tool using the console
-
Open the AgentCore console at https://console.aws.amazon.com/bedrock-agentcore/home#
. -
Navigate to Built-in tools and select your browser tool.
-
Choose Delete from the Actions menu.
-
Confirm the deletion by typing the browser tool name in the confirmation dialog.
-
Choose Delete.
Note
You cannot delete a browser tool that has active sessions. Stop all sessions before attempting to delete the tool.
-
- AWS CLI
-
To delete a Browser tool using the AWS CLI, use the
delete-browsercommand:aws bedrock-agentcore-control delete-browser \ --region <Region> \ --browser-id "<your-browser-id>" - Boto3
-
To delete a Browser tool using the AWS SDK for Python (Boto3), use the
delete_browsermethod:Request Syntax
The following shows the request syntax:
response = cp_client.delete_browser( browserId="<your-browser-id>" ) - API
-
To delete a browser tool using the API, use the following call:
# Using awscurl awscurl -X DELETE \ "https://bedrock-agentcore-control.<Region>.amazonaws.com/browsers/<your-browser-id>" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ --service bedrock-agentcore-control \ --region <Region>