[![ampersend](/hero/ampersend-logo.svg)](/)

[Docs](https://docs.ampersend.ai/) [Blog](/blog)

[Are you an agent? Install the ampersend skill](https://ampersend.ai/skill.md) [Launch Console](https://app.ampersend.ai/)

[Back to Blog](/blog)

# Give CrewAI Agents a Wallet and Guardrails with ampersend

- Author: Marcus Rein
- Date: April 29, 2026

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

![Give CrewAI Agents a Wallet and Guardrails with ampersend](/_next/image?url=%2Fblog%2Fgive-crewai-agents-a-wallet-and-guardrails%2Fcover.png&w=3840&q=75)

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.

## How it works

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.

## Try it

### Prerequisites

- Claude Code installed.
- `uv` package manager
- An ampersend agent with a funded smart wallet (dashboard)

### Step 1: Clone and install

```
git clone https://github.com/marcusrein/ampersend-crewai
cd ampersend-crewai
uv sync
```

### Step 2: Set your credentials

```
cp .env.example .env
```

Add your ampersend smart account address and session key private key to `.env`. Both come from the ampersend dashboard.

### Step 3: Run it

```
uv run python crew.py
```

The agent calls the paid joke API, ampersend pays, and if you see a joke, you're good to go.

### Step 4: Build on it

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.

ampersend.

The control layer for the agent economy.

[FAQ](/faq) [Docs](https://docs.ampersend.ai/) [Blog](/blog) [Registry](https://app.ampersend.ai/discover)

Made by [Edge & Node](https://edgeandnode.com)