Skip to main content

LangChain integration for Ampersend x402 payments

Project description

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 agent
  • a2a_send_message - Send a message to the remote agent (payments handled automatically)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_ampersend-0.0.26.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_ampersend-0.0.26-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_ampersend-0.0.26.tar.gz.

File metadata

  • Download URL: langchain_ampersend-0.0.26.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langchain_ampersend-0.0.26.tar.gz
Algorithm Hash digest
SHA256 daf3a696f47b50ef1dda2ddc11a71abdd1ce5fb7fc9e2ae8171dca361a05df48
MD5 0d7bc8f493d8bbf23250fd2d6e5255dd
BLAKE2b-256 c97863b13db6e76ff32c1747a29a7dac4bf7cefe5bc13f84d52266dc41e9dd69

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_ampersend-0.0.26.tar.gz:

Publisher: python-langchain-ampersend-release.yml on edgeandnode/ampersend-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_ampersend-0.0.26-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_ampersend-0.0.26-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a40b1b4aba04932cf643dabd0e4bcd7795282e9e37127432aa993bfd053fb7
MD5 94c89ee7cdd5515a6c8873f20a82e78f
BLAKE2b-256 c7fae6cb6cb7fe20abee7b9e3eb28f0c8c6752e031197c6990a0072eb9d7e4a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_ampersend-0.0.26-py3-none-any.whl:

Publisher: python-langchain-ampersend-release.yml on edgeandnode/ampersend-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page