Most AI agent tutorials stop at "here's an agent that searches the web." Maybe it books a restaurant, summarizes a PDF, or writes an email. That's useful — but it's not the full vision. The next generation of autonomous agents needs to do something more significant: participate in the economy. That means sending payments, receiving funds, swapping tokens across chains, and managing a budget over time. To do any of that, your agent needs a wallet. Not a wallet you paste an address into — a wallet it owns. This guide gets you there in 60 seconds flat.
What Makes a Good Agent Wallet?
Not every wallet solution is suited for autonomous agents. A browser extension like MetaMask requires a human to click "confirm." A custodial exchange account requires KYC and has withdrawal limits. What you need is something purpose-built for programmatic, non-human operation. A good agent wallet has five properties:
- Non-custodial — the agent (not a third party) controls the private keys. No one can freeze or confiscate funds.
- Multi-chain — a single identity across Ethereum, Solana, Bitcoin, and beyond. One mnemonic, many addresses.
- Programmatic — accessible via REST API, not a browser UI. Your agent calls an endpoint, not a popup.
- Deterministic — the same BIP-39 mnemonic always produces the same addresses on every chain, forever. This is the foundation of HD wallet derivation.
- Auditable — every transaction is on-chain and verifiable. No hidden fees, no off-chain settlement surprises.
The root secret for all of this is a BIP-39 mnemonic — a 12 or 24-word phrase that is the mathematical seed for an infinite tree of private keys. Lose the mnemonic, lose everything. Guard it accordingly.
The Purple Flea Wallet API
Purple Flea provides a hosted, non-custodial HD wallet service designed from the ground up for AI agents. Here's how it works: you generate a BIP-39 mnemonic once (or bring your own), and Purple Flea's API derives addresses for six chains — Ethereum, Solana, Bitcoin, Polygon, Arbitrum, and Base. You can send, receive, and swap tokens entirely via REST. Your agent stores the mnemonic in its secure environment (an environment variable or secrets manager); Purple Flea handles the cryptographic heavy lifting of key derivation and transaction signing on your behalf. There are no browser flows, no email confirmations, no human steps anywhere in the loop.
Step 1 — Get an API Key
Sign up at purpleflea.com. Your API key is issued instantly — no KYC required. It will look like pf_live_xxxxxxxxxxxxxxxxxxxx. Keep it in an environment variable: export PURPLE_FLEA_KEY=pf_live_.... Never hard-code it in source files.
Step 2 — Create a Wallet
Send a single POST request to create a new HD wallet. The API returns a fresh BIP-39 mnemonic and a stable wallet_id you'll use for all subsequent calls. Write down the mnemonic — if Purple Flea's servers ever disappeared, you could still recover every address and private key using any BIP-39-compatible tool.
# Create a new HD wallet
curl -X POST https://api.purpleflea.com/v1/wallet/create \
-H "Authorization: Bearer $PURPLE_FLEA_KEY" \
-H "Content-Type: application/json"
# Response
{
"wallet_id": "wlt_01HX4KBTZ8MFQN3V9YD2CPJR7",
"mnemonic": "abandon ability able about above absent absorb abstract absurd abuse access accident",
"created_at": "2026-02-26T10:00:00Z"
}
Store the mnemonic in a secrets manager (AWS Secrets Manager, HashiCorp Vault, or at minimum an environment variable). Never log it. Never commit it to git. Never send it over HTTP.
Step 3 — Get Addresses
Once you have a wallet_id, derive addresses for any supported chain. The derivation is deterministic — the same wallet always produces the same address for a given chain. You can call this endpoint any number of times; it will always return the same address.
# Get Ethereum address
curl https://api.purpleflea.com/v1/wallet/wlt_01HX4KBTZ8MFQN3V9YD2CPJR7/address?chain=ethereum \
-H "Authorization: Bearer $PURPLE_FLEA_KEY"
# Response: { "chain": "ethereum", "address": "0x4f3B...c9A1", "path": "m/44'/60'/0'/0/0" }
# Get Solana address
curl https://api.purpleflea.com/v1/wallet/wlt_01HX4KBTZ8MFQN3V9YD2CPJR7/address?chain=solana \
-H "Authorization: Bearer $PURPLE_FLEA_KEY"
# Response: { "chain": "solana", "address": "7xKX...Pq4Z", "path": "m/44'/501'/0'/0'" }
# Get Bitcoin address
curl https://api.purpleflea.com/v1/wallet/wlt_01HX4KBTZ8MFQN3V9YD2CPJR7/address?chain=bitcoin \
-H "Authorization: Bearer $PURPLE_FLEA_KEY"
# Response: { "chain": "bitcoin", "address": "bc1q...xt7k", "path": "m/84'/0'/0'/0/0" }
Step 4 — Check Balance
The balance endpoint aggregates token balances across all chains into a single JSON response. Native assets (ETH, SOL, BTC) and ERC-20 / SPL tokens with non-zero balances are all included. Your agent can poll this endpoint to decide how much it has to spend, or whether to wait for incoming funds before proceeding.
# Get all balances
curl https://api.purpleflea.com/v1/wallet/wlt_01HX4KBTZ8MFQN3V9YD2CPJR7/balance \
-H "Authorization: Bearer $PURPLE_FLEA_KEY"
# Response
{
"wallet_id": "wlt_01HX4KBTZ8MFQN3V9YD2CPJR7",
"balances": [
{ "chain": "ethereum", "asset": "ETH", "amount": "0.25", "usd_value": "625.00" },
{ "chain": "ethereum", "asset": "USDC", "amount": "500.00", "usd_value": "500.00" },
{ "chain": "solana", "asset": "SOL", "amount": "4.12", "usd_value": "618.00" },
{ "chain": "bitcoin", "asset": "BTC", "amount": "0.0041", "usd_value": "410.00" }
],
"total_usd": "2153.00"
}
Step 5 — Send a Transaction
Sending funds is a single POST. Specify the chain, destination address, amount, and asset. Purple Flea handles gas estimation, nonce management, and transaction broadcasting. The response includes the tx_hash which you can verify on any block explorer. For Ethereum, the transaction is confirmed in seconds; for Bitcoin, expect 10–60 minutes.
# Send 50 USDC on Ethereum
curl -X POST https://api.purpleflea.com/v1/wallet/wlt_01HX4KBTZ8MFQN3V9YD2CPJR7/send \
-H "Authorization: Bearer $PURPLE_FLEA_KEY" \
-H "Content-Type: application/json" \
-d '{
"chain": "ethereum",
"to": "0xRecipientAddress",
"amount": "50",
"asset": "USDC"
}'
# Response
{
"tx_hash": "0xabc123...def456",
"chain": "ethereum",
"status": "broadcast",
"estimated_confirmation": "15s"
}
Integrating with LangChain
Purple Flea ships a first-class LangChain tool that wraps the entire wallet API. Import PurpleFlecaWalletTool, pass your API key and wallet ID, and drop it into any agent executor. Your agent can now natively reason about balances and payments as part of its tool-use loop. See the full reference at /for-langchain.
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from purpleflea import PurpleFlecaWalletTool
wallet_tool = PurpleFlecaWalletTool(
api_key=os.environ["PURPLE_FLEA_KEY"],
wallet_id=os.environ["WALLET_ID"]
)
llm = ChatOpenAI(model="gpt-4o", temperature=0)
agent = initialize_agent(
tools=[wallet_tool],
llm=llm,
agent=AgentType.OPENAI_FUNCTIONS,
verbose=True
)
agent.run("Check my ETH balance and send 10 USDC to 0xRecipient if I have enough.")
Integrating with CrewAI
In CrewAI, tools are functions decorated with @tool. Wrap the Purple Flea SDK calls inside a decorated function and assign it to whichever agent in your crew handles financial operations. Here's a minimal example — see /for-crewai for the full multi-agent pattern.
from crewai_tools import tool
from purpleflea import PurpleFlecaClient
client = PurpleFlecaClient(api_key=os.environ["PURPLE_FLEA_KEY"])
@tool("crypto_wallet")
def crypto_wallet(action: str, chain: str, to: str = "", amount: str = "") -> str:
"""Interact with the agent's crypto wallet. Actions: balance, send."""
wid = os.environ["WALLET_ID"]
if action == "balance":
return str(client.wallet(wid).balance())
elif action == "send":
return str(client.wallet(wid).send(chain=chain, to=to, amount=amount))
return "Unknown action"
Security Best Practices
A wallet your agent can use autonomously is also a wallet that malicious prompts can drain. Treat it like a hot wallet — keep only operating capital in it, never your life savings. Here are the non-negotiables:
- Never log mnemonics or private keys. Configure your logging framework to redact any string matching the mnemonic pattern before it hits disk or stdout.
- Use environment variables or secrets managers (AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault) — never hard-code secrets in source files or Docker images.
- Consider HSMs for production. A Hardware Security Module provides the strongest guarantee that a private key never leaves a tamper-resistant chip.
- Rotate API keys regularly. If you suspect an API key has been exposed, rotate it immediately from the Purple Flea dashboard.
- Monitor for unusual activity. Set up webhooks for large outbound transactions and alert a human when thresholds are breached.
- Set spending limits. Purple Flea supports per-key daily spending limits — use them to cap the blast radius of a compromised agent.
What's Next?
Your agent now has a fully functional, multi-chain, non-custodial crypto wallet. That's the financial foundation. From here, the Purple Flea ecosystem lets you go further: connect the Trading API to open leveraged perpetual positions on Hyperliquid across 275 markets, or the Casino API for provably fair games where every outcome is cryptographically verifiable. The vision is a self-sustaining agent economy — agents that earn, spend, invest, and compound autonomously, 24 hours a day, without a human in the loop. You've just taken the first step.
Ready to get started? Sign up at purpleflea.com, grab your API key, and have your agent's first wallet running in under a minute. The full API reference lives at /docs.