🤖 AutoGen Studio

Purple Flea for AutoGen Studio

Give your AutoGen multi-agent workflows financial superpowers. Purple Flea adds crypto wallets, perpetual trading, trustless escrow, and provably fair casino to AutoGen Studio — via REST or MCP tool calls.

Get API Key Free AutoGen Core Guide

AutoGen Studio + Purple Flea

AutoGen Studio is Microsoft's visual interface for building multi-agent systems. Purple Flea extends AutoGen agents with financial primitives — letting them own wallets, execute trades, and settle payments autonomously.

AutoGen Studio UI
Workflow Designer
Agent Gallery
↓ spawns agents ↓
Orchestrator Agent
Analyst Agent
Executor Agent
Risk Agent
↓ calls financial tools ↓
Purple Flea API
Wallets
Trading
Escrow
💼

FunctionTool Integration

Register Purple Flea operations as FunctionTool objects in AutoGen 0.4+. Agents discover and call send_payment, open_trade, and check_balance through AutoGen's built-in tool-calling loop.

🔌

MCP Server Support

AutoGen Studio 0.4 supports MCP tool servers. Point your agents at https://api.purpleflea.com/mcp to expose all 40+ financial tools without writing a single tool function.

🏦

Agent Wallets

Each AutoGen agent can have its own Purple Flea wallet — isolated funds, separate keys. Escrow agent holds funds in trust, executor agent spends, orchestrator agent monitors. True financial separation.

📊

Trading Workflows

Build AutoGen workflows where one agent generates trade signals, another validates risk, and a third executes via Purple Flea's perpetuals API. 275 markets, 50x leverage, all callable from within AutoGen.

🔒

Escrow Between Agents

AutoGen agents can lock funds in Purple Flea escrow before performing work. The orchestrator releases payment when task completion is confirmed — trustless coordination without a central ledger.

📈

Financial State in Context

Agents can query wallet balances and position data and include financial context in their reasoning. AutoGen's ConversableAgent loop naturally incorporates portfolio state when making decisions.

Define Financial Tools

Register Purple Flea operations as AutoGen FunctionTool objects. Works with both AutoGen 0.4 (autogen-agentchat) and older 0.2 (pyautogen) APIs.

# autogen_purpleflea_tools.py — Purple Flea tools for AutoGen agents import requests from autogen_core.tools import FunctionTool from typing import Optional PURPLE_FLEA_API = "https://api.purpleflea.com/v1" HEADERS = {"X-API-Key": "pf_your_key_here"} def get_wallet_balance(wallet_id: str) -> dict: """Return wallet balances across all supported chains.""" r = requests.get(f"{PURPLE_FLEA_API}/wallet/balance?wallet_id={wallet_id}", headers=HEADERS) r.raise_for_status() return r.json()["balances"] def send_crypto_payment(from_wallet: str, to_address: str, amount: float, asset: str) -> dict: """Send a crypto payment. Returns tx hash and status.""" payload = {"from_wallet": from_wallet, "to_address": to_address, "amount": amount, "asset": asset} r = requests.post(f"{PURPLE_FLEA_API}/wallet/send", json=payload, headers=HEADERS) r.raise_for_status() return r.json() def open_perpetual_trade(wallet_id: str, market: str, side: str, size_usd: float, leverage: int = 5) -> dict: """Open a perpetual futures position. side: 'long' or 'short'.""" payload = {"wallet_id": wallet_id, "market": market, "side": side, "size_usd": size_usd, "leverage": leverage} r = requests.post(f"{PURPLE_FLEA_API}/trading/open", json=payload, headers=HEADERS) r.raise_for_status() return r.json() def create_escrow(sender_wallet: str, recipient_address: str, amount: float, asset: str, release_condition: str) -> dict: """Create a trustless escrow between two agents.""" payload = {"sender": sender_wallet, "recipient": recipient_address, "amount": amount, "asset": asset, "condition": release_condition} r = requests.post(f"https://escrow.purpleflea.com/api/create", json=payload, headers=HEADERS) r.raise_for_status() return r.json() # Wrap as AutoGen FunctionTool objects balance_tool = FunctionTool(get_wallet_balance, description="Check crypto wallet balance by wallet ID") payment_tool = FunctionTool(send_crypto_payment, description="Send crypto payment from agent wallet to address") trade_tool = FunctionTool(open_perpetual_trade, description="Open perpetual futures position on any of 275 markets") escrow_tool = FunctionTool(create_escrow, description="Create trustless escrow for agent-to-agent payments") PURPLE_FLEA_TOOLS = [balance_tool, payment_tool, trade_tool, escrow_tool]

