Partnerships & Integrations

Agents That Pay: How Nevermined Empowers LangChain Agents to Buy and Sell Services

A LangChain x Nevermined cookbook: delegate a card once, and your LangChain agent buys Exa credits, tops up after a 402, and purchases Baselayer mid-task, with every payment traced in LangSmith.
By
Rod
Sep 3, 2026
LangChain and Nevermined: LangChain agents that can buy and sell services
See Nevermined
in Action
Real-time payments, flexible pricing, and outcome-based monetization—all in one platform.
Schedule a demo

By Josh Wadinski, Rodolphe Marques and Karan Singh. Originally published on the LangChain blog on September 3, 2026. Republished here with minor corrections.

Key takeaways

  • Long-running agents can hit impediments mid-task: lacking access to an API, running out of AI service tokens, or missing an AI tool or service they need. Today the whole workflow stalls when a human needs to sign up, add a payment card, and paste in an API key.
  • Nevermined solves this by giving operators the ability to delegate a credit card to an agent, which comes with limits like how much the agent can spend and where it can spend it. This allows the agent to buy what it needs mid-task and keep running. No human in the loop, and it can’t spend past the caps you set. Agents can run autonomously as a result. This includes when an agent needs to top up on tokens.
  • API providers selling to agents can trace every payment on LangSmith and do not need new rails to autonomously sell to AI agents. Adding in the payment step with Nevermined and tracing with LangSmith means no additional payment infrastructure needed on your end to get going.

Overview

An agent is autonomous until it hits something it cannot buy. In this cookbook, we show how Nevermined empowers an agent built on LangChain, mid-task, to acquire web search credits, and then - after exhausting those credits - top up with more. The agent then needs data from a provider it was never wired to, discovers it, and buys access. Nevermined’s agentic payment infrastructure allows this all to be done with a credit card that only needs to be delegated and authorized once. The spend for the credit card is inside limits the agent cannot exceed, and every payment the service provider selling to the agent receives is traced on LangSmith.

This cookbook shows that with LangChain and Nevermined today you can let your agents buy what they need to keep working without a human in the loop, as opposed to stalling when a human is needed for payment. This is bound by a spending policy you set for your agent. The cookbook closes by showing how merchants selling services to agents can set up their own API to be purchased and provisioned autonomously to agents with every payment traced in LangSmith.

Why now

The agentic economy is alive and starting to scale. AI providers and labs, like Open AI and Anthropic, are moving away from traditional subscription based pricing to usage-based pricing. The cost of the service will be extensibly linked to consumption, and not the cost of the seat. The response on the buy side (ex: agents buying services) is consuming only what’s required, when required. The result is both pay-as-you-go as a more significant form of engagement, and microtransactions being front and center when payment for agent tools and services are needed.

  • Market momentum is underway. Gartner projects machine customers will control up to $30 trillion in purchases by 2030, and agents will intermediate $15 trillion in B2B spend by 2028 [1]; McKinsey puts agent-mediated commerce at $3 to $5 trillion by 2030 [2]. Most of it is small, often sub-cent transactions (as of July 2026, the average agent payment is about $0.31 [3]) an agent makes to get past an impediment and keep working.
  • Pricing that fits agents is taking over. Services are being repriced per unit of work, not just per seat: Intercom's Fin at $0.99 per resolution, Salesforce Agentforce at $2 per conversation, document processing around $0.10 per page. A flat fee model does not track that work, so heavy use breaks it: GitHub Copilot's $10 per month plan reportedly loses about $20 per user per month on the heaviest users [4].
  • The commerce layer is the gap. AI agents are being engaged across many use cases, yet when it comes time to spend, the flow is still entirely human driven. Payment controls, both buy and sell side (ex: teams selling services to agents), remain manual. For example, on the buy side, a human still signs up for a service, manages the card and API keys themselves, and tops up the balance the agent spends. It is the same gap in front of every metered service an agent reaches for.
  • The payment rails these agents use are converging. Despite still being early, many new solutions and protocols are emerging: x402, plus agent-payment support that Stripe, Visa Intelligent Commerce, Mastercard Agent Pay, PayPal, and Google's AP2 all shipped inside a single twelve-month window [5], converging to support agent self-serve payment flows.
  • LangChain has already identified the importance of measuring agent spend. Having insight into coding-agent bills that run up unpredictably as the agent works is critical to measuring ROI, as well as making agentic spend predictable or optimized within a budget constraint. The next step is to action the spend an agent is authorized with by enabling payments.

Nevermined’s goal since inception has been to give every AI agent the ability to pay and be paid. This includes autonomously paying for agentic services. Being the market leader in the Agentic Commerce category, Nevermined will continue to leverage all new tooling and settlement mechanics agents can use across both existing and new rails.

Building an agent on a research deadline

