LangChain tool for autonomous USDC payments via AgentPay
Project description
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
- Get a free API key at agentpay.xyz/get-started
- Set
AGENTPAY_API_KEY=ap_...or passapi_key=directly - Configure guardrails via dashboard or API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentpay_langchain-0.1.0.tar.gz.
File metadata
- Download URL: agentpay_langchain-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd46f1be73c0ed5eef8706f8342ea14f4de6d3c6d5275b9c64be7dcfc7b2c921
|
|
| MD5 |
2895acde7a19bed6ad9cceabc5c1ba81
|
|
| BLAKE2b-256 |
754c37a35366174b941c6ce797070c084785cca9a5e8e2065f99d93e0b797db7
|
File details
Details for the file agentpay_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentpay_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66cc2a53d1d5ffdda4d7f30ef08f09d57aa07995c9fe29ef39ae90cbdd150099
|
|
| MD5 |
1d07eae0332a7ada8f12da85c3938560
|
|
| BLAKE2b-256 |
8bcaf1e1db769857c9365f476f7774bf569adac7f130b3f404da972cb66d9d42
|