

By Josh Wadinski, Rodolphe Marques and Karan Singh. Originally published on the LangChain blog on September 3, 2026. Republished here with minor corrections.
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.
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.
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.
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.
This is not hypothetical. Exa and Baselayer accept autonomous agent payments in production today [6].
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:

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.

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.

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:

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.

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)
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:

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."

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.
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.
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.

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