Documentation Index
Fetch the complete documentation index at: https://docs.xenarch.com/llms.txt
Use this file to discover all available pages before exploring further.
Installation
pip install xenarch[agent,langchain]
Requires langchain>=0.3.0.
The SDK provides three LangChain tools:
from xenarch.tools.langchain import CheckGateTool, PayTool, GetHistoryTool
tools = [CheckGateTool(), PayTool(), GetHistoryTool()]
| Tool | Description |
|---|
CheckGateTool | Check if a URL has an x402 payment gate |
PayTool | Execute USDC payment and return access token |
GetHistoryTool | View past payments for this wallet |
Usage with LangGraph
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from xenarch.tools.langchain import CheckGateTool, PayTool, GetHistoryTool
load_dotenv()
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
tools = [CheckGateTool(), PayTool(), GetHistoryTool()]
agent = create_react_agent(
llm,
tools,
prompt=(
"You are a helpful assistant with Xenarch payment tools. "
"You can check URLs for payment gates, pay for gated content, "
"and review payment history."
),
)
result = agent.invoke({
"messages": [{
"role": "user",
"content": "Check if example.com has a paywall and pay if needed."
}]
})
Using with other LLMs
# Anthropic
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-sonnet-4-20250514")
# Local model via Ollama
from langchain_community.llms import Ollama
llm = Ollama(model="llama3")
Wallet configuration
The tools use the same wallet configuration as the core SDK:
XENARCH_PRIVATE_KEY environment variable
~/.xenarch/config.json
~/.xenarch/wallet.json
- Auto-generate on first use
See Agent Quickstart for wallet setup.
Full example
See the LangChain agent example for a complete working script.