AWS ML ★ 94 4 min

Building agents that transact with Anchor Browser and AgentCore payments

Amazon Bedrock AgentCoreCustomer SolutionsIntermediate (200)

🔗 https://aws.amazon.com/blogs/machine-learning/building-agents-that-transact-with-anchor-browser-and-agentcore-payments/

📌 AI代理自動付費瀏覽:AWS用x402解開402卡關

TL;DR:AWS讓Anchor Browser代理透過AgentCore payments自動完成x402付費請求,無需人工介入也不碰觸私鑰。

當AI agent嘗試存取按次計價的研究API或付費內容,伺服器回的不是資料,而是一個HTTP 402 Payment Required。沒有錢包、沒有預算、沒有付款邏輯的agent,任務就這樣卡住,等人來處理。

🤔 402卡關背後,是整套自建支付堆疊的工程負擔

x402是一種開放標準,讓伺服器透過402狀態碼回傳金額、可接受的付款方式與收款地址,由請求方完成交易。問題是,目前開發者必須自己把整套支付堆疊塞進agent裡:錢包、私鑰、預算控制、簽署付款證明、附加付款標頭、重試邏輯、結算、記錄,每一項都要自己寫、自己保護、自己維護。

這不只是工程量問題,還牽涉三個安全風險:一是失控支出,沒有在基礎設施層強制預算上限,一個bug、重試迴圈或prompt injection就可能觸發連續扣款;二是私鑰外洩,私鑰若留在agent執行環境裡,就和不受信任的網頁、第三方工具共享同一執行空間;三是簽署流程暴露,若簽署基礎設施可從執行環境直接存取,攻擊者可能嘗試竊取金鑰或將付款導向未授權地址。對瀏覽器型agent來說,還有一個額外限制:付款必須發生在同一個瀏覽器session內,否則session recording和live view會和實際執行的流程不一致。

🧩 把敏感操作搬出agent,留在Anchor Browser裡的只剩兩個元件

Anchor Browser是專為AI agent打造的雲端瀏覽器自動化方案,每個agent session跑在受管理的瀏覽器環境裡,維持登入狀態、處理導航、擷取網路請求,並提供即時的頁面互動畫面。Amazon Bedrock AgentCore payments則是AgentCore裡的全託管支付能力,讓AI agent能自主探索、存取並付費使用API、MCP伺服器與網頁內容。

這個整合的核心是Payment Manager,建立時指定authorizer類型與IAM角色,AgentCore會配置對應的workload identity於Amazon Bedrock AgentCore Identity。錢包金鑰與私鑰留在AgentCore payments與設定好的錢包供應商(如Coinbase CDP或Stripe Privy)手上,從不進入agent執行環境。端點探索則透過Amazon Bedrock AgentCore Gateway串接Coinbase x402 Bazaar MCP伺服器,讓agent能用程式化方式找到可用的付費x402端點。

結果是,Anchor Agent端只保留兩個跟付款相關的元件:一個budget session,一個x402工具。認證、錢包密鑰、付款上限、觀測性與付款證明簽署,全部移到AgentCore payments這個受管理層。

開發者只需要做一件事:把session的session.x402屬性設為true(預設為false)。啟用後,瀏覽器session就能在同一個session內自動存取x402保護的網站,付款由AgentCore payments簽署並重試,自動化程式碼完全不需要寫入錢包金鑰或付款標頭,透過Chrome DevTools Protocol連線後,agent就像平常一樣導航即可。

🎯 對工程師的意義:少一套支付堆疊要維護,但多一個真實金流的開關

這套整合最直接的價值,是把付款的安全邊界從agent runtime移到受管理的基礎設施層,開發者不用再自己處理私鑰保管、重試邏輯和觀測性。但也要記住,啟用session.x402等同授權瀏覽器用設定好的付款工具做真實扣款,預算上限與監控(AgentCore透過CloudWatch提供付款嘗試、核准、拒絕與結算的可視性)就是唯一的防線,上線前務必設定好。

🔗 來源

#AWS #AIAgents #AgentCore #x402Protocol #AnchorBrowser #MachineToMachinePayments #AutonomousAgents #CloudSecurity #APIEconomy #AgenticAI

原始資料 AWS ML · 收集於 2026-10-13
來源原標題
Building agents that transact with Anchor Browser and AgentCore payments
作者
Cher Simon
原始標籤
Amazon Bedrock AgentCore · Customer Solutions · Intermediate (200)
原始連結
https://aws.amazon.com/blogs/machine-learning/building-agents-that-transact-with-anchor-browser-and-agentcore-payments/

摘要原文

