AgentCore Browser
1. Overview
Amazon Bedrock AgentCore Browser๋ AI ์์ด์ ํธ๊ฐ ์น์ ํ์ํ๊ณ ์น ์ฝํ ์ธ ์ ์ ๊ทผํ ์ ์๋๋ก ํ๋ ์๋น์ค์ ๋๋ค. ์ด ์๋น์ค๋ฅผ ํตํด ์์ด์ ํธ๋ ์น์ฌ์ดํธ๋ฅผ ๋ฐฉ๋ฌธํ๊ณ , ์ฝํ ์ธ ๋ฅผ ๊ฒ์ํ๊ณ , ์น ํ์ด์ง์์ ์ ๋ณด๋ฅผ ์ถ์ถํ์ฌ ์ฌ์ฉ์์๊ฒ ๊ฐ์น ์๋ ์ ๋ณด๋ฅผ ์ ๊ณตํ ์ ์์ต๋๋ค. ์ฌ์ฉ์ ์ธ์ ๊ณผ ๋ธ๋ผ์ฐ์ ์ธ์ ๊ฐ 1:1 ๋งคํ์ ํตํด VM ์์ค์ ๊ฒฉ๋ฆฌ๋ฅผ ์ ๊ณตํ๋ฉฐ, ์ํฐํ๋ผ์ด์ฆ๊ธ ๋ณด์์ ๋ณด์ฅํฉ๋๋ค. ๊ฐ ๋ธ๋ผ์ฐ์ ์ธ์ ์ ๊ฒฉ๋ฆฌ๋ ์๋๋ฐ์ค ํ๊ฒฝ์์ ์คํ๋์ด ์ํฐํ๋ผ์ด์ฆ ๋ณด์ ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํฉ๋๋ค
์ฃผ์ ๊ธฐ๋ฅ
๋ณต์กํ ์น ์์ ์ํ ๋ฅ๋ ฅ: ์ฌ์ฉ์์ ์ง์์ ๋ฐ๋ผ ์์ด์ ํธ๊ฐ ์น์ฌ์ดํธ ํ์, ์์ ์์ฑ, ๋ฒํผ ํด๋ฆญ, ๋์ ์ฝํ ์ธ ํ์ฑ์ด ๊ฐ๋ฅํฉ๋๋ค.
์ฝํ ์ธ ์ถ์ถ: ์น ํ์ด์ง์์ ํ ์คํธ, ์ด๋ฏธ์ง, ๋งํฌ ๋ฑ์ ์ฝํ ์ธ ๋ฅผ ์ถ์ถํ ์ ์์ต๋๋ค.
์์ ํ ํ์: ๋ณด์ ์ ํ์ ์ค์ํ๋ฉด์ ์น ํ์์ ์์ ํ๊ฒ ์ํํฉ๋๋ค.
์ ๋ณด ์์ฝ: ๋ฐฉ๋ํ ์น ์ฝํ ์ธ ์์ ํต์ฌ ์ ๋ณด๋ฅผ ์ถ์ถํ๊ณ ์์ฝํ ์ ์์ต๋๋ค.
์คํฌ๋ฆฐ์ท ์บก์ฒ: Live View๋ฅผ ํตํ ์ค์๊ฐ ๊ฐ์์ฑ์ ์ ๊ณตํ๋ฉฐ ์น ํ์ด์ง์ ์คํฌ๋ฆฐ์ท์ ์บก์ฒํ์ฌ ์๊ฐ์ ์ ๋ณด๋ฅผ ์ถ์ถํ ์ ์์ต๋๋ค.
๋ชจ๋ธ ๋น์ข ์์ ํตํฉ: ๋ค์ํ AI ๋ชจ๋ธ๊ณผ ํ๋ ์์ํฌ๋ฅผ ์ง์ํ๋ฉฐ, interact(), parse(), discover() ๊ฐ์ ๋๊ตฌ๋ฅผ ํตํด ๋ธ๋ผ์ฐ์ ๋์์ ๋ํ ์์ฐ์ด ์ถ์ํ๋ฅผ ์ ๊ณตํ์ฌ ์ํฐํ๋ผ์ด์ฆ ํ๊ฒฝ์ ํนํ ์ ํฉํฉ๋๋ค. ์ด ๋๊ตฌ๋ ์ด๋ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์๋ ๋ธ๋ผ์ฐ์ ๋ช ๋ น์ ์คํํ ์ ์๊ณ Playwright, Puppeteer ๊ฐ์ ๋ค์ํ ์๋ํ ํ๋ ์์ํฌ๋ฅผ ์ง์ํฉ๋๋ค.
์ํคํ
์ฒ ๋ฐ ์๋ ๋ฐฉ์
๋ธ๋ผ์ฐ์ ๋๊ตฌ ์๋๋ฐ์ค๋ AI ์์ด์ ํธ๊ฐ ์น ๋ธ๋ผ์ฐ์ ์ ์์ ํ๊ฒ ์ํธ์์ฉํ ์ ์๋๋ก ํ๋ ์์ ํ ์คํ ํ๊ฒฝ์ ๋๋ค. ์ฌ์ฉ์๊ฐ ์์ฒญํ๋ฉด LLM(Large Language Model)์ด ์ ์ ํ ๋๊ตฌ๋ฅผ ์ ํํ๊ณ ๋ช ๋ น์ ๋ฒ์ญํฉ๋๋ค. ์ด๋ฌํ ๋ช ๋ น์ ํค๋๋ฆฌ์ค ๋ธ๋ผ์ฐ์ ์ Playwright์ ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ๋ ํธ์คํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์๋ฒ๊ฐ ํฌํจ๋ ์ ์ด๋ ์๋๋ฐ์ค ํ๊ฒฝ์์ ์คํ๋ฉ๋๋ค. ์๋๋ฐ์ค๋ ์ ํ๋ ๊ณต๊ฐ ๋ด์์ ์น ์ํธ์์ฉ์ ์ ํํ์ฌ ๋ฌด๋จ ์์คํ ์ ๊ทผ์ ๋ฐฉ์งํจ์ผ๋ก์จ ๊ฒฉ๋ฆฌ ๋ฐ ๋ณด์์ ์ ๊ณตํฉ๋๋ค. ์์ด์ ํธ๋ ์คํฌ๋ฆฐ์ท์ ํตํด ํผ๋๋ฐฑ์ ๋ฐ๊ณ ์์คํ ๋ณด์์ ์ ์งํ๋ฉด์ ์๋ํ๋ ์์ ์ ์ํํ ์ ์์ต๋๋ค. ์ด๋ฌํ ์ค์ ์ AI ์์ด์ ํธ์ ์์ ํ ์น ์๋ํ๋ฅผ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค.

