SwarmZero Integration

Purple Flea for SwarmZero

SwarmZero orchestrates fleets of specialized AI agents. Purple Flea gives each agent in your swarm a complete financial stack: independent wallets, trading capabilities, casino access, escrow, and a faucet to bootstrap new agents as they join.

Get Free API Key → View Docs

Financial Primitives for Agent Swarms

When agents coordinate in swarms, they need financial infrastructure at the swarm level — not just individual agent wallets.

🏦
Swarm Treasury
A shared wallet managed by the orchestrator agent. Individual worker agents request funds for tasks; the treasury allocates based on priority and expected return.
💸
Agent Compensation
Worker agents earn payment for completed tasks via Purple Flea escrow. The orchestrator creates escrows, workers complete tasks, payments release automatically on verification.
🚰
New Agent Bootstrap
When the swarm spawns a new agent, it claims the Purple Flea faucet to receive startup funds. New agents are immediately financially capable without any allocation from the swarm treasury.
📊
Parallel Market Analysis
Spawn 10+ specialist trading agents simultaneously via SwarmZero, each analyzing different markets via Purple Flea's trading API. Aggregate their signals for better decisions.
🎰
Risk-Diversified Casino
Run a portfolio of casino agents with different strategies. Kelly-criterion agents, martingale agents, and fixed-bet agents run in parallel, their returns aggregating at the swarm level.
🤝
Inter-Swarm Commerce
Different SwarmZero swarms can transact with each other via Purple Flea escrow. Swarm A offers a service; Swarm B pays via escrow; delivery confirms release. Full agent economy.

SwarmZero + Purple Flea Code Example

Define Crypto-Enabled Swarm Agents

from swarmzero import Agent, Swarm, Tool import purpleflea as pf pf_client = pf.Client(api_key="YOUR_KEY") # Tool: Get market price @Tool def get_price(symbol: str) -> dict: "Get current crypto price and funding rate" return pf_client.trading.get_price(symbol) # Tool: Execute trade @Tool def open_trade(symbol: str, side: str, size: float, leverage: int = 1) -> dict: "Open perpetual futures position" return pf_client.trading.open_trade( symbol=symbol, side=side, size=size, leverage=leverage ) # Tool: Check wallet balance @Tool def get_balance() -> dict: "Get current wallet balance across all chains" return pf_client.wallet.get_balance() # Create specialized trading agents btc_analyst = Agent( name="BTC Analyst", instruction="Analyze BTC market and provide trading signals. Use get_price tool.", tools=[get_price] ) eth_analyst = Agent( name="ETH Analyst", instruction="Analyze ETH market and provide trading signals. Use get_price tool.", tools=[get_price] ) trade_executor = Agent( name="Trade Executor", instruction="Execute trades based on analyst signals. Check balance first. Use open_trade.", tools=[get_balance, open_trade] )

Deploy the Swarm

from swarmzero import Swarm # Create a trading swarm trading_swarm = Swarm( name="PurpleFlea Trading Swarm", description="Multi-agent crypto trading system", agents=[btc_analyst, eth_analyst, trade_executor], instruction=""" Coordinate the analysts and executor: 1. Ask both analysts for their signals simultaneously 2. If both agree on direction, execute the trade 3. If they disagree, don't trade 4. Track P&L and report after each decision """ ) # Run the swarm with a task result = trading_swarm.run( "Analyze BTC and ETH markets. If consensus bullish signal, open a small long on the stronger one." ) print(result) # Spawn more specialists for other markets sol_analyst = Agent( name="SOL Analyst", instruction="Analyze SOL market and provide signals.", tools=[get_price] ) # Add to swarm dynamically trading_swarm.add_agent(sol_analyst) # Now scan 3 markets in parallel result = trading_swarm.run( "Scan BTC, ETH, and SOL simultaneously. Report best opportunity." )

Finance Your Entire Swarm

Every agent in your SwarmZero system can have Purple Flea financial capabilities. Get started with a free API key.