AgentCore Payments Lets OpenClaw Agents Settle HTTP 402 Charges Autonomously
In this article
Amazon Bedrock AgentCore now ships a production payment layer that lets autonomous agents settle HTTP 402 charges without pausing for a human at every transaction. The launch pairs a wallet-abstraction service with deterministic spending guardrails, targeting agents that encounter pay-per-use APIs, metered data feeds, and paid MCP tools mid-task. The integration's first reference implementation uses OpenClaw, connecting the open-source assistant framework to AgentCore payments via the aws-agents-pay plugin and the x402 v2 protocol.
As covered in our earlier reporting on nanoclaw and OpenClaw security, payment authority and prompt-injection risk are tightly coupled. AgentCore's architecture addresses this directly.
Architecture: Separation of Administrative and Runtime Authority
The central design principle is a hard split between what a human provisions and what the model-facing runtime can invoke. A human operator, using a trusted administrative terminal and a separate IAM role, provisions the wallet connector (either a Coinbase CDP wallet or a Stripe Privy wallet, both using embedded stablecoins), creates the payment session, approves recipients, sets the cumulative budget, and defines expiry. Session creation requires typing approve at an interactive TTY — the model cannot trigger this step.
The model-visible surface at runtime is intentionally narrow: exactly two tools, get_payment_session_status and get_paid_content. The runtime IAM role carries only read operations for status checks plus ProcessPayment. It explicitly must not hold session-write permissions. The plugin's install verification step instructs developers to halt if any session-creation, setup, or shell tool appears in the model-visible tool list.
The payment flow follows x402 v2: the plugin performs a bounded network probe, receives the HTTP 402 challenge, verifies that the challenge resource matches the requested URL's origin and path, validates network, asset, recipient, and amount against the operator's pre-approved policy, calls ProcessPayment, waits until the signed authorization's validAfter time, then replays the original request. The plugin reuses the same idempotency token on retries rather than issuing a second payment.
Spending Controls and Policy Configuration
AgentCore payments enforces guardrails across six dimensions simultaneously: recipient address, asset contract, network, per-payment ceiling, cumulative session budget, and session expiry. The maxPaymentAmountAtomic parameter expresses the per-payment ceiling in the asset's smallest unit — for USDC's six-decimal precision, a value of 100000 represents 0.10 USDC.
| Control Dimension | Set By | Enforced At | Model Can Override? |
|---|---|---|---|
Approved recipients (allowedRecipients) |
Human operator, out-of-band verification | Plugin pre-payment validation | No |
| Asset contract address | Human operator, setup wizard | Plugin pre-payment validation | No |
Network (networkPreferences) |
Human operator (e.g., eip155:84532 for Base Sepolia) |
Plugin pre-payment validation | No |
Per-payment ceiling (maxPaymentAmountAtomic) |
Human operator | Plugin + AgentCore payments | No |
| Cumulative session budget | Human operator at session creation | AgentCore payments service | No |
| Session expiry | Human operator at session creation | AgentCore payments service | No |
When allowAnyRecipient: true is set, recipient allowlisting is traded for discovery flexibility — useful for Coinbase x402 Bazaar-driven workflows — but origin, network, asset, per-payment, and session-budget controls remain active. The returnBody option, when enabled, returns the paid response body capped at 10 KiB and tagged untrusted: true; the signed payment proof is never returned to the model, and all merchant-controlled response content is explicitly framed as a potential prompt-injection vector. This connects to the broader challenge of keeping spending authority out of the agentic default.
Protocol Fit: Why x402 and Stablecoins
The choice of x402 v2 over card-based payment flows is architecturally motivated. Individual API calls to pay-per-use compute or data services can price below one dollar or into fractions of a cent; card-processor minimum fees make that unit economics unworkable. Stablecoin settlement over EVM-compatible chains — Base Sepolia for testing, Base for production, with extensibility to Ethereum, other EVM chains, and Solana — supports sub-dollar transaction sizes with near-real-time settlement. x402 maps cleanly onto existing HTTP infrastructure: a server returns a 402 with a challenge, the client settles and replays, with no out-of-band payment coordination required.
AgentCore Identity handles wallet-provider credential storage so those secrets never appear in the OpenClaw configuration file. The plugin checks file ownership and permissions on the ~/.x402/config.json path and refuses to load an unsafe configuration. Observability routes through Amazon CloudWatch and AWS X-Ray via AgentCore Observability when telemetry delivery is configured.
The launch is a concrete answer to one of the harder unsolved problems in production agent deployment: how agents with real spending authority operate across control layers without a shared enforcement contract. By anchoring authority in IAM role separation and operator-provisioned sessions rather than model-level trust, AWS and the OpenClaw Foundation are proposing a replicable pattern that other agent frameworks can adapt as programmatic payment protocols mature beyond x402.