AgentCore Browser๋ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์๋ํฉ๋๋ค:
์ฌ์ฉ์๊ฐ ์์ด์ ํธ์๊ฒ ์น์ฌ์ดํธ์์ ์ ๋ณด๋ฅผ ์ฐพ๋ ์ง๋ฌธ์ ํฉ๋๋ค.
์์ด์ ํธ๋ ์ง๋ฌธ์ ๋ถ์ํ๊ณ ์ด๋ค ์น์ฌ์ดํธ๋ฅผ ๋ฐฉ๋ฌธํด์ผ ํ๋์ง ๊ฒฐ์ ํฉ๋๋ค.
Browser ์๋น์ค๋ ํด๋น URL์ ๋ฐฉ๋ฌธํ๊ณ ํ์ด์ง๋ฅผ ๋ก๋ํฉ๋๋ค.
ํ์ด์ง ์ฝํ ์ธ ๊ฐ ์ถ์ถ๋๊ณ ๋ถ์๋ฉ๋๋ค.
ํ์ํ ๊ฒฝ์ฐ ์ถ๊ฐ ๋งํฌ๋ฅผ ํ์ํ๊ฑฐ๋ ๊ฒ์์ ์ํํฉ๋๋ค.
์ถ์ถ๋ ์ ๋ณด๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์ฌ์ฉ์์ ์ง๋ฌธ์ ๋ํ ์๋ต์ ์์ฑํฉ๋๋ค.
์ฌ์ฉ์์๊ฒ ์๋ต๊ณผ ํจ๊ป ์ถ์ฒ ์ ๋ณด๋ฅผ ์ ๊ณตํฉ๋๋ค.
๋ณด์, ๋คํธ์ํฌ ๋ฐ ๋ฆฌ์์ค ์ค์
๋นํธ์ธ Browser Tool์ ์ ๊ณตํ๋ฉฐ, ์ปค์คํ Browser Too ์์ฑ ์ ๋ ๊ฐ์ง ๋คํธ์ํฌ ๋ชจ๋๋ฅผ ์ ํํ ์ ์์ต๋๋ค.

Sandbox - ์ธ๋ถ ๋คํธ์ํฌ ์ก์ธ์ค๊ฐ ์๋ ๊ฒฉ๋ฆฌ๋ ํ๊ฒฝ (๊ฐ์ฅ ์์ ํ ๋ชจ๋)
Public network - ๊ณต์ฉ ์ธํฐ๋ท ๋ฆฌ์์ค์ ๋ํ ์ก์ธ์ค ํ์ฉ