AI agents increasingly need to access web resources that are priced per request. For example, premium datasets charge by the query, research APIs meter by the call, and paywalled publishers gate content behind payment. When an AI agent encounters one of these resources, the server returns HTTP 402 Payment Required. The agent has no built-in payment mechanism, no budget attached to the session, and no programmatic way to satisfy the request. The task stalls and requires manual intervention. Anchor Browser with Agentic Payments handles machine-to-machine payment workflows on behalf of the agent. Developed in collaboration with the AWS Generative AI Innovation Center Partner Agent Factory , it’s now available on AWS Marketplace . This post covers how Anchor Browser integrates with Amazon Bedrock AgentCore payments so that AI agents can pay for x402-protected pages and APIs autonomously. The x402 protocol is an open standard for HTTP-based machine-to-machine payments. A server responds with 402 Payment Required along with the amount, accepted payment methods, and payment address that the agent uses to complete the transaction. Anchor Browser is a cloud-based browser automation solution purpose-built for AI agents. Each agent session runs inside a managed browser environment that maintains authentication state, handles navigation, captures network requests, and provides a live view of page interactions. Amazon Bedrock AgentCore provides capabilities to build, connect, and optimize agents at scale. Amazon Bedrock AgentCore payments is a fully managed capability within AgentCore that AI agents can use to discover, access, and pay for APIs, Model Context Protocol (MCP) servers, and web content autonomously. AgentCore payments manages wallet connectivity, enforces configurable spending limits at the infrastructure layer, and processes payments through the x402 protocol. It also provides observability into payment attempts, approvals, denials, and settlements through Amazon CloudWatch. When an agent running in Anchor Browser encounters a 402 response, AgentCore payments authorizes and completes the transaction within the configured budget. The workflow continues without interruption. When an autonomous agent encounters an x402-protected resource, the workflow stalls. The agent makes a request, such as fetching a premium research report or calling a paid data enrichment API, and the server responds with HTTP 402 Payment Required. Without a mechanism to pay, the task that was supposed to run autonomously now requires human intervention. Today, developers must build the entire payment stack. This effort spans four categories of complexity: Without a managed payment service, the agent must internalize the entire payment stack. On every x402-protected call that returns a 402 response, the agent must orchestrate the full payment flow internally, including: Each of these steps requires custom code that developers must build, secure, and maintain. Figure 1 illustrates this architecture. The agent contains eight tightly coupled components (Wallet, Private Keys, Budget Controls, Sign Proof, Attach Header, Retry Logic, Settle Payment, and Logging). The agent connects to an x402 API with a 402 challenge flowing back and a retry flowing forward. The security considerations extend beyond the engineering effort. Uncontrolled spending. Without hard spending limits enforced at the infrastructure level, a bug, retry loop, prompt injection, or inadvertent access can trigger unintended payments. An agent retrying a paid endpoint in a loop continues to authorize payments until manual intervention occurs. Key exposure. When private keys reside inside the agent runtime, they share an execution environment with untrusted web pages, third-party tools, and external dependencies. These vectors might inadvertently disclose the credentials that control real funds. Signing flow exposure. If the signing infrastructure is accessible from the runtime, a threat actor can attempt to access the key or redirect payments to an address under unauthorized control. Effective mitigation requires that the key doesn’t enter the runtime in the first place. Browser-based agents introduce an additional constraint: the payment must occur within the same browser session. Otherwise, session recordings and live view no longer match what actually executed. Anchor Browser and AgentCore payments address this complexity by moving the entire payment stack into managed infrastructure. Unlike a stateless tool call, Anchor Browser provides a real cloud browser with persistent identity, repeatable and deterministic workflows, and the session context needed to log in, navigate, and finish tasks reliably. Authentication, navigation, network requests, recordings, and live view happen inside the same browser session. When a payment is required, the transaction happens within that session. The recording captures the full sequence from request to 402 to payment to content delivery. Anchor agents include a built-in x402 tool that handles paid API calls natively within the browser context. The built-in tool requires no changes to existing Playwright, Puppeteer, or Chrome DevTools Protocol-based workflows. AgentCore payments serves as the payment layer. At the center of the service is the Payment Manager, the top-level resource that coordinates payment operations for the AWS account. Creating a Payment Manager requires specifying an authorizer type and an IAM role. AgentCore then provisions a corresponding workload identity in Amazon Bedrock AgentCore Identity. The remaining components connect the Payment Manager to external wallet infrastructure: Anchor Browser sets up wallets through AgentCore payments using a supported wallet provider, without placing wallet secrets or private keys inside the agent runtime. AgentCore payments handles wallet operations through the configured provider. For endpoint discovery, AgentCore provides a curated Coinbase x402 Bazaar MCP server through Amazon Bedrock AgentCore Gateway , so agents can discover available pay-per-use x402 endpoints programmatically. AgentCore payments restructures the payment architecture. Sensitive operations move out of the agent runtime and into a managed service layer. The Anchor Agent holds only two payment-related components: a budget session and the x402 tool. The infrastructure, including authentication, wallet secrets, payment limits, observability, and payment proof signing, resides in the AgentCore payments layer. Figure 2 shows the Anchor Agent connecting to the AgentCore payments managed layer, which handles wallet provider integration with Coinbase CDP or Stripe Privy. Figure 2: Anchor Browser integrates with AgentCore payments The following steps describe what happens end to end, from the moment a browser session encounters an x402-protected resource to the moment the agent receives the response and continues the task. Wallet credentials remain with AgentCore and the configured wallet provider throughout this flow. Before you begin, make sure that you have a valid Anchor Browser API key ( ANCHOR_API_KEY ). To create one, see the Anchor Browser Quick Start guide. Setting up agentic payments for Anchor Browser requires one session property. Set session.x402 to true . The property defaults to false . When enabled, the browser session can automatically access x402-protected websites with payments signed by AgentCore payments and retried inside the same browser session. Enabling session.x402 authorizes the browser to make real payments from the configured payment instrument. The following examples show how to create a payment-enabled session for Anchor Browser using cURL and JavaScript: After connected through Chrome DevTools Protocol, the agent navigates normally. You don’t need to include a wallet key or payment header in your automation code.

由 claude-code/sonnet 自動生成