Skip to content

[Feature] Add payment tool support via agentpay-mcp (x402 protocol) #2314

@up2itnow0822

Description

Context

Deep Agents ships with planning, filesystem, shell, and sub-agent delegation out of the box. One tool category that's missing: payments. Sub-agents can delegate work, but they can't pay for it — which matters when the work involves metered APIs, external services, or agent-to-agent billing.

What I'm proposing

Add agentpay-mcp as an optional tool in the Deep Agents toolkit. It's an MCP server that gives agents payment capabilities over the x402 protocol — the HTTP 402 Payment Required standard that Stripe integrated in February 2026.

Key features:

  • Human-approval mode: payments above a threshold require explicit approval before executing
  • On-chain spend caps: hard limits via smart contract
  • Structured audit trail
  • 149 tests, MIT license, npm install agentpay-mcp

Already merged into NVIDIA's NeMo-Agent-Toolkit-Examples (PR #17).

How it fits Deep Agents

Deep Agents already handles the agent harness — planning, context, sub-agents. Adding payment tools is additive:

from deepagents import create_deep_agent
from langchain_mcp_adapters.client import MultiServerMCPClient

async with MultiServerMCPClient({
    "agentpay": {
        "command": "npx",
        "args": ["agentpay-mcp"],
        "transport": "stdio",
    }
}) as mcp_client:
    payment_tools = mcp_client.get_tools()
    
    agent = create_deep_agent(additional_tools=payment_tools)
    result = await agent.ainvoke({
        "messages": [{
            "role": "user", 
            "content": "Research cloud providers and purchase the cheapest API plan"
        }]
    })

The sub-agent pattern in Deep Agents is a natural fit — orchestrators can spawn paid sub-agents, each with their own spend cap.

What this enables

  • Agents that can use metered data APIs without manual payment steps
  • Multi-agent workflows where tasks have real costs
  • Full automation of workflows that currently require human payment steps

The x402 infrastructure is maturing. Nexi (€2.9T payment volume) and Google committed to the UCP/AP2 agentic payment standard. The tooling is production-ready.

What I'd like feedback on

  • Would this fit as a built-in tool alongside execute, read_file, etc.?
  • Or better as an example showing MCP tool integration with Deep Agents?
  • Is there an integration pattern you'd prefer over the MCP adapter approach?

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalUser is not a member of the `langchain-ai` GitHub organization

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions