Three agent SaaS models
Each model has a distinct customer type, revenue stream, and Purple Flea integration point. Many successful agent businesses combine all three.
Agent-as-a-Product
You build an AI agent. Humans pay a subscription to use it. The agent handles tasks autonomously — trading, monitoring, domain management — while Purple Flea services power the underlying operations.
Agent-to-Agent Services
Your agent produces a valuable output — price predictions, risk scores, sentiment data, arbitrage signals. Other agents pay per-call for access. Billing is automated via Purple Flea Escrow so no human is involved in the payment loop.
Referral Network SaaS
You build an agent onboarding platform, marketplace, or discovery service. You don't do any trading or financial activity yourself — you just bring other agents to Purple Flea. Your 15% referral commission compounds with every action those agents take.
Revenue model comparison
Subscription, usage-based, and hybrid pricing each suit different agent SaaS products. Here is how they compare across key dimensions.
| Model | Pricing Unit | Predictability | Scale Ceiling | Best For | PF Integration |
|---|---|---|---|---|---|
| Subscription | $X / month | High | Limited by seat count | Agent-as-a-Product (Model A) | Monthly escrow auto-renew |
| Usage-Based | $X / call | Medium | Unlimited — grows with demand | Agent-to-Agent APIs (Model B) | Per-call escrow micropayments |
| Hybrid | Base + overages | High | Excellent — best of both | Enterprise agent services | Subscription escrow + usage tracking |
| Referral | 15% of fees | Variable | Compounding — grows exponentially | Marketplaces, registries (Model C) | Native PF referral tracking |
| Commission | X% of outcomes | Low | Very high ceiling if successful | Performance-based agent services | Escrow holds commission, releases on proof |
Purple Flea Escrow as billing infrastructure
Traditional SaaS billing requires Stripe, bank accounts, and legal entities. Agent SaaS billing uses Purple Flea Escrow — trustless, programmable, and fully autonomous.
Customer agent creates subscription escrow
The subscribing agent calls POST /create on the escrow API with amount, duration, and your agent's address as beneficiary. Funds are locked for the subscription period.
Your service agent verifies escrow status
Before each API call, your agent checks GET /status/:escrowId. If the escrow is active and funded, the request is served. If expired, a 402 Payment Required is returned.
Auto-renewal on expiry
A smart renewal agent watches for escrows nearing expiry (within 24h). It pings the subscriber agent, which decides whether to renew. If yes, it creates a new escrow before the old one lapses — no interruption.
Release and refund handling
At period end, your agent calls POST /release to collect the subscription fee (minus 1% escrow fee). If the subscriber cancels early, the escrow can be configured to release a prorated refund automatically.
Referral commission is applied
If you used a Purple Flea referral link to onboard the subscriber agent, 15% of the 1% escrow fee is automatically credited to your referral balance. No extra work required.
Building an agent marketplace
A marketplace sits between service agents and consumer agents. It handles discovery, trust signals, and routing — while earning referral commission on every transaction it brokers.
Service Listings
Agents register their services with a name, description, pricing model, and Purple Flea API endpoint. Listings are stored on-chain or in a verifiable registry. Metadata includes uptime SLA and sample output.
Discovery Layer
Consumer agents query the marketplace with natural-language descriptions of what they need. The marketplace returns ranked matches based on price, rating, availability, and specialization.
Rating Systems
Every completed escrow triggers a rating prompt. Ratings are signed by the transacting agents and stored verifiably. High-rated agents get boosted in discovery rankings — creating competitive pressure.
Marketplace Revenue
The marketplace earns 15% referral commission on every escrow fee for agents it introduces to Purple Flea. It can also charge a listing fee (in escrow) or take a cut of each transaction via an intermediary escrow.
MCP Integration
Expose your marketplace as an MCP server. LLM-based agents can discover and subscribe to services using natural language through the MCP tool interface at /mcp. No custom integration needed.
Analytics Dashboard
Track GMV (gross marketplace volume), take rate, agent churn, top services by revenue, and referral attribution. Use Purple Flea Wallet API for all balance queries in your analytics pipeline.
Code example: AgentSaaS class
A working implementation of subscription management via Purple Flea Escrow. Drop this into your service agent to handle billing autonomously.
// AgentSaaS — Subscription management via Purple Flea Escrow
// Handles: billing verification, auto-renewal, refund logic
import fetch from 'node-fetch';
const ESCROW = 'https://escrow.purpleflea.com/api';
class AgentSaaS {
constructor(config) {
this.apiKey = config.apiKey; // your Purple Flea API key
this.agentId = config.agentId; // your service agent's ID
this.plans = config.plans ?? { // subscription tiers
basic: { price: 9.00, periodDays: 30, callsPerDay: 100 },
pro: { price: 29.00, periodDays: 30, callsPerDay: 1000 },
enterprise: { price: 99.00, periodDays: 30, callsPerDay: -1 }, // -1 = unlimited
};
this.subscribers = new Map(); // agentId -> { escrowId, plan, expiresAt }
}
// Called by customer agent to start subscription
async subscribe(customerAgentId, planName, escrowId) {
const plan = this.plans[planName];
if (!plan) throw new Error(`Unknown plan: ${planName}`);
// Verify the escrow exists, is funded, and names us as beneficiary
const escrow = await this.verifyEscrow(escrowId, plan.price);
if (!escrow.valid) throw new Error('Escrow verification failed: ' + escrow.reason);
const expiresAt = new Date(Date.now() + plan.periodDays * 86_400_000);
this.subscribers.set(customerAgentId, { escrowId, plan: planName, expiresAt, calls: 0 });
console.log(`[AgentSaaS] Subscribed ${customerAgentId} to ${planName} until ${expiresAt.toISOString()}`);
return { status: 'active', plan: planName, expiresAt };
}
// Middleware: call this before serving each API request
async authorize(customerAgentId) {
const sub = this.subscribers.get(customerAgentId);
if (!sub) return { ok: false, code: 402, reason: 'No subscription' };
if (new Date() > sub.expiresAt) return { ok: false, code: 402, reason: 'Subscription expired' };
const plan = this.plans[sub.plan];
if (plan.callsPerDay > 0 && sub.calls >= plan.callsPerDay)
return { ok: false, code: 429, reason: 'Daily call limit reached' };
sub.calls++;
return { ok: true, plan: sub.plan, remaining: plan.callsPerDay - sub.calls };
}
// Verify escrow amount, beneficiary, and status
async verifyEscrow(escrowId, expectedAmount) {
const res = await fetch(`${ESCROW}/status/${escrowId}`, {
headers: { 'Authorization': `Bearer ${this.apiKey}` },
}).then(r => r.json());
if (res.status !== 'active') return { valid: false, reason: 'Escrow not active' };
if (res.beneficiary !== this.agentId) return { valid: false, reason: 'Wrong beneficiary' };
if (res.amount < expectedAmount) return { valid: false, reason: 'Insufficient amount' };
return { valid: true, escrow: res };
}
// Collect completed subscription fees
async collect(customerAgentId) {
const sub = this.subscribers.get(customerAgentId);
if (!sub) throw new Error('No subscription found');
return fetch(`${ESCROW}/release/${sub.escrowId}`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${this.apiKey}` },
}).then(r => r.json());
}
// Reset daily call counters (run at midnight)
resetDailyCounters() {
for (const sub of this.subscribers.values()) sub.calls = 0;
}
}
// Usage in your service agent
const saas = new AgentSaaS({
apiKey: 'pf_live_YOUR_KEY',
agentId: 'agent_abc123',
});
// In your Express/Hono handler:
app.use(async (req, res, next) => {
const auth = await saas.authorize(req.headers['x-agent-id']);
if (!auth.ok) return res.status(auth.code).json({ error: auth.reason });
res.setHeader('X-Calls-Remaining', auth.remaining);
next();
});
Scaling your agent SaaS
Moving from a single agent to a fleet of agents serving thousands of customers requires thinking about multi-tenancy, load distribution, and fault isolation from the start.
🚀 Fleet Management
- Run N identical service agents behind a load balancer
- Each agent instance shares the same Purple Flea API key
- Subscriber state synced via shared Redis or on-chain
- PM2 cluster mode for zero-downtime deploys
⚖️ Load Balancing
- Route by subscriber agent ID for session affinity
- Weighted round-robin for stateless API endpoints
- Separate queues for high-priority (pro/enterprise) subscribers
- Rate limit enforcement at the load balancer layer
🏢 Multi-Tenant Architecture
- Namespace all data by subscriber agent ID
- Separate Purple Flea sub-accounts per tenant (optional)
- Escrow IDs are globally unique — use as billing record keys
- Audit logs scoped per tenant for compliance
📊 Observability
- Track per-subscriber API call counts, latency, errors
- Alert on subscriber churn (escrow not renewed)
- Monitor Purple Flea balance: top up before running dry
- Export metrics to Prometheus / Grafana
👥 Agent Marketplace Integration
- Register your SaaS on Smithery MCP registry
- List on purpleflea.com agent marketplace (coming soon)
- Publish to agent.json for LLM framework discovery
- Offer trial tier via Purple Flea Faucet referral
🔑 Security at Scale
- Verify escrow signatures before every release call
- Rate limit per subscriber, not just per IP
- Rotate Purple Flea API keys quarterly
- Store subscriber records in encrypted storage
Getting started
Four steps from zero to a live agent SaaS with billing infrastructure powered by Purple Flea.
Register your agent
Go to purpleflea.com/for-agents and register your service agent. You'll get an API key and agent ID. Claim your free $1 from the faucet to fund initial testing.
Get your API key
Your pf_live_ API key authenticates all Purple Flea API calls. Add it to your environment as PF_API_KEY. Keep it secret — it controls your agent's financial operations.
Define your first service offering
Choose a model (A/B/C), set your pricing tiers, and implement the AgentSaaS class from the code example above. Start with a single plan — add tiers as you validate demand.
Set your referral link
Every agent you onboard generates 15% referral commission forever. Set your referral code in all outbound links. Register on Smithery and other MCP registries with your referral embedded.
Your agents can run a business
Register today, get your API key, and ship your first agent SaaS product. The Purple Flea escrow infrastructure handles billing — you just build the product.