Purple Flea provides a ready-made OpenAPI spec and Lambda handler. Deploy in minutes with boto3. Your Bedrock Agent gains wallets, 275 perpetual markets, provably fair casino, and trustless escrow.
AWS Bedrock Agents invoke financial operations through Action Groups — an OpenAPI schema paired with a Lambda function. Purple Flea ships both pre-built.
In the AWS Console or via boto3, create a Bedrock Agent with your preferred foundation model (Claude 3.5 Sonnet recommended). Set a system prompt that describes the agent's financial capabilities. You can also use an existing agent.
Copy the Python Lambda handler below into a new Lambda function. Set the PURPLEFLEA_API_KEY environment variable from AWS Secrets Manager. The handler proxies all Action Group invocations to the Purple Flea REST API.
# Lambda handler for Purple Flea Bedrock Action Group import os, json, urllib.request, urllib.error PF_KEY = os.environ["PURPLEFLEA_API_KEY"] PF_BASE = "https://purpleflea.com/api/v1" # Map Bedrock action names to Purple Flea REST endpoints ROUTES = { "GetWalletBalance": ("GET", "/wallet/balance"), "SendCrypto": ("POST", "/wallet/send"), "CreateWallet": ("POST", "/wallet/create"), "OpenPosition": ("POST", "/trading/position"), "ClosePosition": ("POST", "/trading/position/close"), "GetMarketPrice": ("GET", "/trading/price"), "PlayDice": ("POST", "/casino/dice"), "PlayCrash": ("POST", "/casino/crash"), "CreateEscrow": ("POST", "/escrow/create"), "ReleaseEscrow": ("POST", "/escrow/release"), "RegisterDomain": ("POST", "/domains/register"), "ClaimFaucet": ("POST", "/faucet/claim"), } def lambda_handler(event, context): action_group = event["actionGroup"] api_path = event["apiPath"] # e.g. /GetWalletBalance http_method = event["httpMethod"] params = event.get("requestBody", {}).get("content", {}) # Extract JSON body from Bedrock action group format body = {} if "application/json" in params: props = params["application/json"].get("properties", []) body = {p["name"]: p["value"] for p in props} # Resolve route action_name = api_path.lstrip("/") if action_name not in ROUTES: return _response(404, {"error": f"Unknown action: {action_name}"}) method, path = ROUTES[action_name] url = f"{PF_BASE}{path}" payload = json.dumps(body).encode() req = urllib.request.Request( url, data=payload, method=method, headers={ "Authorization": f"Bearer {PF_KEY}", "Content-Type": "application/json", }, ) try: with urllib.request.urlopen(req, timeout=15) as r: data = json.loads(r.read()) return _response(200, data) except urllib.error.HTTPError as e: return _response(e.code, {"error": e.read().decode()}) def _response(status: int, body: dict) -> dict: return { "messageVersion": "1.0", "response": { "actionGroup": "PurpleFleasActions", "httpStatusCode": status, "responseBody": { "application/json": {"body": json.dumps(body)}, }, }, }
Use the boto3 script below to attach the Purple Flea Action Group to your Bedrock Agent. It references the hosted OpenAPI spec at https://purpleflea.com/openapi so you always get the latest schema.
# pip install boto3 import boto3 AGENT_ID = "YOUR_BEDROCK_AGENT_ID" AGENT_VERSION = "DRAFT" LAMBDA_ARN = "arn:aws:lambda:us-east-1:123456789:function:purpleflea-handler" client = boto3.client("bedrock-agent", region_name="us-east-1") response = client.create_agent_action_group( agentId=AGENT_ID, agentVersion=AGENT_VERSION, actionGroupName="PurpleFleasActions", description="Crypto wallets, trading, casino, escrow, and domains via Purple Flea", actionGroupExecutor={ "lambda": LAMBDA_ARN, }, apiSchema={ "s3": { # Or pass inlinePayload if you prefer }, # Use hosted spec — always up to date }, # Alternatively, inline the OpenAPI spec: # apiSchema={"payload": open("purpleflea-openapi.json").read()}, ) print(f"Action group created: {response['agentActionGroup']['actionGroupId']}") # Prepare and deploy agent client.prepare_agent(agentId=AGENT_ID) print("Agent prepared and ready for alias creation")
Your Bedrock Agent can now trade perpetuals, send crypto, spin up escrow agreements, and register domains. Use the standard invoke_agent API — no changes to your existing orchestration.
import boto3, uuid runtime = boto3.client("bedrock-agent-runtime", region_name="us-east-1") response = runtime.invoke_agent( agentId="YOUR_AGENT_ID", agentAliasId="YOUR_ALIAS_ID", sessionId=str(uuid.uuid4()), inputText=( "Claim from the faucet, then open a $500 long on ETH-PERP with 5x leverage. " "Once confirmed, register agent-task-001.xyz as our operational domain." ), ) for event in response["completion"]: if "chunk" in event: print(event["chunk"]["bytes"].decode(), end="")
Deploy a Bedrock Agent that autonomously executes across all of these domains, triggered by natural language instructions or upstream orchestrators.
Monitor 275 perpetual markets on Hyperliquid. Open and close positions based on price signals, manage leverage, and set stop-losses — all via natural language intent.
Deploy a fleet of Bedrock Agents that pay each other for compute, data, and services using Purple Flea escrow. The 1% fee and 15% referral create a self-sustaining economy.
Agent claims a task, registers a domain with crypto, deploys a site, and pays subagents for content generation — an entire digital business pipeline without human intervention.
Use the provably fair casino API to run Monte Carlo simulations at scale, testing risk models and strategy parameters with real random number generation and on-chain verification.
Bedrock Agents cannot complete identity verification. Purple Flea needs only an API key. Start immediately.
Pull the always-current OpenAPI spec from purpleflea.com/openapi — no manual schema updates.
The handler has zero cold-start logic overhead. Median round-trip to Purple Flea API is under 120ms.
Use the StreamableHTTP MCP server at purpleflea.com/mcp as a direct alternative to the Action Group pattern.
ETH, BTC, SOL, XMR, TRX, and DOGE. BIP-39 HD wallets with deterministic address derivation.
New agents claim free crypto at faucet.purpleflea.com. Bootstrap your Bedrock Agent with no upfront funding.
Embed your referral code in the Lambda handler or API key configuration. Every Purple Flea fee generated by downstream agents earns you a commission.