2. Getting Started
Amazon Nova Act
Amazon Nova Act๋ ์น ๋ธ๋ผ์ฐ์ ๋ด์์ ์์ ์ ์ํํ๋๋ก ํ๋ จ๋ ์๋ก์ด AI ๋ชจ๋ธ์ ๋๋ค. ๊ฐ๋ฐ์๊ฐ ์น ๋ธ๋ผ์ฐ์ ์์ ์์ ์ ์๋ฃํ ์ ์๋ ์์ด์ ํธ๋ฅผ ๊ตฌ์ถํ ์ ์๋๋ก ํ๋ Amazon Nova Act SDK์ Research Preview๋ฅผ ์ถ์ํ์ต๋๋ค. (ํ์ฌ ์น์์ API key ๋ฐ๊ธ ๋ถ๊ฐ)
1. ํ์ด๋ธ๋ฆฌ๋ ์ ๊ทผ๋ฒ
์์ฐ์ด ์ง์์ ์ฝ๋ ๋ชจ๋๋ฅผ ์ฌ์ฉํ ๋ธ๋ผ์ฐ์ ์์ ์๋ํ ๋ช ๋ น ๊ตฌ์ถ
Python ์คํฌ๋ฆฝํ ๊ณผ Playwright ์๋ํ๋ฅผ ๋จ์ผ ์ธํฐํ์ด์ค์์ ๊ฒฐํฉ
2. Playwright ํตํฉ
Microsoft์์ ๊ฐ๋ฐํ ์คํ์์ค ๋ธ๋ผ์ฐ์ ์๋ํ ํ๋ ์์ํฌ์ธ Playwright์ ํตํฉ
๋น๋ฐ๋ฒํธ๋ ์ ์ฉ์นด๋ ์ธ๋ถ์ ๋ณด ๋ฑ ๋ฏผ๊ฐํ ์์ ์ฒ๋ฆฌ์ ํนํ ์ ์ฉ
3. ๋ณ๋ ฌ ์ฒ๋ฆฌ ์ง์
์ฌ๋ฌ ๋ธ๋ผ์ฐ์ ์ธ์ ์ผ๋ก ๋ณ๋ ฌ ์ฒ๋ฆฌ ์ง์ํ์ฌ ๋๊ธฐ ์๊ฐ์ ์ ๊ฑฐํ๊ณ ์ธ๊ฐ ์ญ๋์ ๋์ด์๋ ๋ฐ๋ณต ์์ ๊ฐ์ํ
Browser Use (ํ์ด์ฌ 3.11 ์ด์ ์๊ตฌ)
Install
> pip install browser-use
> playwright install chromium --with-deps --no-shell
Minimum example
import asyncio
from dotenv import load_dotenv
load_dotenv()
from browser_use import Agent
from browser_use.llm import ChatAWSBedrock
# Create ChatBedrockConverse once
llm = ChatAWSBedrock(
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
)
async def main():
agent = Agent(
task="Compare the price of Nova Pro and Claude Sonnet 4",
llm=llm,
)
await agent.run()
asyncio.run(main())
Browser tool usage with Browser-Use SDK
Browser ์๋๋ฐ์ค ํด๋ผ์ด์ธํธ ์ด๊ธฐํ
from bedrock_agentcore.tools.browser_client import BrowserClient
from browser_use import Agent, BrowserSession
from browser_use.browser import BrowserProfile
from browser_use.llm import ChatAWSBedrock
from rich.console import Console
from contextlib import suppress
import asyncio
from boto3.session import Session
console = Console()
boto_session = Session()
region = boto_session.region_name
client = BrowserClient(region)
client.start()
# Extract ws_url and headers
ws_url, headers = client.generate_ws_headers()
ํฌํผ ํจ์
async def run_browser_task(browser_session: BrowserSession, bedrock_chat: ChatAWSBedrock, task: str) -> None:
"""
Run a browser automation task using browser_use
Args:
browser_session: Existing browser session to reuse
bedrock_chat: Bedrock chat model instance
task: Natural language task for the agent
"""
try:
# Show task execution
console.print(f"\\n[bold blue]๐ค Executing task:[/bold blue] {task}")
# Create and run the agent
agent = Agent(
task=task,
llm=bedrock_chat,
browser_session=browser_session
)
# Run with progress indicator
with console.status("[bold green]Running browser automation...[/bold green]", spinner="dots"):
await agent.run()
console.print("[bold green]โ
Task completed successfully![/bold green]")
except Exception as e:
console.print(f"[bold red]โ Error during task execution:[/bold red] {str(e)}")
import traceback
if console.is_terminal:
traceback.print_exc()
Invoke
# Create persistent browser session and model
browser_session = None
bedrock_chat = None
try:
# Create browser profile with headers
browser_profile = BrowserProfile(
headers=headers,
timeout=1500000, # 150 seconds timeout
)
# Create a browser session with CDP URL and keep_alive=True for persistence
browser_session = BrowserSession(
cdp_url=ws_url,
browser_profile=browser_profile,
keep_alive=True # Keep browser alive between tasks
)
# Initialize the browser session
console.print("[cyan]๐ Initializing browser session...[/cyan]")
await browser_session.start()
# Create ChatBedrockConverse once
bedrock_chat = ChatAWSBedrock(
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
)
console.print("[green]โ
Browser session initialized and ready for tasks[/green]\\n")
task = "Search for a coffee maker on amazon.com and extract details of the first one" ## Modify the task to run other tasks
#task = "naver.com์์ ์ผํฐํ๋ ๊ตญ๋ฐฅ ๋ง์ง 3๊ตฐ๋ฐ๋ฅผ ์ฐพ์์ ์ ๋ฆฌํด ์ฃผ์ธ์."
await run_browser_task(browser_session, bedrock_chat, task)
finally:
# Close the browser session
if browser_session:
console.print("\\n[yellow]๐ Closing browser session...[/yellow]")
with suppress(Exception):
await browser_session.close()
console.print("[green]โ
Browser session closed[/green]")
Live-view browser tool with Browser-Use SDK
live_view_with_browser_use.py
from browser_use import Agent, BrowserSession
#from browser_use.browser.session import BrowserSession
from bedrock_agentcore.tools.browser_client import BrowserClient
from browser_use.browser import BrowserProfile
from browser_use.llm import ChatAWSBedrock
from rich.console import Console
from rich.panel import Panel
from contextlib import suppress
import argparse
import sys
sys.path.append("../interactive_tools")
from browser_viewer import BrowserViewerServer
import asyncio
from boto3.session import Session
console = Console()
boto_session = Session()
region = boto_session.region_name
async def run_browser_task(
browser_session: BrowserSession, bedrock_chat: ChatAWSBedrock, task: str
) -> None:
"""
Run a browser automation task using browser_use
Args:
browser_session: Existing browser session to reuse
bedrock_chat: Bedrock chat model instance
task: Natural language task for the agent
"""
try:
# Show task execution
console.print(f"\\n[bold blue]๐ค Executing task:[/bold blue] {task}")
# Create and run the agent
agent = Agent(task=task, llm=bedrock_chat, browser_session=browser_session)
# Run with progress indicator
with console.status(
"[bold green]Running browser automation...[/bold green]", spinner="dots"
):
await agent.run()
console.print("[bold green]โ
Task completed successfully![/bold green]")
except Exception as e:
console.print(f"[bold red]โ Error during task execution:[/bold red] {str(e)}")
import traceback
if console.is_terminal:
traceback.print_exc()
async def live_view_with_browser_use(prompt, region="us-west-2"):
"""
Main function that demonstrates live browser viewing with Agent automation.
Workflow:
1. Creates Amazon Bedrock AgentCore browser client in us-west-2 region
2. Waits for browser initialization (10-second required delay)
3. Starts DCV-based live viewer server on port 8000 with browser control
4. Configures multiple display size options (720p to 1440p)
5. Establishes browser session for AI agent automation via CDP WebSocket
6. Executes AI-driven tasks using Claude 3.5 Sonnet model
7. Properly closes all sessions and stops browser client
Features:
- Real-time browser viewing through web interface
- Manual take/release control functionality
- AI automation with browser-use library
- Configurable display layouts and sizes
"""
console.print(
Panel(
"[bold cyan]Browser Live Viewer[/bold cyan]\\n\\n"
"This demonstrates:\\n"
"โข Live browser viewing with DCV\\n"
"โข Configurable display sizes (not limited to 900ร800)\\n"
"โข Proper display layout callbacks\\n\\n"
"[yellow]Note: Requires Amazon DCV SDK files[/yellow]",
title="Browser Live Viewer",
border_style="blue",
)
)
try:
# Step 1: Create browser session
client = BrowserClient(region)
client.start()
ws_url, headers = client.generate_ws_headers()
# Step 2: Start viewer server
console.print("\\n[cyan]Step 3: Starting viewer server...[/cyan]")
viewer = BrowserViewerServer(client, port=8012)
viewer_url = viewer.start(open_browser=True)
# Step 3: Show features
console.print("\\n[bold green]Viewer Features:[/bold green]")
console.print(
"โข Default display: 1600ร900 (configured via displayLayout callback)"
)
console.print("โข Size options: 720p, 900p, 1080p, 1440p")
console.print("โข Real-time display updates")
console.print("โข Take/Release control functionality")
console.print("\\n[yellow]Press Ctrl+C to stop[/yellow]")
# Step 4: Use browser-use to interact with browser
# Create persistent browser session and model
browser_session = None
bedrock_chat = None
try:
# Create browser profile with headers
browser_profile = BrowserProfile(
headers=headers,
timeout=1500000, # 150 seconds timeout
)
# Create a browser session with CDP URL and keep_alive=True for persistence
browser_session = BrowserSession(
cdp_url=ws_url,
browser_profile=browser_profile,
keep_alive=True, # Keep browser alive between tasks
)
# Initialize the browser session
console.print("[cyan]๐ Initializing browser session...[/cyan]")
await browser_session.start()
# Create ChatBedrockConverse once
bedrock_chat = ChatAWSBedrock(
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
)
console.print(
"[green]โ
Browser session initialized and ready for tasks[/green]\\n"
)
task = prompt
await run_browser_task(browser_session, bedrock_chat, task)
finally:
# Close the browser session
if browser_session:
console.print("\\n[yellow]๐ Closing browser session...[/yellow]")
with suppress(Exception):
await browser_session.close()
console.print("[green]โ
Browser session closed[/green]")
except Exception as e:
console.print(f"\\n[red]Error: {e}[/red]")
import traceback
traceback.print_exc()
finally:
console.print("\\n\\n[yellow]Shutting down...[/yellow]")
if "client" in locals():
client.stop()
console.print("โ
Browser session terminated")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--prompt", required=True, help="Browser Search instruction")
parser.add_argument("--region", default="us-east-1", help="AWS region")
args = parser.parse_args()
asyncio.run(live_view_with_browser_use(
args.prompt, args.region
))
์ฝ๋ ์คํ
uv run python live_view_with_browser_use.py --prompt "Search for macbooks on amazon.com and extract the details of the first one"


3. ๊ฒฐ๋ก
Amazon Bedrock AgentCore Browser๋ AI ์์ด์ ํธ๊ฐ ์น์ ํ์ํ๊ณ ์น ์ฝํ ์ธ ์ ์ ๊ทผํ ์ ์๋๋ก ํ๋ ๊ฐ๋ ฅํ ์๋น์ค์ ๋๋ค. ์ด ์๋น์ค๋ฅผ ํตํด ์์ด์ ํธ๋ ์น์ฌ์ดํธ๋ฅผ ๋ฐฉ๋ฌธํ๊ณ , ์ฝํ ์ธ ๋ฅผ ๊ฒ์ํ๊ณ , ์น ํ์ด์ง์์ ์ ๋ณด๋ฅผ ์ถ์ถํ์ฌ ์ฌ์ฉ์์๊ฒ ๊ฐ์น ์๋ ์ ๋ณด๋ฅผ ์ ๊ณตํ ์ ์์ต๋๋ค.
์์ ํ ํ์ ๊ธฐ๋ฅ๊ณผ ๋ค์ํ ๋ณด์ ์ ํ์ ํตํด ์์ด์ ํธ๊ฐ ์น์ ์์ ํ๊ฒ ํ์ํ ์ ์๋๋ก ๋ณด์ฅํ๋ฉฐ, ์ธํฐ๋ํฐ๋ธ ํ์๊ณผ ์ ๋ณด ์์ฝ ๊ธฐ๋ฅ์ ํตํด ์ฌ์ฉ์์ ์ง๋ฌธ์ ๋ํ ์ ํํ ๋ต๋ณ์ ์ ๊ณตํ ์ ์์ต๋๋ค.
๋ค๋ฅธ AgentCore ์๋น์ค(Runtime, Memory, Code Interpreter, Gateway, Observability ๋ฑ)์ ํจ๊ป ์ฌ์ฉํ๋ฉด ์์ด์ ํธ์ ๊ธฐ๋ฅ์ ํฌ๊ฒ ํ์ฅํ์ฌ ๋ ์ง๋ฅ์ ์ด๊ณ ์ ์ฉํ ์์ด์ ํธ๋ฅผ ๊ตฌ์ถํ ์ ์์ต๋๋ค.
Last updated
Was this helpful?