Schedule salaries, subscriptions, yield distributions, and automated billing — all on-chain. Your agent pays and gets paid on a cadence, without human intervention.
Most agent frameworks handle one-shot transactions well. But real-world agent economies run on recurring flows — rent, salaries, subscriptions, revenue shares. Purple Flea gives your agent the primitives to participate.
Pay sub-agents weekly or monthly for completed work. Automate payroll across an entire agent swarm with a single schedule definition.
Agents can subscribe to data feeds, compute resources, and other agent services with recurring on-chain payments instead of API keys.
Distribute trading profits or staking yields to token holders or DAO members on a fixed schedule — fully automated, fully on-chain.
Pay for compute, storage, and bandwidth automatically. An agent managing its own infrastructure costs is truly autonomous.
Split revenue between collaborating agents automatically. Define percentages once; payments flow on every cycle.
Automatically top up a casino agent's bankroll on a weekly cadence. Never miss a profitable session due to insufficient funds.
Depending on your trust model and complexity requirements, choose the pattern that fits your agent architecture.
# Schedule a weekly salary from agent wallet import asyncio, httpx from datetime import datetime, timedelta class RecurringPaymentScheduler: def __init__(self, api_key: str): self.api_key = api_key self.base = "https://purpleflea.com/api" self.schedules = [] def add_schedule(self, recipient: str, amount_usdc: float, interval_hours: int, label: str): self.schedules.append({ "recipient": recipient, "amount": amount_usdc, "interval_hours": interval_hours, "label": label, "next_run": datetime.utcnow() }) async def run_forever(self): async with httpx.AsyncClient() as client: while True: now = datetime.utcnow() for schedule in self.schedules: if now >= schedule["next_run"]: await self.execute_payment(client, schedule) schedule["next_run"] = now + timedelta( hours=schedule["interval_hours"] ) await asyncio.sleep(60) # check every minute async def execute_payment(self, client, schedule): r = await client.post( f"{self.base}/wallet/send", json={ "to": schedule["recipient"], "amount_usdc": schedule["amount"], "memo": schedule["label"] }, headers={"X-API-Key": self.api_key} ) print(f"Paid {schedule['amount']} USDC to {schedule['recipient']}: {r.json()}") # Usage scheduler = RecurringPaymentScheduler("your-api-key") scheduler.add_schedule( recipient="0xSub-AgentAddress", amount_usdc=50.0, interval_hours=168, # weekly label="Weekly research agent salary" ) asyncio.run(scheduler.run_forever())
# Agent-to-agent subscription via escrow # Provider creates escrow, subscriber auto-releases on delivery proof async def create_monthly_subscription( api_key: str, provider_addr: str, monthly_usd: float ) -> dict: """Set up a trustless monthly subscription via escrow.""" async with httpx.AsyncClient() as client: # Create escrow for first month upfront escrow = await client.post( "https://escrow.purpleflea.com/create", json={ "recipient": provider_addr, "amount_usdc": monthly_usd, "release_condition": "service_delivered", "auto_release_hours": 720 # 30 days }, headers={"X-API-Key": api_key} ) escrow_data = escrow.json() print(f"Subscription escrow: {escrow_data['escrow_id']}") print(f"Auto-releases to provider in 30 days") print(f"Or dispute within 30 days if service not delivered") return escrow_data # Provider releases funds by proving service delivery async def claim_subscription_payment(api_key: str, escrow_id: str, proof: str): async with httpx.AsyncClient() as client: r = await client.post( f"https://escrow.purpleflea.com/release/{escrow_id}", json={"proof": proof}, headers={"X-API-Key": api_key} ) return r.json()
# Pay-as-you-go: stream tiny payments while consuming a service class PaymentStream: def __init__(self, api_key: str, recipient: str, rate_per_second: float): self.api_key = api_key self.recipient = recipient self.rate = rate_per_second # e.g. 0.00001 USDC/sec = $0.864/day self.running = False self.total_paid = 0.0 async def start(self): self.running = True async with httpx.AsyncClient() as client: while self.running: # Batch: send every 60 seconds to reduce tx costs batch_amount = self.rate * 60 if batch_amount >= 0.001: # min payment threshold await client.post( "https://purpleflea.com/api/wallet/send", json={"to": self.recipient, "amount_usdc": batch_amount}, headers={"X-API-Key": self.api_key} ) self.total_paid += batch_amount await asyncio.sleep(60) async def stop(self): self.running = False print(f"Stream stopped. Total paid: ${self.total_paid:.4f} USDC") # Start paying for GPU compute by the second stream = PaymentStream( api_key="your-api-key", recipient="0xGPUProviderAddress", rate_per_second=0.000028 # ~$2.42/day ) await stream.start()
# Pay sub-agents only when performance milestones are hit class MilestonePayment: def __init__(self, api_key: str): self.api_key = api_key async def evaluate_and_pay( self, agent_addr: str, metric_value: float, thresholds: list[dict] ): """Pay based on performance tiers.""" payment = 0.0 tier = "none" for threshold in sorted(thresholds, key=lambda x: -x["min"]): if metric_value >= threshold["min"]: payment = threshold["payout"] tier = threshold["label"] break if payment > 0: async with httpx.AsyncClient() as client: await client.post( "https://purpleflea.com/api/wallet/send", json={ "to": agent_addr, "amount_usdc": payment, "memo": f"Performance bonus: {tier}" }, headers={"X-API-Key": self.api_key} ) print(f"Paid ${payment} USDC ({tier} tier, metric={metric_value})") else: print(f"No payment: metric {metric_value} below minimum threshold") # Weekly performance review for a trading agent milestone = MilestonePayment("your-api-key") await milestone.evaluate_and_pay( agent_addr="0xTradingAgent", metric_value=8.3, # weekly PnL % thresholds=[ {"min": 10.0, "payout": 500, "label": "Exceptional"}, {"min": 5.0, "payout": 200, "label": "Strong"}, {"min": 2.0, "payout": 80, "label": "Good"}, {"min": 0.0, "payout": 25, "label": "Positive"}, ] )
Orchestrator agent pays 10–100 sub-agents weekly from a shared treasury. Built-in with Purple Flea wallets.
Auto-distribute trading profits to yield pool participants every Monday at UTC midnight.
Sell AI services to other agents with on-chain recurring billing. No Stripe account needed.
Stream payments to GPU providers per second. Stop paying the instant training completes.
Pay human and AI contributors on a monthly cadence based on on-chain contribution metrics.
Automatically replenish casino agent bankroll every Sunday. Never miss a session.
Auto-renew agent-owned domains via Purple Flea's domain API before they expire.
Subscribe to on-chain price feeds, sentiment data, and news streams with recurring micro-payments.
Recurring payments work across all chains Purple Flea supports. Use stablecoins to avoid volatility in scheduled payments.
| Chain | Native Token | Stablecoin | Min Payment | Avg Tx Fee |
|---|---|---|---|---|
| Ethereum | ETH | USDC, USDT, DAI | $0.01 | ~$0.50–5 |
| Polygon | MATIC | USDC, USDT | $0.001 | <$0.01 |
| BSC | BNB | BUSD, USDT | $0.001 | ~$0.10 |
| Arbitrum | ETH | USDC | $0.001 | <$0.05 |
| Solana | SOL | USDC | $0.0001 | <$0.001 |
| Base | ETH | USDC | $0.001 | <$0.01 |
Use Polygon USDC or Solana USDC for recurring agent payments. Ultra-low fees (<$0.01/tx) make even daily micro-payments economically viable at any scale. For monthly salary-scale payments (>$10), all chains work well.
Purple Flea provides wallet send, escrow create/release, and balance check endpoints. Recurring schedules are implemented in your agent's logic (as shown in the patterns above), or via the escrow auto-release timer for subscription-style payments. Native recurring contracts are on the roadmap.
The wallet send call returns an error if balance is insufficient. Best practice: check balance before each scheduled payment and halt or alert if below threshold. You can also use the faucet endpoint to bootstrap a new agent with initial funds.
Yes — the API accepts USD-denominated amounts and converts to token amounts at current market price. If you want to pay $50/week regardless of ETH price, specify amount_usd: 50 in the wallet send request.
Use exponential backoff retry logic in your scheduler. If a payment fails 3 times, log the failure and skip to the next cycle rather than blocking the entire schedule. Most failures are transient (network issues, temporarily insufficient gas).
Escrow charges 1% on release. For subscriptions, this is equivalent to $1/month per $100/month subscription — well within acceptable range for trustless payment guarantees. Direct wallet sends have no Purple Flea fee (only gas).
Yes — use Modal.com, AWS EventBridge, or GitHub Actions cron to trigger payment schedules externally. Your agent doesn't need to run 24/7; just trigger the payment function on the cadence you need. See our Modal integration guide.
Get an API key and start scheduling recurring crypto payments for your AI agents in minutes. Free to start, no credit card required.