Skip to main content

crewai-purpleflea

CrewAI tools for Purple Flea — casino, trading, wallet, and domain APIs built for autonomous AI agents.

Installation

pip install crewai-purpleflea

What's Inside

17 @tool decorated functions covering:

Category Tools
Casino casino_register, casino_bet, casino_balance, casino_referral_stats
Trading trading_register, trading_open_position, trading_close_position, trading_markets, trading_referral_stats
Wallet wallet_create, wallet_balance, wallet_swap, wallet_referral_stats
Domains domain_search, domain_purchase, domain_add_record, domain_list_records

Quickstart

from crewai import Agent, Task, Crew
from crewai_purpleflea import (
    trading_markets,
    trading_open_position,
    trading_close_position,
    casino_bet,
    casino_balance,
    wallet_swap,
)

API_KEY = "sk_live_..."

trader = Agent(
    role="Autonomous Trader",
    goal=(
        "Monitor Purple Flea's 275+ perpetual futures markets and execute profitable trades. "
        "Manage risk with position sizing and stop losses."
    ),
    backstory=(
        "You are a quantitative trading agent with access to Hyperliquid's full market "
        "depth via Purple Flea Trading. You trade stocks, crypto, commodities, and forex."
    ),
    tools=[trading_markets, trading_open_position, trading_close_position],
)

casino_agent = Agent(
    role="Casino Strategist",
    goal="Use Kelly Criterion to size bets optimally on provably fair casino games.",
    backstory="You are a probability expert who plays provably-fair games using optimal bet sizing.",
    tools=[casino_balance, casino_bet],
)

scan_task = Task(
    description=(
        f"Use api_key='{API_KEY}'. Scan all available markets and identify the top 3 "
        "with highest funding rates. Open a $50 short position on the highest."
    ),
    expected_output="Position ID, entry price, and liquidation price.",
    agent=trader,
)

bet_task = Task(
    description=(
        f"Use api_key='{API_KEY}'. Check casino balance. "
        "If above $20, play coin_flip with $5 on heads."
    ),
    expected_output="Game result, payout, and new balance.",
    agent=casino_agent,
)

crew = Crew(agents=[trader, casino_agent], tasks=[scan_task, bet_task])
result = crew.kickoff()
print(result)

Tool Reference

Casino

casino_register(username, email, api_key, referral_code="")

Register a new casino account. Pass a referral code to credit the referring agent (they earn 10% of your net losses forever).

casino_bet(game, amount, api_key, options="{}")

Place a bet. Games: coin_flip, dice, roulette, crash. Options is a JSON string for game-specific params.

casino_balance(api_key)

Get current casino wallet balance.

casino_referral_stats(api_key)

View referred agents and earned commissions (10% of their losses).

Trading

trading_register(username, email, api_key, referral_code="")

Register for trading access to 275+ perpetual futures markets.

trading_open_position(market, side, size_usd, api_key, leverage=1)

Open a long or short position. Leverage 1-50x.

trading_close_position(position_id, api_key)

Close a position and realize P&L.

trading_markets(api_key)

List all 275+ markets with prices, funding rates, and volume.

trading_referral_stats(api_key)

View trading referral commissions (20% of fees from referred agents — forever).

Wallet

wallet_create(chain, api_key, referral_code="", label="")

Create a non-custodial HD wallet. Chains: ethereum, bitcoin, solana, tron, polygon, arbitrum, base, bnb.

wallet_balance(address, chain, api_key)

Check token balances for any address.

wallet_swap(wallet_id, from_token, to_token, amount, api_key, slippage=0.5)

Swap tokens at best DEX rate.

wallet_referral_stats(api_key)

View swap referral commissions (10% of fees).

Domains

domain_search(query, api_key, tlds="")

Search domain availability. tlds is a comma-separated string like "com,ai,io".

domain_purchase(domain, api_key, years=1, auto_renew=True)

Register a domain name.

domain_add_record(domain, record_type, name, value, api_key, ttl=3600)

Add DNS record (A, CNAME, MX, TXT, etc.).

domain_list_records(domain, api_key)

List all DNS records for a domain.

Referral Program

Agents earn recurring commissions from agents they refer:

  • Casino: 10% of referred agents' net losses
  • Trading: 20% of referred agents' trading fees — forever
  • Wallet: 10% of referred agents' swap fees

License

MIT

Metadata

Release files for crewai-purpleflea 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crewai-purpleflea 0.1.0
File Size Uploaded
crewai_purpleflea-0.1.0.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crewai-purpleflea 0.1.0
File Interpreter ABI Platform
crewai_purpleflea-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / crewai_purpleflea-0.1.0.tar.gz

Download URL crewai_purpleflea-0.1.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a4aacf39d54ca0beb467e7daa52637abee6d347f9eec07ee0f76e6b1a2ed6dfe
BLAKE2b-256 checksum
How to use checksums
9a0a0c8d36524ba8af59392b1100b86da4e1f9c577520d6968c1504a27d616a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / crewai_purpleflea-0.1.0-py3-none-any.whl

Download URL crewai_purpleflea-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43e3687351da1b5a89a599701798c172fa03e045b9dab410c9cc30a34f2d7162
BLAKE2b-256 checksum
How to use checksums
1d3292dcfe8f001cecac9f0bb5157d3c0244f17f1dbf1f45523a20c3d5e7f860
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page