CAMEL-AI Integration

Purple Flea for CAMEL-AI

CAMEL's collaborative role-playing agents excel at complex reasoning and task delegation. Now they can also execute real financial operations — trade markets, play casino games, send crypto, register domains, and escrow funds with Purple Flea.

Get Free API Key → View Docs

What is CAMEL-AI?

CAMEL (Communicative Agents for "Mind" Exploration of Large Language Model Society) is a multi-agent framework where agents take on specialized roles and collaborate via structured conversations.

🎭
Role-Playing Agents
CAMEL agents take on roles like "Crypto Analyst", "Risk Manager", and "Trade Executor" — then collaborate to solve complex financial tasks through structured dialogue.
🧠
Society of Mind
Multiple specialized agents form a "society" that can tackle tasks too complex for a single agent. Perfect for multi-step financial workflows with checks and balances.
🛠️
Tool Use & Functions
CAMEL supports function calling and tool use. Purple Flea's toolkit integrates as callable tools that CAMEL agents can invoke during their collaborative reasoning.

Integration Examples

Define Purple Flea tools and embed them in CAMEL agent conversations.

Define Purple Flea Toolkit

from camel.toolkits import BaseToolkit, FunctionTool import purpleflea as pf pf_client = pf.Client(api_key="YOUR_API_KEY") class PurpleFleatToolkit(BaseToolkit): """Purple Flea crypto toolkit for CAMEL agents.""" def get_wallet_balance(self, chain: str = "all") -> dict: """Get current crypto wallet balance.""" return pf_client.wallet.get_balance(chain=chain) def get_market_price(self, symbol: str) -> dict: """Get current price for a cryptocurrency symbol.""" return pf_client.trading.get_price(symbol) def open_trade(self, symbol: str, side: str, size: float, leverage: int = 1) -> dict: """Open a perpetual futures position.""" return pf_client.trading.open_trade( symbol=symbol, side=side, size=size, leverage=leverage ) def play_dice(self, bet_amount: float, target: int, direction: str = "over") -> dict: """Play provably fair dice game.""" return pf_client.casino.play_dice( bet_amount=str(bet_amount), target=target, direction=direction ) def get_tools(self) -> list[FunctionTool]: return [ FunctionTool(self.get_wallet_balance), FunctionTool(self.get_market_price), FunctionTool(self.open_trade), FunctionTool(self.play_dice), ]

Two-Agent Trading System

from camel.agents import ChatAgent from camel.models import ModelFactory from camel.types import ModelType, ModelPlatformType toolkit = PurpleFleatToolkit() tools = toolkit.get_tools() model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI, model_type=ModelType.GPT_4O, ) # Analyst agent: research and recommend analyst = ChatAgent( system_message="""You are a crypto market analyst. Use tools to check prices and analyze trends. Provide BUY, SELL, or HOLD recommendations.""", model=model, tools=tools ) # Trader agent: execute decisions trader = ChatAgent( system_message="""You are a trade executor. When given a recommendation, execute the trade using available tools. Always check balance first.""", model=model, tools=tools ) # Analyst researches, then trader executes analysis = analyst.step( "Analyze BTC and ETH. What's the best trade now?" ) print(f"Analyst: {analysis.msg.content}") execution = trader.step( f"Execute this recommendation: {analysis.msg.content}" ) print(f"Trader: {execution.msg.content}")

3-Agent Financial Society

from camel.societies import RolePlaying # AI Society: three agents collaborate on financial decisions role_playing = RolePlaying( assistant_role_name="Crypto Fund Manager", user_role_name="Risk Analyst", assistant_agent_kwargs={ "tools": tools, "model": model }, user_agent_kwargs={ "tools": tools, "model": model }, task_prompt=""" Manage a 0.1 ETH crypto portfolio for maximum returns. The Fund Manager proposes trades. The Risk Analyst approves or vetoes based on risk. Execute approved trades via Purple Flea API. Target: 10% return while staying under 5% drawdown. """ ) n, chat_turn_limit = 0, 10 input_msg = role_playing.init_chat() while n < chat_turn_limit: n += 1 assistant_response, user_response = role_playing.step(input_msg) if assistant_response.terminated or user_response.terminated: break print(f"[{n}] Fund Manager: {assistant_response.msg.content[:200]}") print(f"[{n}] Risk Analyst: {user_response.msg.content[:200]}") input_msg = assistant_response.msg

Casino Strategy Agent

from camel.agents import ChatAgent casino_agent = ChatAgent( system_message="""You are a casino strategy agent. You apply Kelly Criterion to optimize bet sizes. Your goal: maximize expected value while managing bankroll. Rules: - Never bet more than 5% of bankroll - Stop if balance drops below 50% of starting value - Track wins/losses and adjust strategy accordingly """, model=model, tools=tools ) # Let the agent manage its own casino session response = casino_agent.step( """Start a casino session: 1. Check current wallet balance 2. Calculate 2% Kelly bet size 3. Play 5 rounds of dice (target: 60, direction: over) 4. Report final results and P&L """ ) print(response.msg.content)

CAMEL + Purple Flea Use Cases

🏦
Multi-Agent Hedge Fund
Analyst, Quant, Risk Manager, and Trader agents collaborate via CAMEL's society model. Each role has specific Purple Flea tools available. Real trades execute on consensus.
🎯
Debate-Driven Trading
Two CAMEL agents debate bull vs bear cases for a trade. A third agent arbitrates and executes via Purple Flea. Better decisions through structured argument.
🌐
Domain Acquisition Team
Research agent identifies valuable domains, valuation agent prices them, negotiation agent finalizes terms, and executor registers via Purple Flea's domain API.

Give Your CAMEL Agents Real Financial Power

Purple Flea transforms CAMEL's theoretical role-playing into real financial action. Get your API key and start building.