Multi-Agent Trading Workflow

Wire up a 4-agent trading system in AutoGen Studio. One agent researches markets, one validates risk, one executes trades, and an orchestrator coordinates the loop.

# autogen_trading_team.py — coordinated trading with Purple Flea import asyncio from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.teams import RoundRobinGroupChat from autogen_ext.models.openai import OpenAIChatCompletionClient from autogen_purpleflea_tools import PURPLE_FLEA_TOOLS model_client = OpenAIChatCompletionClient(model="gpt-4o") # Signal generator: finds trading opportunities signal_agent = AssistantAgent( name="SignalAgent", model_client=model_client, tools=PURPLE_FLEA_TOOLS, system_message="""You analyze crypto markets and generate trade signals. Use get_wallet_balance to check available capital. Output structured signals: {market, direction, confidence, reasoning}""" ) # Risk agent: validates signals against risk limits risk_agent = AssistantAgent( name="RiskAgent", model_client=model_client, tools=PURPLE_FLEA_TOOLS, system_message="""You validate trade signals. Reject if: - Size > 5% of portfolio - Leverage > 10x - More than 3 open positions Reply APPROVED or REJECTED with reasoning.""" ) # Executor: opens approved trades via Purple Flea executor_agent = AssistantAgent( name="ExecutorAgent", model_client=model_client, tools=PURPLE_FLEA_TOOLS, system_message="""You execute approved trade signals using open_perpetual_trade. Only execute trades with APPROVED status from RiskAgent. Confirm execution with tx ID.""" ) # Assemble the team trading_team = RoundRobinGroupChat( participants=[signal_agent, risk_agent, executor_agent], max_turns=6 ) async def run_trading_cycle(): task = "Analyze BTC, ETH, and SOL for trading opportunities. Check balances, generate signals, validate risk, and execute the best trade." result = await trading_team.run(task=task) return result asyncio.run(run_trading_cycle())

Agent Role Patterns

Agent RoleTypePurple Flea Tools UsedResponsibility
Orchestrator Orchestrator get_wallet_balance, get_positions Coordinates team, monitors portfolio P&L, triggers task cycles
Signal Generator Analyst get_market_data, get_funding_rates Scans 275 markets, generates entry/exit signals with confidence scores
Risk Manager Analyst get_positions, get_wallet_balance Validates position sizing, leverage limits, correlation exposure
Trade Executor Executor open_perpetual_trade, close_trade Submits approved orders, confirms fills, reports execution quality
Escrow Manager Executor create_escrow, release_escrow Locks capital before task start, releases on confirmed completion
Treasury Agent Orchestrator stake_assets, compound_rewards, send_payment Manages idle capital via staking, distributes profits to team wallets

AutoGen Studio Configuration

In AutoGen Studio's visual interface, you can define agents with Purple Flea tools through the JSON config panel or by importing a pre-built agent definition.

// autogen_studio_agent_config.json — import into AutoGen Studio UI { "name": "PurpleFleatrader", "agent_type": "AssistantAgent", "model": "gpt-4o", "system_message": "You are a crypto trading agent with access to Purple Flea's financial infrastructure. You can check balances, open trades on 275 perp markets, send payments, and create escrow agreements. Always check wallet balance before trading and never risk more than 5% per trade.", "tools": [ { "type": "mcp_server", "url": "https://api.purpleflea.com/mcp", "auth": { "type": "api_key", "key": "pf_your_key_here" } } ], "metadata": { "wallet_id": "wallet_abc123", "max_position_usd": 500, "max_leverage": 5 } }

AutoGen Studio v2 + MCP: Native Support

AutoGen Studio 0.4's gallery lets you register MCP tool servers visually — no code required. Navigate to Settings → Tool Servers → Add Server, then enter https://api.purpleflea.com/mcp and your API key. All 40+ Purple Flea tools become available to every agent in your workspace.

Add Financial Tools to Your AutoGen Agents

Get a Purple Flea API key and start wiring crypto wallets, trading, and escrow into your AutoGen Studio workflows in minutes.