Skip to main content

agentpay-langchain

LangChain tool for autonomous USDC payments via AgentPay.

Install

pip install agentpay-langchain

Usage

from agentpay_langchain import AgentPayTool
from langchain_openai import ChatOpenAI
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_core.prompts import ChatPromptTemplate

# Get your free API key at https://agentpay.xyz/get-started
tool = AgentPayTool(api_key="ap_...", agent_id="my-agent")

llm = ChatOpenAI(model="gpt-4o")
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are an AI agent that can make USDC payments on behalf of users."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(llm, [tool], prompt)
executor = AgentExecutor(agent=agent, tools=[tool], verbose=True)

result = executor.invoke({"input": "Pay 10 USDC to 0xABC... for API access"})

Features

  • Guardrails enforced on every payment (spend limits, velocity caps)
  • Full audit trail with on-chain tx hashes (BaseScan)
  • Idempotency keys to prevent duplicate payments
  • Async support via _arun
  • Works with any LangChain-compatible LLM

Get started

  1. Get a free API key at agentpay.xyz/get-started
  2. Set AGENTPAY_API_KEY=ap_... or pass api_key= directly
  3. Configure guardrails via dashboard or API

Release files for agentpay-langchain 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentpay-langchain 0.1.0
File Size Uploaded
agentpay_langchain-0.1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentpay-langchain 0.1.0
File Interpreter ABI Platform
agentpay_langchain-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / agentpay_langchain-0.1.0.tar.gz

Download URL agentpay_langchain-0.1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cd46f1be73c0ed5eef8706f8342ea14f4de6d3c6d5275b9c64be7dcfc7b2c921
BLAKE2b-256 checksum
How to use checksums
754c37a35366174b941c6ce797070c084785cca9a5e8e2065f99d93e0b797db7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / agentpay_langchain-0.1.0-py3-none-any.whl

Download URL agentpay_langchain-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66cc2a53d1d5ffdda4d7f30ef08f09d57aa07995c9fe29ef39ae90cbdd150099
BLAKE2b-256 checksum
How to use checksums
8bcaf1e1db769857c9365f476f7774bf569adac7f130b3f404da972cb66d9d42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page