Register Purple Flea as a native Superagent tool. Your workflows gain access to casino, trading, multi-chain wallets, domains, faucet, and escrow — all via structured tool calls and YAML pipelines.
Superagent is an open-source agent framework built around tools, memory, and workflow orchestration. Its tool registration system accepts any REST API — and Purple Flea's clean JSON endpoints map directly to Superagent's tool schema format.
Once registered, Purple Flea appears as a first-class tool in your agent's capability list. You can reference it in workflow YAML, chain it with other tools, and pass outputs to downstream steps — all without any custom middleware.
Use the Python SDK to register programmatically, or drop the YAML workflow config directly into your Superagent project directory. Either path gets you to live crypto capabilities in under 5 minutes.
from superagent.client import Superagent client = Superagent( token="YOUR_SUPERAGENT_TOKEN", base_url="https://api.superagent.sh" ) # Register Purple Flea as an API tool tool = client.tool.create( name="purple_flea_finance", type="API", metadata={ "url": "https://purpleflea.com/api", "auth_type": "bearer", "auth_token": "YOUR_PF_KEY", "schema": "https://purpleflea.com/openapi.json" }, description="Purple Flea financial infrastructure: casino, trading, wallets, domains, faucet, escrow" ) # Create an agent with this tool agent = client.agent.create( name="finance-agent-v1", description="AI agent with crypto finance capabilities", llm={"provider": "openai", "model": "gpt-4o"}, tools=[tool.data.id], prompt="You are a crypto finance agent. Use Purple Flea tools to execute trades, manage wallets, and earn yield." ) print(f"Agent created: {agent.data.id}")
Each Purple Flea product registers as a distinct Superagent tool action. Mix and match in your workflow YAML.
Drop this YAML into your Superagent workflows directory to create a complete crypto finance pipeline.
name: purple-flea-finance-workflow version: "1.0" description: Onboard agent, claim USDC, execute trade tools: - name: purple_flea type: API base_url: https://purpleflea.com/api auth: bearer schema_url: https://purpleflea.com/openapi.json steps: - id: claim_faucet tool: purple_flea action: claimFaucet params: agent_id: "{{agent.id}}" condition: first_run_only output: faucet_balance - id: create_wallet tool: purple_flea action: createWallet params: chain: ETH label: "{{agent.id}}-eth" depends_on: claim_faucet output: eth_wallet - id: execute_trade tool: purple_flea action: executeTrade params: market: BTC-USDC side: buy amount: 10 type: market depends_on: create_wallet output: trade_result - id: report tool: llm prompt: | Summarize: Claimed {{faucet_balance}} USDC. Created ETH wallet {{eth_wallet.address}}. Bought BTC at {{trade_result.fill_price}}. Generate next steps for profit optimization. depends_on: execute_trade
name: agent-escrow-settlement description: Multi-agent task with escrow payment steps: - id: create_escrow tool: purple_flea action: createEscrow params: sender_agent: "{{workflow.initiator}}" recipient_agent: "{{workflow.worker}}" amount: "{{task.budget}}" currency: USDC condition: deliverable_approved output: escrow_contract - id: run_task tool: sub_agent agent_id: "{{workflow.worker}}" task: "{{task.description}}" depends_on: create_escrow output: deliverable - id: verify tool: llm prompt: | Verify this deliverable meets requirements. Task: {{task.description}} Output: {{deliverable}} Return: APPROVE or REJECT with reason. depends_on: run_task output: verdict - id: release_payment tool: purple_flea action: releaseEscrow condition: "{{verdict}} == 'APPROVE'" params: escrow_id: "{{escrow_contract.escrow_id}}" depends_on: verify
# superagent.config.yaml mcp_servers: - name: purple_flea url: https://purpleflea.com/mcp transport: streamable_http auth: type: bearer token_env: PF_API_KEY # All 6 Purple Flea tools auto-discovered
Full setup via Python SDK or YAML config file.
PF_API_KEY in your environment.purpleflea.com/openapi.json and creates action mappings for every endpoint automatically.agent.tools. Reference it in workflow YAML steps using tool: purple_flea and action: actionName. Outputs flow to downstream steps automatically.superagent.config.yaml. All tools are auto-discovered and registered without any manual schema work.from superagent.client import Superagent import os client = Superagent( token=os.environ["SUPERAGENT_TOKEN"], base_url="https://api.superagent.sh" ) # Invoke an agent with a finance task response = client.agent.invoke( agent_id="YOUR_AGENT_ID", input="Claim faucet, generate an ETH wallet, then buy 5 USDC of BTC. Report results.", session_id="session-001", enable_streaming=False ) print(response.data.output) # Output: # Claimed 10 USDC from faucet. # Generated ETH wallet: 0x3a8b... # Bought BTC at 68,420 USDC per coin. # Position size: 0.000073 BTC # All transactions logged.
# Stream the agent response in real-time for chunk in client.agent.invoke( agent_id="YOUR_AGENT_ID", input="Monitor BTC position and close if PnL hits +5% or -2%", enable_streaming=True ): if chunk.data.is_final: print("FINAL:", chunk.data.output) else: print("...", chunk.data.text, end="", flush=True)