The following is the recipe for enabling a research agent to do its job autonomously. In this case, a team spins up an agent in Fleet to pull together research across numerous information sources. In addition, the agent needs access to third party data and tools that it does not already have access to. With Nevermined, agent builders do not need to write additional code to ingest more tooling. Instead you can simply delegate a card once and set the limits. The scenario has four beats.

  1. Buy in. After the free tier credits for the Exa API are used the agent gets an alert to buy more, giving the ability to delegate a credit card that is used to buy a $7 block of additional Exa credits and then it continues researching.
  2. Burn through it. The agent fans out across sources. That $7 block is consumed at standard Exa rates, doing hundreds of requests or the equivalent of thousands of content pages, and a deep sweep drains it fast. This illustrates how fast agents can work when uninterrupted and shows the value of consumption based pricing. Nevermined notes, "an AI agent that processes 50,000 requests in an hour destroys the unit economics of any fixed-price plan."
  3. Top up. The credit balance hits zero and Exa returns 402 with NO_MORE_CREDITS. It still needs to use the API, so the agent tops ups and buys another $7 using the existing delegation and keeps going. This is the quantitative case: autonomous top-up.
  4. Purchase a net-new service. The research needs verified company data, the officers, registrations, and standing behind an entity, that general web search cannot return. That is a specialized source Exa does not provide directly. The agent discovers Baselayer, a provider that accepts agent payments the same way Exa does, buys access against the same delegation, and folds the result in. This is the qualitative case: it bought a capability it was never wired for.

This is not hypothetical. Exa and Baselayer accept autonomous agent payments in production today [6].

Letting agents buy what they need

When an agent can pay for what it hits, it stops stalling. You delegate a card once and set the limits, and the agent buys the credits and services it needs mid-task, always inside your caps. Agents can fully self-provision core APIs at instantiation and continue procurement of net-new services on the fly, as needs and requirements evolve. Here is how it looks in LangSmith Fleet:

LangSmith Fleet transcript: the agent buys Exa web-search access with the delegated card and continues researching
Fleet, mid-task. The agent needed Exa’s web-search API, bought access against the delegation, and carried straight on. The confirmation is the last line of the transcript.

During runtime, the agent needs to buy access to search. In this case Exa’s websearch API, so a delegation pop-up appears. You enter a credit card once, and it is saved for future purchases. The agent never sees the card number; it pays through x402.

Nevermined embed, step 1 of 2: add card, secured by Stripe
The one human moment in the whole flow: enrol a card, once. The details go straight to Stripe. They never touch Nevermined’s servers, and the agent never sees the number.

The limits live in a spend policy you set once: a total budget, a time window that auto-stops, a per-purchase cap, and a transaction count. Nevermined enforces them server-side, before any money moves, so a large or unusual buy can pause for a human. This mitigates runaway spend; in Nevermined's words, "handing an agent a raw unbounded payment method makes the answer to 'how much can it spend?' equal to 'everything.' A delegation makes the answer exact: a cap, a clock, and an off switch." Most importantly, this is only needed once and then repeat and/or future purchases within the mandate do not require a human in the loop, allowing the agent to work uninterrupted.

Nevermined embed, step 2 of 2: set spending limit, duration, max transactions and API key scope
Step two is the mandate: a total budget, a duration that auto-stops, and optional caps on transaction count and key scope. Nevermined enforces all of it server-side, before any money moves.

Teams interested in embedding Nevermined credit card delegation can find details along with code samples in the organization widgets docs. The widget can be tested at widgets.nevermined.dev.

The instructions to add this to LangSmith Fleet via Nevermined MCP are as follows:

LangSmith Fleet settings: adding the Nevermined MCP server with OAuth 2.1 auto-discovery
One-time wiring. Adding the Nevermined MCP server is what gives the agents in a workspace the ability to pay at all; OAuth endpoints are discovered from the server URL rather than configured by hand.

Now it runs. The agent buys Exa’s API, burns through the credits, and tops up on the same delegation, with no human in the loop. Then it discovers it needs Baselayer for verified company data and buys that too, against the same delegation.

LangSmith Fleet transcript: the agent autonomously buys Baselayer access and returns a verified corporate record
The qualitative case. Needing verified corporate records that general web search cannot return, the agent discovers Baselayer, a provider it was never wired to, and buys access on the same delegation.

Selling to agents autonomously

The same rails run in reverse: turn your own API or tool into something agents can buy and pay for on their own, per call, and see every payment in LangSmith. You can wire this up today. The process is remarkably simple, and includes connecting your existing PSP and configuring payment terms, whilst a lightweight payments SDK protects access to the API, MCP, tool, and/or agent being monetized. For discoverability, setting up/amending your llms.txt and creating a respective .md can be easily done. More and more, llms.txt is functioning as the shop window for agents where the respective .md is what they actually buy. The instructions for monetizing and protecting your API endpoint can be done as a decorator, or middleware on a route:

from payments_py.x402.langchain import requires_payment

@requires_payment(payments=payments, plan_id=RESEARCH_PLAN_ID, credits=5)   # 5 credits per call
@tool
def market_research(topic: str) -> str:
    """Premium lookup. Requires payment."""
    return run_market_research(topic)

