AWS ML ★ 84 5 min

Pay-per-inference for AI agents: How BlockRun and Incarna use Amazon Bedrock AgentCore payments

Amazon Bedrock AgentCoreCustomer SolutionsFoundational (100)

🔗 https://aws.amazon.com/blogs/machine-learning/pay-per-inference-for-ai-agents-how-blockrun-and-incarna-use-amazon-bedrock-agentcore-payments/

📌 AI 代理的微支付難題:AgentCore Payments 如何讓 Agent 自己付推論費

TL;DR:AWS Bedrock AgentCore Payments 讓 AI agent 透過 x402 自動付費買推論,花費上限由平臺強制執行。

一個 AI agent 跑一次任務,可能要在迴圈裡連續買上百次東西:一次模型推論、一次 API 回應、一次網頁內容,每一筆可能只值零點幾美分,而且沒有人會在旁邊逐筆按「確認付款」。這篇 AWS 機器學習部落格的案例研究,講的就是這個問題怎麼被解決的。

🤔 信用卡網路,從來不是為這種交易設計的

文章指出,為 agent 的高頻、低金額支付自建一套金流,等於要同時解決好幾個難題:錢放在哪裡、每筆付款怎麼簽署、如何支援像 x402 這種剛出現的支付協定,以及怎麼防止一個自主運作的 agent 失控超支。Amazon Bedrock AgentCore payments 把這些問題收進一個受管服務裡,讓開發者只需要寫幾行程式碼就能幫 agent 加上付款能力。

🧩 BlockRun 賣推論,AgentCore Payments 管錢

案例主角 Incarna 用 AgentCore payments,讓自己的 agent 向 BlockRun 逐次付費購買模型推論。BlockRun 是一個走 x402 協定的按量付費推論路由器,整合超過 15 家供應商、90 多個模型,每次呼叫都是各自獨立報價、授權與結算。整體架構是:AgentCore 負責執行 agent,BlockRun 提供計量推論服務,AgentCore payments 則負責連接客戶的錢包、強制執行花費上限,並代表 agent 的 Incarna 身分簽署每一筆交易。

設定流程大致是:先把 Coinbase CDP 或 Stripe Privy 的憑證存成 payment credential provider,憑證會保存在 AWS Secrets Manager 而不是程式碼裡;接著建立 Payment Manager 與連接器,並設定預設花費上限;再建立 payment instrument,也就是 agent 實際付款用的嵌入式錢包,終端使用者透過導向網址為錢包注資並授權簽署,測試階段可以用 testnet USDC。AgentCore payments 支援兩種 x402 付款機制:價格已知時用 exact,資源為動態定價時用 upto,讓 agent 先授權一個上限金額,供應商最後按實際用量在上限內結算。

💡 花費上限寫在基礎設施層,agent 的程式碼改不動它

文章特別強調 payment session 的設計:一個 session 會設定一個花費上限,由 AgentCore payments 在基礎設施層強制執行,agent 自己的程式碼或 prompt 都無法更改這個上限,每個 session 也有到期時間。Incarna 把 session 的額度設定為一天的預算,即使 agent 的邏輯出了問題,花費也不會超過客戶設定的上限。

📊 三天完成原本預估兩到三個月的整合

Incarna 團隊完成完整的 AgentCore payments 整合只花了三天:一天開發、兩天測試,寫了大約 200 行應用程式碼,相較於原本預估的兩到三個月大幅縮短。在 beta 階段,agent 累計處理超過 1,000 筆付款,單筆金額從 0.001 美元到 0.05 美元不等,每一筆都在 Base 鏈上以 USDC 獨立結算。Incarna 創辦人 Justin Zhou 表示:「AgentCore payments 涵蓋了 agent 透過 x402 付款所需要的一切:客戶自己擁有的錢包、資金與撤銷流程、平臺強制執行的花費上限,以及能處理兩種 x402 版本的簽署機制,我們一行都沒有自己寫。」

⚠️ 目前仍是 beta 案例,規模化細節有限

素材只提供了 Incarna 這一個案例在 beta 階段的數據,並未說明更大規模部署下的延展性、安全審計或多 agent 併發情境下的表現,這些都是讀者評估是否導入前需要自行驗證的部分。

🎯 實務啟示

對正在打造需要自主購買服務的 agent 系統的工程師來說,這個案例示範了一個值得參考的分工模式:把錢包託管、交易簽署與花費上限強制執行,交給受管的基礎設施層去做,而不是自己從零實作一套金流與風控機制,可以把原本數月的整合工作壓縮到幾天內完成。

🔗 來源

#AWS #BedrockAgentCore #AIAgents #x402 #MicroPayments #AgenticAI #Web3 #CloudComputing #Fintech #PayPerUse

原始資料 AWS ML · 收集於 2026-10-08
來源原標題
Pay-per-inference for AI agents: How BlockRun and Incarna use Amazon Bedrock AgentCore payments
作者
Peter Jiang
原始標籤
Amazon Bedrock AgentCore · Customer Solutions · Foundational (100)
原始連結
https://aws.amazon.com/blogs/machine-learning/pay-per-inference-for-ai-agents-how-blockrun-and-incarna-use-amazon-bedrock-agentcore-payments/

摘要原文

