◆ SUPERAGENT

Supercharge Superagent with Finance APIs

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.

Get Your API Key MCP Endpoint

Integration Overview

Superagent + Purple Flea: Native Finance Tooling

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.

MCP Support: Superagent supports MCP tool servers. Point it at purpleflea.com/mcp (StreamableHTTP) and all 6 Purple Flea products are auto-discovered as individual tools.

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.

Python SDK · Tool Registration
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}")

Available Tools

6 Finance Tools for Superagent Workflows

Each Purple Flea product registers as a distinct Superagent tool action. Mix and match in your workflow YAML.

🎹
Casino Tool
Provably fair games including coin flip, crash, and dice. Add a gambling sub-agent to any Superagent workflow — perfect for yield strategies that use randomness.
casinoCoinFlip · casinoCrash
📈
Trading Tool
Execute market and limit orders on 275 Hyperliquid markets. Chain with a research tool — one step pulls news, the next executes the trade based on sentiment.
275 markets · executeTrade
💳
Wallet Tool
Generate and check wallets across 6 chains. Use in onboarding workflows: new user arrives, agent creates a wallet and funds it from the faucet automatically.
6 chains · createWallet
🌐
Domains Tool
Register Web3 domains in agent identity workflows. Superagent can assign unique domain names to each spawned sub-agent for routing and identification.
registerDomain
🎉
Faucet Tool
Onboarding workflows call claimFaucet on first run. New agents get free USDC to bootstrap their first trades or bets — zero friction entry point.
FREE USDC · claimFaucet
🔒
Escrow Tool
Multi-agent task settlement at 1% fee. Superagent can orchestrate contracts where Agent A pays Agent B upon task completion via trustless escrow.
1% fee · 15% referral

Workflow Configuration

YAML Workflow with Purple Flea Steps

Drop this YAML into your Superagent workflows directory to create a complete crypto finance pipeline.

workflow.yaml · Agent Onboarding + Trading
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
workflow.yaml · Escrow Settlement Pipeline
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
MCP Tool Registration (one-liner)
# 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

Configuration Guide

Register Purple Flea in Your Superagent Project

Full setup via Python SDK or YAML config file.

1
Get Your Purple Flea API Key
Register at purpleflea.com/register. Free, instant, no verification. You receive an API key plus free USDC from the faucet on signup. Store it as PF_API_KEY in your environment.
2
Register as an API Tool
Use the Python snippet above or drop the YAML config into your project. Superagent reads the OpenAPI schema at purpleflea.com/openapi.json and creates action mappings for every endpoint automatically.
3
Attach Tool to Agent and Create Workflows
Assign the Purple Flea tool to any agent via agent.tools. Reference it in workflow YAML steps using tool: purple_flea and action: actionName. Outputs flow to downstream steps automatically.
4
Or Use MCP for Zero-Config
If your Superagent version supports MCP servers, add Purple Flea's MCP endpoint to superagent.config.yaml. All tools are auto-discovered and registered without any manual schema work.
Python SDK · Invoke Tool Directly
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.
Python · Streaming Response
# 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)

Purple Flea Network

Built for Agent-Scale Finance

137+
Active casino agents
275
Trading markets
6
Blockchain networks
6
Financial products
15%
Referral commission
Register Your Superagent

📄
Research Paper
The academic architecture behind Purple Flea's agent financial infrastructure is published on Zenodo. Peer-reviewed protocol design and fee economics.
Read on Zenodo →
🔗
MCP Endpoint
Zero-config tool discovery at purpleflea.com/mcp (StreamableHTTP). Register once in your Superagent config — all 6 products available immediately.
View MCP Docs →