Deep agents and subagents

The same decorator works unchanged on LangChain's Deep Agents harness. A deep agent delegates work through its built-in task tool, and the buyer's payment authorization travels with it so a paid tool can sit inside a subagent, one delegation hop from where the card was authorized, with no extra code:

Diagram: main agent hands off to research-sub via task(), which calls the paid market_research tool; the payment token travels down the delegation
The payment authorization travels with the delegation. The buyer supplies an x402 token once, on the run; the supervisor hands the job to a subagent through task(), and the token still reaches the paid tool one hop down, with no extra code.

That matters because delegation is the whole premise of the harness. If payment context didn't survive the hop, every paid capability would have to sit on the top-level agent. It survives so monetization is identical whether you're on create_react_agent or create_deep_agent.

It also makes your spending policy do more work. A deep agent decides for itself how many subagents a request warrants, so one user request can trigger several purchases. That is exactly what the cap, the clock, and the off switch are for: the delegation bounds the whole fan-out, not just one call.

All the details you need to get set up on LangChain are in the LangChain and Deep Agents integration docs. Setting up an API that agents can purchase autonomously and get paid is exactly what Exa and Baselayer did [6].

Next, once you have your LangChain endpoint set up via Nevermined, you can see live traces. Simply set LANGSMITH_TRACING=true and each buy becomes its own subtree, because Nevermined emits the payment lifecycle, the verify and then the settle, into the trace. The same trace that shows the agent's reasoning shows when it spent, how much, and on what, which is the difference Nevermined draws "between knowing an agent is authorized and knowing how much the agent used."

LangSmith trace: nvm:verify and nvm:settlement spans nested inside the market_research tool call
Every purchase becomes its own subtree. Inside the 9.07s market_research span, nvm:verify (0.49s) and nvm:settlement (2.13s) bracket the model call that did the work, so spend sits in the trace next to the reasoning that caused it.

Tracking traces allows for above-threshold buys to slot into a LangSmith annotation queue for human review. Additionally, the output can be graded by an LLM-as-judge, for example using LangChain's own trace judge and efficient-verifier work, to tie spend to quality.

Where this fits in LangChain

Card delegation can live wherever your team already manages access and spend. In LangChain, it may slot into billing or settings, entered once for an org and reused across its agents. In an integrations section, an integration your agents use can be not just connected but bought on the fly the moment an agent needs it. This includes a paywalled MCP server. It could also be added as a skill file to carry the delegation into any agent. And the tracing already runs on LangSmith today.

Recap and what’s next

The self-serve motion that grew SaaS - sign up, pay, expand - has no equivalent for agents yet. Credit card delegation gives every metered API, MCP, and/or tool a self-serve consumption path equivalent at the agent level: the agent provisions what it needs, inside a budget, and the provider's consumption grows without a human gating every dollar.

This cookbook illustrates clear ways agents can already buy and/or sell within LangChain. First, wire in card delegation so agents can buy what they need inside limits and run without stalling for a human. Second, after protecting your endpoint and setting it up to be monetized on LangChain, you can use LangSmith to trace the spend.

The websearch API example shown in this cookbook is just one of many tools that agents need and can now start acquiring autonomously. Going forward, every metered category an agent leans on, from inference to storage and sandboxes, ephemeral compute environments to enrichment services, voice, and identity, can become something the agent buys and a provider sells the same way - autonomously in real time and with safeguards to ensure spend is always within an operator’s mandates. This is how the agentic economy, which is already underway, continues to grow and evolve on LangChain with Nevermined.

This cookbook first appeared on the LangChain blog. To start building, see the Nevermined integration guides for LangChain and Deep Agents.

Sources

  1. Machine customers controlling up to $30 trillion in purchases by 2030, and agents intermediating ~$15 trillion in B2B spend by 2028 (Gartner).
  2. Agent-mediated commerce at $3 to $5 trillion by 2030 (McKinsey).
  3. Average agent payment ~$0.31 across ~140M x402 payments (Circle, as reported in 2026 coverage of agent payments).
  4. Consumption pricing across the agent market: Intercom Fin ~$0.99 per resolution; Salesforce Agentforce ~$2 per conversation; document processing ~$0.10 per page; GitHub Copilot's $10 per month plan reportedly loses ~$20 per user per month on the heaviest users (vendor pricing pages and 2026 coverage).
  5. Agent-payment support shipped within one 12-month window by Stripe (Agentic Commerce), Visa Intelligent Commerce, Mastercard Agent Pay, PayPal, and Google AP2 (vendor announcements).
  6. Exa accepts autonomous agent payments in production ($7 provisions or tops up; 402 NO_MORE_CREDITS on exhaustion). See Autonomous AI Agent Payments: How Exa and Nevermined Are Unlocking the Agentic Internet, May 6, 2026, and related posts.

See Nevermined

in Action

Real-time payments, flexible pricing, and outcome-based monetization—all in one platform.

Schedule a demo
Rod
Related posts