AWS bedrock-agentcore documentation change
Summary
Restructured documentation with detailed step-by-step instructions, added environment setup guidance, expanded code examples, and added live session monitoring details
Security assessment
Added documentation about live session monitoring with termination controls and IAM/permission verification steps. While these are security-adjacent features, there's no evidence of addressing a specific vulnerability. The changes primarily improve operational documentation rather than patching security issues.
Diff
diff --git a/bedrock-agentcore/latest/devguide/browser-building-agents.md b/bedrock-agentcore/latest/devguide/browser-building-agents.md index c654314ea..7725fc142 100644 --- a//bedrock-agentcore/latest/devguide/browser-building-agents.md +++ b//bedrock-agentcore/latest/devguide/browser-building-agents.md @@ -5 +5 @@ -# Building browser agents +# Using AgentCore Browser with other Browser libraries and tools @@ -14 +14 @@ You can build a browser agent using Nova Act to automate web interactions: -###### Install dependencies +###### Step 1: Install dependencies @@ -16 +16,13 @@ You can build a browser agent using Nova Act to automate web interactions: -Get Nova ACT API key at https://nova.amazon.com/act +Create a project folder (if you have not already): + + + mkdir agentcore-browser-quickstart + cd agentcore-browser-quickstart + python3 -m venv .venv + source .venv/bin/activate + +###### Note + +On Windows, use: `.venv\Scripts\activate` + +Install the required packages: @@ -20,0 +33,19 @@ Get Nova ACT API key at https://nova.amazon.com/act +These packages provide: + + * `bedrock-agentcore`: The SDK for Amazon Bedrock AgentCore tools including AgentCore Browser + + * `nova-act`: The SDK for Nova Act which includes the model and orchestrator for browser automation + + * `rich`: Library for rich text and beautiful formatting in the terminal + + * `boto3`: AWS SDK for Python (Boto3) to create, configure, and manage AWS services + + + + +###### Step 2: Get Nova Act API Key + +Navigate to [Nova Act](https://nova.amazon.com/act) page and generate an API key using your amazon.com credentials. (Note this currently works only for US based amazon.com accounts) + +Create a file named `nova_act_browser_agent.py` and add the following code: + @@ -74 +105 @@ The following Python code shows how to write a browser agent using Nova Act. For -###### Run the agent +###### Step 3: Run the agent @@ -80,0 +112,45 @@ Execute the script (Replace with your Nova Act API key in the command): +###### Expected output + +You should see the agent's response containing details of the common usecases of Amazon Bedrock AgentCore. The agent navigates the website, performs the search, and extracts the requested information. + +If you encounter errors, verify: + + * Your IAM role/user has the correct permissions + + * Your Nova Act API key is correct + + * Your AWS credentials are properly configured + + + + +###### Step 4: View the browser session live + +While your browser script is running, you can view the session in real-time through the AWS Console: + + 1. Open the [Amazon Bedrock AgentCore Browser Console](https://us-west-2.console.aws.amazon.com/bedrock-agentcore/builtInTools) + + 2. Navigate to **Built-in tools** in the left navigation + + 3. Select the Browser tool (for example, `AgentCore Browser Tool`, or your custom browser) + + 4. In the **Browser sessions** section, find your active session with status **Ready** + + 5. In the **Live view / recording** column, click the provided "View live session" URL + + 6. The live view opens in a new browser window, displaying the real-time browser session + + + + +The live view interface provides: + + * Real-time video stream of the browser session + + * Interactive controls to take over or release control from automation + + * Ability to terminate the session + + + + @@ -86 +162,15 @@ You can build an agent that uses the Browser Tool as one of its tools using the -###### Install dependencies +###### Step 1: Install dependencies + +Create a project folder (if you have not already): + + + mkdir agentcore-browser-quickstart + cd agentcore-browser-quickstart + python3 -m venv .venv + source .venv/bin/activate + +###### Note + +On Windows, use: `.venv\Scripts\activate` + +Install the required packages: @@ -88 +177,0 @@ You can build an agent that uses the Browser Tool as one of its tools using the -Run the following commands. @@ -89,0 +179 @@ Run the following commands. + pip install bedrock-agentcore strands-agents strands-agents-tools playwright nest-asyncio @@ -91,2 +181 @@ Run the following commands. - pip install strands-agents - pip install strands-agents-tools +These packages provide: @@ -94 +183 @@ Run the following commands. -###### Write a browser agent using Strands + * `bedrock-agentcore`: The SDK for Amazon Bedrock AgentCore tools including AgentCore Browser @@ -96 +185,14 @@ Run the following commands. -The following Python code shows how to write a browser agent using Strands + * `strands-agents`: The Strands agent framework + + * `strands-agents-tools`: The tools that the Strands agent framework offers including Browser tool + + * `playwright`: Python library for browser automation. Strands uses playwright for browser automation + + * `nest-asyncio`: Allows running asyncio event loops within existing event loops + + + + +###### Step 2: Create your agent with AgentCore Browser + +Create a file named `browser_agent.py` and add the following code: @@ -102,8 +204,2 @@ The following Python code shows how to write a browser agent using Strands - def create_agent(): - """Create and configure the Strands agent with AgentCoreBrowser""" - agent_core_browser = AgentCoreBrowser(region="us-west-2") - agent = Agent( - tools=[agent_core_browser.browser], - model="us.anthropic.claude-3-7-sonnet-20250219-v1:0", - ) - return agent + # Initialize the Browser tool + browser_tool = AgentCoreBrowser(region="us-west-2") @@ -111,2 +207,73 @@ The following Python code shows how to write a browser agent using Strands - # Initialize agent globally - strands_agent = create_agent() + # Create an agent with the Browser tool + agent = Agent(tools=[browser_tool.browser]) + + # Test the agent with a web search prompt + prompt = "what are the services offered by Bedrock AgentCore? Use the documentation link if needed: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html" + print(f"\\n\\nPrompt: {prompt}\\n\\n") + + response = agent(prompt) + print("\\n\\nAgent Response:") + print(response.message["content"][0]["text"]) + + +This code: + + * Initializes the Browser tool for your region + + * Creates an agent that can use the browser to interact with websites + + * Sends a prompt asking the agent to search AgentCore documentation and answer question + + * Prints the agent's response with the information found + + + + +###### Step 3: Run the agent + +Execute the script: + + + python browser_agent.py + +###### Expected output + +You should see the agent's response containing details about AgentCore services from the documentation. The agent navigates the website and extracts the requested information. + +If you encounter errors, verify: + + * Your IAM role/user has the correct permissions + + * You have model access enabled in the Amazon Bedrock console + + * Your AWS credentials are properly configured + + + + +###### Step 4: View the browser session live