Ampersend enables LangChain agents to pay for and use remote AI agent services. Payments are handled transparently via the x402 protocol, with A2A as the communication layer.Documentation Index
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Integration details
| Class | Package | Serializable | JS support | Version |
|---|---|---|---|---|
A2AToolkit | langchain-ampersend | ❌ | ❌ |
Tool features
- a2a_get_agent_details - Get capabilities of the remote agent
- a2a_send_message - Send messages to the remote agent (payments handled automatically)
Key features
- Spend controls: Pluggable payment authorization with limits and policies
- Transparent payments: x402 protocol handles payment negotiation automatically
Setup
Installation
Install thelangchain-ampersend package:
Credentials
The toolkit requires a session key and smart account address, which you can obtain from the Ampersend dashboard.Set up credentials
Instantiation
Initialize toolkit
Invocation
Send a message to the remote agent:Send message
Use within an agent
Create agent
Run agent
How payments work
When the remote agent requires payment (HTTP 402), the toolkit:- Receives the payment requirement
- Calls the treasurer to authorize the payment
- Signs the payment with the configured wallet
- Retries the request with the payment attached
AmpersendTreasurer provides managed payment sessions with spend limits and analytics. Alternative treasurer implementations are available in ampersend_sdk.
API reference
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

