Purple Flea ships plain Python functions that drop straight into any
Swarm
agent. Casino, trading, wallet, and domain tools — each one a function
your orchestrator can hand off to a specialised worker agent.
OpenAI Swarm is a lightweight, experimental framework for building multi-agent systems in Python. Rather than a monolithic agent, Swarm lets you define a network of specialised agents — each owning a narrow set of tools — and an orchestrator that routes tasks between them via handoffs.
Agents expose capabilities as plain Python functions. The orchestrator calls
those functions or transfers control entirely to a specialised agent by
returning an Agent
object from a function. This makes Swarm extremely composable and easy to test.
Purple Flea functions are standard Python callables — no special adapters
required. Drop them into any Swarm agent's
functions
list and they are immediately available to that agent and any orchestrator
that controls it.
Multi-agent topology
The crewai-purpleflea package
ships standalone REST helpers that work with Swarm, CrewAI, or any other Python
agent framework. Install once, use everywhere.
Any plain Python function becomes a Swarm tool. The function calls the Purple Flea casino API and returns a human-readable string the LLM can reason about.
Two functions give a Swarm trading agent the ability to open and close perpetual futures positions across 275 markets on Hyperliquid.
A complete Swarm multi-agent system. The orchestrator analyses incoming requests and hands off to casino, trading, or wallet agents — each registered with the orchestrator's referral code so commissions accumulate centrally.
Swarm handoffs preserve context across agent boundaries. By embedding your referral code in the shared client object, every Purple Flea API call — regardless of which worker agent makes it — credits your account.
Every position your Swarm trading agent opens or closes earns 20% of the exchange fee back to your referral account.
Casino bets placed by your agents generate 10% commission on house edge. Compounds quickly across many agents.
Wallet swaps and domain registrations made by any of your worker agents also earn referral income automatically.
These are the standard Purple Flea Swarm functions. Each is a plain Python
callable — add any subset to any agent's functions list.
| Function | API | Description |
|---|---|---|
| casino_flip(amount, side) | Casino | Provably fair coin flip — 'heads' or 'tails', 1.98x payout |
| casino_dice(amount, target, over) | Casino | Roll dice against a target from 1–99, configurable payout multiplier |
| trading_open(market, side, size_usd, leverage) | Trading | Open a long or short perpetual futures position, 1x–50x leverage |
| trading_close(order_id) | Trading | Close an open position and realise PnL |
| wallet_create(chain) | Wallet | Create a new HD wallet on ETH, BTC, SOL, TRON, BNB, or MATIC |
| wallet_swap(from_token, to_token, amount) | Wallet | Cross-chain or same-chain token swap via best-rate DEX routing |
| domain_search(query) | Domains | Check availability and price for any domain name or TLD |
| domain_register(name, years) | Domains | Register a domain and pay with USDC from the agent wallet |
Sign up at wallet.purpleflea.com. You receive an API key, a referral code, and a BIP-39 mnemonic for your agent's HD wallet. Store all three in environment variables.
Run pip install openai-swarm crewai-purpleflea. The Purple Flea package provides pre-written function implementations; Swarm provides the orchestration runtime.
Create worker agents with Purple Flea functions in their functions list. Create an orchestrator with handoff functions that return worker agents. Pass your referral code via the shared client or context_variables.
Call client.run(agent=orchestrator, messages=[...]). Every API call your Swarm makes earns referral commissions automatically. Check earnings at wallet.purpleflea.com.
No wrappers, no base classes. Swarm uses plain callables — Purple Flea functions are exactly that. Paste them into any agent without modification.
Referral codes survive agent handoffs when stored as module-level constants or passed through Swarm's context_variables. Commissions never get lost.
Casino functions include server seed hashes and client seed mixing. Every outcome is cryptographically verifiable — your agent can audit its own bets on-chain.
Trading functions cover all Hyperliquid perpetual futures markets. Up to 50x leverage, no KYC, instant settlement — accessed via a simple function call.
Each agent gets a unique wallet derived from a BIP-39 mnemonic. Six chains supported. Your agent controls its own keys — Purple Flea never holds funds.
Orchestrators earn 10–20% commissions on every API call any of their worker agents makes. The larger your Swarm, the more you earn.
Free to start. No KYC. Earn commissions on every call your agents make.