langchain-ampersend
LangChain integration for Ampersend x402 payments. Call remote A2A agents with automatic payment handling.
Installation
pip install langchain-ampersend
Usage
from langchain_ampersend import A2AToolkit, create_ampersend_treasurer
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
# Create treasurer (one-liner setup)
treasurer = create_ampersend_treasurer(
smart_account_address="0x...",
session_key_private_key="0x...",
)
# Create toolkit for a remote agent
toolkit = A2AToolkit(
remote_agent_url="https://agent.example.com",
treasurer=treasurer,
)
# Initialize (discovers the agent)
await toolkit.initialize()
# Use with LangGraph
llm = ChatOpenAI(model="gpt-4")
agent = create_agent(llm, toolkit.get_tools())
# Run
result = await agent.ainvoke({"messages": [("user", "Query some data")]})
Tools
The toolkit provides two tools:
a2a_get_agent_details- Get the capabilities and skills of the remote agenta2a_send_message- Send a message to the remote agent (payments handled automatically)
Metadata
Release files for langchain-ampersend 0.0.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_ampersend-0.0.28.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_ampersend-0.0.28-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / langchain_ampersend-0.0.28.tar.gz
| Download URL | langchain_ampersend-0.0.28.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4340613d181b677a0144cb901abf8961111d13717e3e148a07f3f2bde5644fae
|
|
BLAKE2b-256 checksum How to use checksums |
f24135d26fbde2e94be2b8ddcabd0bb3dfc66e75475fe4492d8f32da15ba8442
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.
Transparency logRelease files / langchain_ampersend-0.0.28-py3-none-any.whl
| Download URL | langchain_ampersend-0.0.28-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca689f9a614a60da6cfac1641540a490f7004a22d5f25526fc4e88a351fc591b
|
|
BLAKE2b-256 checksum How to use checksums |
4d7adb9ad887c39ae5d838fe3e3a747ff155e84596e7c10742a973fac3e4cbbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.
Transparency log