Agents

LangChain adds AgentCore Payments middleware for AI agents

LangChain has introduced Amazon Bedrock AgentCore Payments middleware, allowing AI agents to securely pay for premium APIs and services using stablecoins under strict, deterministic budgets.

LangChain Blog1 day agoAgents
Image: LangChain Blog

LangChain developers can now equip their autonomous agents with secure, native transaction capabilities through the new Amazon Bedrock AgentCore Payments middleware. This integration shifts payment logic from individual tool wrappers to a centralized infrastructure layer. Instead of relying on fragile LLM prompts to control spending, developers can enforce deterministic, session-level budgets. When an agent encounters an HTTP 402 payment requirement, the middleware intercepts the call, validates the cost against the budget, signs the transaction, and retries the request seamlessly.

The system leverages the x402 protocol, a standard created by Coinbase in May 2025 and managed by the Linux Foundation, to enable HTTP-native micropayments using stablecoins. It supports both x402 v1 and v2 protocols. To fund these transactions, the middleware integrates with Coinbase CDP and Stripe (Privy), allowing users to load wallets with fiat currency or USDC. To implement this, developers can install the package via pip using the command pip install -U bedrock-agentcore[langgraph,strands-agents] and configure the middleware with parameters like a hard-ceiling session budget of 5.00 dollars.

For practitioners, this setup unlocks access to high-value, paywalled data sources such as real-time market feeds, court filings, and medical literature without manual API key management. To ensure security, AgentCore Identity handles wallet authentication. Furthermore, developers can monitor and audit agent spending using LangSmith. LangSmith captures the exact reasoning behind each purchase alongside the transaction metadata, allowing teams to run single-step or full-turn evaluations to verify that agents are spending money wisely. Harrison Chase, CEO of LangChain, noted that these tools help developers build agents that operate with "greater autonomy while remaining observable and controlled."

This is our own summary of reporting by LangChain Blog

More in Agents