AgentCore#
AWS Bedrock AgentCore 提供带 SigV4 认证的云浏览器会话。当你在 AWS 环境中运行 agent-browser,或者需要由 AWS 基础设施托管的云浏览器时,可以使用它。
设置#
Credentials are automatically resolved from:
- Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - AWS CLI (
aws configure export-credentials) which supports SSO, profiles, IAM roles, etc.
agent-browser -p agentcore open https://example.comOr use environment variables for CI/scripts:
export AGENT_BROWSER_PROVIDER=agentcore
agent-browser open https://example.comThe -p flag takes precedence over AGENT_BROWSER_PROVIDER.
配置#
| Variable | Description | Default |
|---|---|---|
AGENTCORE_REGION | AWS region for the AgentCore endpoint | us-east-1 |
AGENTCORE_BROWSER_ID | Browser identifier | aws.browser.v1 |
AGENTCORE_PROFILE_ID | Browser profile for persistent state (cookies, localStorage) | (none) |
AGENTCORE_SESSION_TIMEOUT | Session timeout in seconds | 3600 |
AWS_PROFILE | AWS CLI profile for credential resolution | default |
AWS_ACCESS_KEY_ID | AWS access key (checked before AWS CLI fallback) | (none) |
AWS_SECRET_ACCESS_KEY | AWS secret key | (none) |
AWS_SESSION_TOKEN | Temporary session token (for STS/SSO credentials) | (none) |
浏览器配置文件#
使用 AGENTCORE_PROFILE_ID 可在会话之间持久保存浏览器状态(cookies、localStorage):
AGENTCORE_PROFILE_ID=my-profile agent-browser -p agentcore open https://example.comWhen a profile is set, AgentCore stores and restores browser state automatically between sessions.
实时视图#
When a session starts, AgentCore prints a Live View URL to stderr:
Session: abc123-def456
Live View: https://us-east-1.console.aws.amazon.com/bedrock-agentcore/browser/aws.browser.v1/session/abc123-def456#在浏览器中打开此 URL,即可从 AWS Console 实时观看代理会话。
凭据解析#
AgentCore uses lightweight manual SigV4 signing (no AWS SDK dependency). Credentials are resolved in order:
- Environment variables (
AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEY, optionallyAWS_SESSION_TOKEN) - AWS CLI (
aws configure export-credentials --format env), which supports SSO, IAM roles, credential files, and profiles
If using SSO, run aws sso login before launching agent-browser. Set AWS_PROFILE to select a specific named profile.
示例#
# Basic usage (credentials auto-resolved via AWS CLI)
agent-browser -p agentcore open https://example.com
# With a browser profile for persistent login state
AGENTCORE_PROFILE_ID=my-profile agent-browser -p agentcore open https://x.com/home
# With explicit region
AGENTCORE_REGION=eu-west-1 agent-browser -p agentcore open https://example.com
# With SSO profile
AWS_PROFILE=my-sso-profile agent-browser -p agentcore open https://example.com启用后,agent-browser 会连接到 AgentCore 云浏览器会话,而不是启动本地浏览器。所有命令的行为都相同。