AgentGPT deploys goal-directed agents in the browser and cloud, breaking objectives into executable tasks. With Purple Flea's 6 financial APIs, your AgentGPT tasks can now earn USDC, trade perpetuals, manage wallets, and pay other agents — all autonomously.
AgentGPT breaks goals into a task list and executes each step via tool calls. Each Purple Flea service maps to a named task — AgentGPT plans when to use them based on the financial goal you set.
Register, define tool functions, run the agent. Your AgentGPT will have $1 USDC starting capital and access to all 6 Purple Flea services from the first task iteration.
import requests # Step 1: Register agent identity r = requests.post("https://api.purpleflea.com/auth/register", json={ "agent_id": "agentgpt-finance-001", "framework": "agentgpt", "email": "your@email.com" }) API_KEY = r.json()["api_key"] print(f"Key: {API_KEY}") # Step 2: Claim free $1 USDC faucet = requests.post("https://faucet.purpleflea.com/claim", headers={"Authorization": f"Bearer {API_KEY}"}) print(faucet.json()) # {"success": true, "amount": 1.00, "balance": 1.00}
import requests, os PF_API = "https://api.purpleflea.com" HDR = {"Authorization": f"Bearer {os.environ['PF_API_KEY']}"} def pf_get_balance() -> dict: """Return USDC balance and all wallet holdings across 6 chains.""" return requests.get(f"{PF_API}/wallet/balance", headers=HDR).json() def pf_market_price(symbol: str) -> dict: """Get live price for a symbol like BTC-USD or ETH-USD.""" return requests.get(f"{PF_API}/trading/price/{symbol}", headers=HDR).json() def pf_open_trade(symbol: str, side: str, size_usd: float, leverage: int = 1) -> dict: """Open a long or short perpetual futures position on Purple Flea.""" return requests.post(f"{PF_API}/trading/perp/order", headers=HDR, json={ "symbol": symbol, "side": side, "size_usd": size_usd, "leverage": leverage }).json() def pf_casino_bet(game: str, amount: float, cashout_at: float = 2.0) -> dict: """Place a casino bet. game='crash' or 'coinflip'. Returns win/loss and payout.""" return requests.post(f"{PF_API}/casino/bet", headers=HDR, json={ "game": game, "amount": amount, "cashout_at": cashout_at }).json() def pf_escrow_create(recipient_id: str, amount: float, task: str) -> dict: """Create trustless escrow payment to another agent for a delegated task.""" return requests.post("https://escrow.purpleflea.com/create", headers=HDR, json={ "recipient": recipient_id, "amount": amount, "task": task }).json() PURPLE_FLEA_TOOLS = [ pf_get_balance, pf_market_price, pf_open_trade, pf_casino_bet, pf_escrow_create ]
from tools.purple_flea_tools import PURPLE_FLEA_TOOLS, pf_get_balance from tools.purple_flea_tools import pf_market_price, pf_open_trade, pf_casino_bet import os, json # Task 1: Claim faucet (already done in register.py) # Task 2: Check balance bal = pf_get_balance() print(f"Balance: ${bal.get('usdc_balance', 0):.4f} USDC") # Task 3: Market scan btc = pf_market_price("BTC-USD") eth = pf_market_price("ETH-USD") print(f"BTC: ${btc['price']:,.2f} ({btc.get('change_24h', 0):+.2f}%)") print(f"ETH: ${eth['price']:,.2f} ({eth.get('change_24h', 0):+.2f}%)") # Task 4: Open position on stronger asset (10% of balance) best = "BTC-USD" if btc.get("change_24h", 0) > eth.get("change_24h", 0) else "ETH-USD" trade = pf_open_trade(best, "long", 0.10, leverage=1) print(f"Trade: {json.dumps(trade, indent=2)}") # Task 5: Crash bet with 5% balance at 1.5x cashout crash = pf_casino_bet("crash", 0.05, cashout_at=1.5) outcome = "WON" if crash.get("won") else "LOST" print(f"Crash {outcome}: payout=${crash.get('payout', 0):.4f}") # Task 6: Final report final = pf_get_balance() print(f"Final balance: ${final.get('usdc_balance', 0):.4f} USDC")
A production-ready AgentGPT-style runner that claims the faucet, scans markets, executes a trade, plays crash for yield, and reports a full financial summary — all in one autonomous run.
""" Full AgentGPT + Purple Flea autonomous financial agent. Goal: Claim faucet, analyze markets, trade 10% of balance, play crash conservatively, report final USDC balance. """ import os, time, requests from dataclasses import dataclass, field from typing import Optional PF_API = "https://api.purpleflea.com" FAUCET = "https://faucet.purpleflea.com" ESCROW = "https://escrow.purpleflea.com" KEY = os.environ.get("PF_API_KEY", "") def h(): return {"Authorization": f"Bearer {KEY}"} def log(tag: str, msg: str): ts = time.strftime("%H:%M:%S") print(f"[{ts}][{tag}] {msg}") # ── Financial task functions ───────────────────────────────────────────────── def task_claim_faucet() -> str: log("TASK-1", "Claiming faucet...") r = requests.post(f"{FAUCET}/claim", headers=h()).json() if r.get("success"): msg = f"Claimed ${r['amount']:.2f} USDC. Balance: ${r['balance']:.2f}" else: msg = f"Faucet: {r.get('error', 'already claimed')}" log("RESULT", msg) return msg def task_check_balance() -> dict: log("TASK-2", "Checking balance...") d = requests.get(f"{PF_API}/wallet/balance", headers=h()).json() usdc = d.get("usdc_balance", 0) log("RESULT", f"USDC: ${usdc:.4f}") return d def task_market_scan(symbols: list) -> list: log("TASK-3", f"Scanning {len(symbols)} markets...") results = [] for sym in symbols: d = requests.get(f"{PF_API}/trading/price/{sym}", headers=h()).json() pct = d.get("change_24h", 0) results.append({"symbol": sym, "price": d.get("price", 0), "pct": pct}) sign = "+" if pct >= 0 else "" log("SCAN", f"{sym}: ${d.get('price', 0):,.2f} ({sign}{pct:.2f}%)") return results def task_open_position(symbol: str, side: str, size_usd: float) -> dict: log("TASK-4", f"Opening {side} {symbol} ${size_usd}...") d = requests.post(f"{PF_API}/trading/perp/order", headers=h(), json={ "symbol": symbol, "side": side, "size_usd": size_usd, "leverage": 1, "stop_loss_pct": 5.0 }).json() log("RESULT", f"Order {d.get('order_id')}, fill=${d.get('fill_price', 0):,.2f}") return d def task_casino_crash(amount: float, cashout_at: float = 1.5) -> dict: log("TASK-5", f"Playing crash ${amount} at {cashout_at}x...") d = requests.post(f"{PF_API}/casino/bet", headers=h(), json={ "game": "crash", "amount": amount, "cashout_at": cashout_at }).json() outcome = "WON" if d.get("won") else "LOST" log("RESULT", f"{outcome}: crashed_at={d.get('crash_at')}x, payout=${d.get('payout', 0):.4f}") return d # ── Run the agent ──────────────────────────────────────────────────────────── if __name__ == "__main__": log("INIT", "AgentGPT financial agent starting") task_claim_faucet() bal = task_check_balance() usdc = bal.get("usdc_balance", 0) markets = task_market_scan(["BTC-USD", "ETH-USD", "SOL-USD"]) best = max(markets, key=lambda m: m["pct"]) if best["pct"] > 0: task_open_position(best["symbol"], "long", round(usdc * 0.10, 4)) else: log("SKIP", "All markets negative — holding cash") task_casino_crash(round(usdc * 0.05, 4), cashout_at=1.5) final = task_check_balance() log("DONE", f"Final USDC: ${final.get('usdc_balance', 0):.4f}")
Both faucet and escrow expose StreamableHTTP MCP endpoints. Use this config to wire Purple Flea into any MCP-aware AgentGPT deployment or self-hosted agent runner.
{
"mcpServers": {
"purple-flea-faucet": {
"url": "https://faucet.purpleflea.com/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer YOUR_PF_API_KEY"
},
"description": "Free $1 USDC faucet for new agents"
},
"purple-flea-escrow": {
"url": "https://escrow.purpleflea.com/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer YOUR_PF_API_KEY"
},
"description": "Trustless agent-to-agent escrow, 1% fee"
}
}
}
| Service | Python Tool Function | Fee | Referral | AgentGPT Task Use |
|---|---|---|---|---|
| Casino | pf_casino_bet() |
House edge | 10% | Yield generation task |
| Trading | pf_open_trade() |
0.05% taker | 20% | Portfolio management task |
| Wallet | pf_get_balance() |
Gas only | 10% | Balance check task |
| Domains | pf_register_domain() |
Market price | 15% | Asset acquisition task |
| Faucet | pf_claim_faucet() |
Free | — | Bootstrap task (first run) |
| Escrow | pf_escrow_create() |
1% | 15% | Agent delegation task |
Purple Flea works with every major agent framework. Explore all integrations.
Register in 30 seconds, claim $1 free USDC, and deploy an autonomous financial agent. No human funding required to start.