When an AI agent runs, it often needs to buy something to finish a task: a model inference, an API response, access web content, or a call to another agent. These purchases are small and frequent, sometimes a fraction of a cent each, and they happen inside the agent’s loop with no person available to approve them. Amazon Bedrock AgentCore payments removes that burden. It gives agents a managed way to pay for services on demand, with spending limits enforced by the infrastructure rather than by the model. In this post, we look at how Incarna used AgentCore payments to let its agents pay BlockRun for model inference one request at a time. BlockRun is a pay-as-you-go inference router serving more than 90 models from more than 15 providers over x402 , each call quoted and settled independently. AgentCore payments works with x402-compatible endpoints, including Amazon Bedrock inference endpoints. With the service, the Incarna team cut the work of adding x402 payment support from months to days, and put an end-to-end pay-per-inference flow into production. Paying per inference is a high-frequency, low-value pattern. An agent might make hundreds of small purchases in a single session, each worth a fraction of a cent. Card networks weren’t built for sub-cent payments. Building your own rails means solving several hard problems at once. You must decide where the money is held and how each payment is signed, support emerging payment protocols such as x402, and keep an autonomous agent from overspending. Amazon Bedrock AgentCore is a platform to build, connect, and optimize agents at scale, with any framework or model. AgentCore payments is a managed capability of Amazon Bedrock AgentCore that builders can use to add payments to their agents in a few lines of code. It handles the payment protocol, connects to a wallet, signs the transaction, and enforces spending limits. Builders integrate through one managed service instead of assembling the parts on their own. A few things make it a good fit for pay-per-inference: The following diagram illustrates the end-to-end architecture. AgentCore runs the agent, BlockRun serves metered inference, and AgentCore payments connects to the customer’s wallet, enforces the spending limit, and signs each payment on behalf of the agent’s Incarna identity. Figure 1: Pay-per-inference architecture. Agent request flows through AgentCore to BlockRun (HTTP 402), with AgentCore payments signing the x402 payment from the agent’s own wallet Source: incarna.io/aws-blockrun-incarna-partnership The path Incarna followed is open to other teams, and AgentCore payments provisions the pieces for you. You can set them up through a guided conversation with the AgentCore payments skill in the Agent Toolkit for AWS (in Claude Code, Kiro, or Codex). You can also create each one yourself with the AgentCore CLI, the AgentCore SDK, or the AWS SDK. Start by storing your Coinbase CDP or Stripe Privy credentials as a payment credential provider, which keeps the secrets in AWS Secrets Manager instead of your code. Create a Payment Manager and connector to coordinate payments against those credentials, and set a default spending limit while you’re there. Then create a payment instrument, the embedded wallet the agent pays from. The end user funds it and grants signing permission through a redirect URL, and on a test network you can fund it with testnet USDC. In this integration, BlockRun is the seller. BlockRun serves metered model inference from a live catalog, and each call is quoted, paid, and settled on its own. The flow for a single inference is straightforward: Because settlement happens per request, the agent pays only for what it uses, and a call the agent chooses not to make costs nothing. AgentCore payments supports two x402 payment schemes: exact and upto . The exact scheme is usually used when the price is known up front. The upto scheme suits resources with dynamic pricing. The agent authorizes a ceiling amount, and the inference provider settles for actual usage at the end, up to that ceiling. The piece that makes builders comfortable letting an agent move real money is the payment session. A session sets a ceiling, the most the agent can spend, and AgentCore payments enforces that ceiling at the infrastructure layer. The agent’s own code and prompt can’t change it. Each session also carries an expiry time, and Incarna sizes its sessions to a day’s budget. If something goes wrong in the agent’s logic, it still can’t spend past the limit the customer set. Even integrations that don’t use session-level budgets today can adopt it without code changes. For more on how these controls work, see Enable safe agentic payments with built-in guardrails . Incarna put the pay-per-inference flow into production on Base, with BlockRun serving the sell side and AgentCore payments governing every transaction. “The next generation of AI agents shouldn’t have to choose between better performance and sustainable economics. BlockRun’s open source router gives developers full control over their own model set, while continuously benefiting from BlockRun’s ongoing benchmark-driven routing improvements—delivering higher task success rates at lower token cost. And with AgentCore payments and x402 providing the spending controls agents need, that intelligence can be put to work safely in the real world.” The Incarna team completed the full AgentCore payments integration in three days: one to build and two to test. That was roughly 200 lines of application code, against the two to three months originally scoped. Across the beta, agents have processed over 1,000 payments ranging from $0.001 to $0.05 per call, each settling individually on-chain. “AgentCore payments covered everything we needed for an agent to pay over x402: a wallet the customer owns, a funding and revocation flow, a spending limit the platform enforces, and signing that handles both versions of x402. We wrote none of it.” — Justin Zhou, Founder, Incarna AgentCore payments gives agents a governed, on-demand way to pay for the services they use. BlockRun and Incarna show how it comes together end to end: an agent that pays for inference, a provider that meters and settles it, and an identity that owns the transaction. If you’re building agents that need to buy services as they run, you can add that capability through a single, governed integration point with AgentCore payments. Ready to add pay-per-inference to your agents? Here’s how to start: To explore the code, see the AgentCore payments samples on GitHub . BlockRun is a pay-as-you-go inference router that serves model inference over the x402 payment protocol. Agents reach a live catalog of models through a single metered endpoint. Each call is independently quoted, authorized, paid, and settled on Base (USDC). BlockRun handles provider selection and delivery so agents access many models through one integration without per-provider subscriptions or billing relationships. Incarna , built by SpreadX, gives AI agents a persistent identity that survives sessions, models, and runtimes. Each identity carries its own wallet, email address, social accounts, and an action history that stays attached to one ID across runs. When an agent pays for a service, the on-chain payer is the agent’s own identity rather than a shared platform key, making every transaction attributable to a single durable entity. Incarna is live on Base mainnet with real settlement.

由 claude-code/sonnet 自動生成