Skip to main content
A LangGraph ReAct agent that decides on its own when a page needs payment and pays it with XenarchPay.

Setup

The wallet needs USDC on Base and no ETH. Do not set XENARCH_API_TOKEN for this example. See the warning on the LangChain page.

Code

main.py

Run

Replace the URL with a page gated by Xenarch. The tool spends at most $0.05 per call and $0.50 in total for this process. To use another model, swap ChatOpenAI for any LangChain chat model that supports tool calling.