Pay-per-inference with Amazon Bedrock AgentCore payments: Incarna and BlockRun case study

· Engineer's Notes · Cem Koyluoglu

How Incarna integrated Amazon Bedrock AgentCore payments to enable sub‑cent, per‑inference transactions with BlockRun, reducing integration time and code size.

What happened

Incarna integrated Amazon Bedrock AgentCore payments to let its AI agents purchase model inference from BlockRun on a per‑request basis. BlockRun, a pay‑as‑you‑go inference router, serves more than 90 models from more than 15 providers over the x402 protocol. The integration leveraged managed wallets provisioned via the Coinbase CDP connector, native x402 handling of HTTP 402 responses, and infrastructure‑level spending limits. Incarna completed the integration in three days—one day for building and two for testing—using roughly 200 lines of application code, compared with an original estimate of two to three months. During the beta, agents processed over 1,000 payments ranging from $0.001 to $0.05 per call, each settled individually on‑chain in USDC on the Base network. Sessions were sized to a day’s budget, with ceilings enforced by AgentCore payments regardless of agent prompts.

Why it matters in production

The ability to charge agents per inference at sub‑cent granularity addresses a core economic challenge for autonomous AI workflows that make hundreds of tiny purchases per session. By moving payment logic to a managed service, teams avoid building custom payment rails, reducing development effort and potential security gaps. Infrastructure‑enforced spending limits mitigate overspend risk even if an agent’s prompt is manipulated, improving safety for real‑world deployments. Settlement on a stablecoin provides auditable on‑chain proof, simplifying compliance and financial reconciliation. The reduction from months to days and the small code footprint demonstrate lower operational overhead, which can translate to lower total cost of ownership for large‑scale agent deployments.

Engineering takeaways

  • Use AgentCore payments to offload payment protocol handling, wallet management, and spending governance to a managed service, eliminating the need for custom payment infrastructure.
  • Define payment sessions with explicit ceilings and expiry times (e.g., a day’s budget) to enforce spend limits at the infrastructure layer, protecting against runaway costs.
  • Leverage x402‑compatible endpoints such as BlockRun to enable per‑call quoting and settlement, allowing agents to pay only for actual usage.
  • Store credential providers (Coinbase CDP or Stripe Privy) in AWS Secrets Manager to keep secrets out of code and simplify credential rotation.
  • Adopt the exact or upto x402 payment scheme based on pricing predictability: use exact for fixed prices and upto for dynamic pricing models.

Related work on this site

  • Agentic & LLM Automation — Multi-step LLM pipelines that run unattended: model cascades with fallbacks, validation gates, scheduled automation and alerting when something breaks.
  • RAG & Grounded LLM Systems — LLM features that answer from the right source instead of from memory: document-grounded assistants, transcript-grounded chat and quality gates around generated output.
  • YouTube AI Summarizer — Open-source Chrome extension on the Chrome Web Store: AI summaries, key points, deep analysis, a two-host AI podcast (Gemini TTS) and transcript-grounded chat for any YouTube video, using Groq or Ollama Cloud with the user’s own key.
  • Automated AI News Pipeline (this site) — The pipeline behind this site’s Tech News: scheduled GitHub Actions scrape sources, an LLM cascade on Groq rewrites and enhances articles, and layered quality gates (date integrity, language checks, instruction-leak detection, duplicate detection) decide what gets published, with Telegram alerts.

This note was drafted with AI assistance from the primary source credited on this page, and automatically checked against that source before publishing.

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

← All tech news