Give CrewAI Agents a Wallet and Guardrails with ampersend
- Author: Marcus Rein
A working demo of autonomous agent payments with CrewAI and ampersend in 35 lines of Python.

A working demo of autonomous agent payments with CrewAI and ampersend in 35 lines of Python.

Agent swarms need wallets and wallets need guardrails. I built a CrewAI agent that has an ampersend wallet and pays for a joke with real USDC on Base.
Jump in to give CrewAI and ampersend a try.
The agent's tool wraps an HTTP call in ampersend's payment client. The tool hits the joke endpoint, however this could be any x402 seller endpoint. The server responds with a price in USDC. ampersend's client intercepts the 402, signs the payment with the agent's session key, settles it on Base, and retries the request.
No API key. No OAuth. No billing dashboard. The agent had a wallet, the server had a price, and x402 handled the handshake.
uv package managergit clone https://github.com/marcusrein/ampersend-crewai
cd ampersend-crewai
uv synccp .env.example .envAdd your ampersend smart account address and session key private key to .env. Both come from the ampersend dashboard.
uv run python crew.pyThe agent calls the paid joke API, ampersend pays, and if you see a joke, you're good to go.
This simple build is a starting point. Swap it for any x402-enabled service: ZK proof generation, compute, data feeds. The payment flow is the same. x402 is Coinbase's open payment protocol, settlement is in USDC on Base, and ampersend handles the guardrails in between.
It's easy to get started. Next steps are to consider what you want your agents to do! Go explore the x402 ecosystem and happy building.