Skip to main content

Installation

pip install xenarch[agent,crewai]
Requires crewai>=0.80.0.

Tools

The SDK provides three CrewAI tool functions:
from xenarch.tools.crewai import check_gate, pay, get_history
ToolDescription
check_gateCheck if a URL has an x402 payment gate
payExecute USDC payment and return access token
get_historyView past payments for this wallet

Usage

from dotenv import load_dotenv
from crewai import Agent, Crew, Task
from xenarch.tools.crewai import check_gate, pay, get_history

load_dotenv()

researcher = Agent(
    role="Research Agent",
    goal="Access gated web content by paying when needed",
    backstory=(
        "You are a research agent that pays for gated content using "
        "Xenarch micropayments when you encounter payment gates."
    ),
    tools=[check_gate, pay, get_history],
    verbose=True,
)

task = Task(
    description=(
        "Check if https://example.com has a payment gate. "
        "If it does, pay for access and report what you found."
    ),
    expected_output="Gate status and payment result.",
    agent=researcher,
)

crew = Crew(agents=[researcher], tasks=[task], verbose=True)
result = crew.kickoff()
print(result)

Wallet configuration

Same as the core SDK — see Agent Quickstart.

Full example

See the CrewAI agent example for a complete working script.