Turning AI Agents into Products — Build Billable Automation Services with Antigravity
Learn how to package Antigravity's multi-agent capabilities into sellable automation services. Covers AgentKit 2.0 orchestration, usage-based billing, and three ready-to-sell agent service blueprints.
Most of us have experienced how AI agents can automate our own work. But packaging that automation as a product you can sell to clients is a different challenge entirely.
When I first started running paid memberships across my own network of sites, what surprised me most was how wide the gap is between "automation for myself" and "automation someone pays for."
As an indie developer running several blogs on an automated publishing pipeline, handing a draft off to an agent is already part of my daily routine. But the moment I tried to turn that same machinery into a service people pay for, the bar for the design jumped a level or two. The meaning of a failure changes completely.
This article walks you through designing and implementing agent services you can actually sell to clients, with working code throughout. From AgentKit 2.0 orchestration to usage-based billing, I'll follow the same path I took in my own operations.
From Personal Automation to Sellable Products
The gap between personal automation and commercialized agent services hinges on three structural requirements.
Personal automation: If your workflow breaks, you fix it yourself. An 80% accuracy rate is fine if you're the only user.
Commercialized product: A client is paying monthly for reliability. A 95% success rate might trigger refund requests. Accuracy becomes non-negotiable.
The three pillars of agent commercialization are:
Reliability — Graceful error handling, retry logic, and fallback responses ensure the service continues functioning even when individual agent calls fail
Measurability — Every execution is logged with token counts, execution time, and outcome, enabling usage-based billing and accurate cost attribution
Transparency — Clients see exactly what they're paying for via a dashboard showing execution history, token consumption, and monthly charges
Without these three pillars, agents remain internal tools. With them, they become SaaS products.
Antigravity's AgentKit 2.0 introduces the Manager Surface pattern, which lets you coordinate multiple specialist agents. This is the architectural foundation for scaling agent services.
How Manager Surface Works
The Manager Agent acts as a coordinator, deciding which specialist agents to invoke, in what order, and how to aggregate results. For client-facing services, this separation of concerns is crucial—clients never call agents directly; they call your API, which routes to the appropriate agent through the manager.
// manager-orchestrator.js// Multi-agent orchestration using Manager Surfaceconst Anthropic = require("@anthropic-ai/sdk");const client = new Anthropic();const managerPrompt = `You are a Manager Agent coordinating multiple specialist agents for client automation.Available Specialists:- ReportGenerator: Creates weekly/monthly business reports from data sources- DataAnalyzer: Extracts insights and segments from datasets- ContentProducer: Generates marketing content at scaleFor each client request:1. Determine required specialists based on request type2. Validate execution capacity (max 10 concurrent operations)3. Delegate to appropriate specialists4. Aggregate results and validate quality5. Return structured response with audit trail`;async function orchestrateRequest(clientId, request, executionLog) { const response = await client.messages.create({ model: "claude-3-5-sonnet-20241022", max_tokens: 2048, system: managerPrompt, messages: [ { role: "user", content: `Client: ${clientId}\nRequest: ${request}\nExecution Context: ${JSON.stringify(executionLog)}`, }, ], }); const usage = response.usage; // Critical: Log token consumption for billing executionLog.push({ timestamp: new Date().toISOString(), agentType: "Manager", inputTokens: usage.input_tokens, outputTokens: usage.output_tokens, totalTokens: usage.input_tokens + usage.output_tokens, clientId: clientId, operation: "orchestration", }); return { decision: response.content[0].text, executionLog: executionLog, usage: usage, };}module.exports = { orchestrateRequest };
Resilience: Retry Logic and Fallbacks
In production, agent calls fail. Network timeouts, API limits, momentary service disruptions—these happen. A commercialized service doesn't crash when one execution fails; it recovers gracefully.
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦The implementation essentials—reliability, measurability, transparency—for lifting personal automation into a paid service
✦Concrete code for AgentKit 2.0 orchestration and usage-based billing (API Gateway + token metering + Stripe)
✦The real judgment calls on failure detection, usage logs, and pricing you only learn by running it
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
Now let's implement three services you can actually sell.
Service 1: Weekly Report Generator
What It Does
A client connects their data sources (Google Analytics, Shopify, or Stripe). Every Friday, an agent automatically fetches the week's data, generates a professionally written report with insights, and delivers it via email and dashboard.
Implementation
// report-generator-agent.jsconst Anthropic = require("@anthropic-ai/sdk");const client = new Anthropic();async function generateWeeklyReport(clientId, dataSource, executionLog) { // Step 1: Fetch this week's data const weekData = await fetchDataSourceMetrics(clientId, dataSource); // Step 2: Generate report using Claude const reportPrompt = `You are a professional business analyst. Write a weekly business report.Data Summary:- Page Views: ${weekData.pageViews}- Conversion Rate: ${weekData.conversionRate}%- Revenue: $${weekData.revenue}- Top Converting Pages: ${weekData.topPages.join(", ")}Format the report with:1. Executive Summary (2 sentences)2. Key Metrics (with week-over-week change)3. Insights (what changed, why it matters)4. Recommendations (3 specific, actionable items)Use Markdown formatting suitable for email.`; const response = await client.messages.create({ model: "claude-3-5-sonnet-20241022", max_tokens: 1024, messages: [ { role: "user", content: reportPrompt, }, ], }); const reportContent = response.content[0].text; const usage = response.usage; // Step 3: Log for billing executionLog.push({ timestamp: new Date().toISOString(), clientId: clientId, service: "WeeklyReportGenerator", inputTokens: usage.input_tokens, outputTokens: usage.output_tokens, totalTokens: usage.input_tokens + usage.output_tokens, dataSource: dataSource, status: "completed", }); // Step 4: Store and deliver await storeReportInDatabase(clientId, reportContent); await sendReportEmail(clientId, reportContent); return { reportId: `rpt_${Date.now()}`, clientId: clientId, generatedAt: new Date().toISOString(), tokenUsage: { input: usage.input_tokens, output: usage.output_tokens, total: usage.input_tokens + usage.output_tokens, }, };}async function fetchDataSourceMetrics(clientId, source) { // Placeholder: In production, use OAuth to fetch real data if (source === "google-analytics") { return { pageViews: 42500, conversionRate: 3.2, revenue: 12750, topPages: ["/", "/pricing", "/docs"], }; } return {};}async function storeReportInDatabase(clientId, content) { // Store in your database}async function sendReportEmail(clientId, content) { // Send via email service}module.exports = { generateWeeklyReport };
Service 2: Data Analysis Agent
What It Does
Clients upload CSV or JSON datasets. The agent analyzes patterns, identifies customer segments, flags anomalies, and highlights growth opportunities. Results are structured and actionable.
Generate multiple pieces of marketing content at scale while maintaining quality. A client requests "10 blog post outlines and 20 social posts about Q2 product updates." The orchestrator spawns multiple agents, generates content, validates quality, and regenerates any pieces that don't meet standards.
Usage-Based Billing: API Gateway and Token Metering
Selling agents requires precise billing. Every token consumed must be logged and attributed to the client who triggered it. Stripe's metering API handles this elegantly.
API Gateway with Token Tracking
// api-gateway.js// Entry point for all client requests; handles auth, execution, and billingconst express = require("express");const app = express();const stripe = new (require("stripe"))(process.env.STRIPE_SECRET_KEY);const executionLogs = {}; // In production: PostgreSQLapp.post("/api/v1/execute", async (req, res) => { const { clientId, service, request } = req.body; // Step 1: Authenticate client const client = await authenticateClient(clientId); if (!client || !client.subscriptionActive) { return res.status(403).json({ error: "Subscription inactive" }); } // Step 2: Initialize execution log const log = []; if (!executionLogs[clientId]) { executionLogs[clientId] = []; } let result; // Step 3: Dispatch to appropriate service try { if (service === "weekly-report") { const { generateWeeklyReport } = require("./report-generator-agent"); result = await generateWeeklyReport(clientId, request.source, log); } else if (service === "data-analysis") { const { analyzeDataset } = require("./data-analyzer-agent"); result = await analyzeDataset(clientId, request.dataUrl, "full", log); } else if (service === "content-pipeline") { const { executePipeline } = require("./content-pipeline-agent"); result = await executePipeline(clientId, request.brief, log); } // Step 4: Calculate usage const totalTokens = log.reduce( (sum, entry) => sum + (entry.totalTokens || 0), 0 ); // Step 5: Report to Stripe for billing await reportUsageToStripe( client.stripeCustomerId, client.subscriptionId, totalTokens ); // Step 6: Persist execution log executionLogs[clientId].push(...log); res.json({ success: true, result: result, usage: { totalTokens: totalTokens, estimatedCost: (totalTokens * 0.00001).toFixed(4), }, }); } catch (error) { res.status(500).json({ error: error.message }); }});async function reportUsageToStripe(customerId, subscriptionId, tokenCount) { // Report token consumption to Stripe // Stripe will bill based on your meter event pricing console.log(`Metering: ${tokenCount} tokens for customer ${customerId}`); // In production, call stripe.billing.meterEvents.create()}async function authenticateClient(clientId) { // Look up client in your database return { subscriptionActive: true, stripeCustomerId: "cus_123" };}module.exports = { app };
Stripe Metering Billing Setup
// stripe-metering-setup.js// Configure usage-based billing in Stripeconst stripe = new (require("stripe"))(process.env.STRIPE_SECRET_KEY);async function createMeteringSubscription(customerId, planName) { // Step 1: Create a metered price const price = await stripe.prices.create({ currency: "usd", product: "prod_antigravity_agents", // Your product ID billing_scheme: "tiered", tiers_mode: "volume", tiers: [ { up_to: 1000000, unit_amount: 10, // $0.0001 per token for first 1M }, { up_to: "inf", unit_amount: 8, // $0.00008 per token above 1M (volume discount) }, ], }); // Step 2: Create subscription with metered billing const subscription = await stripe.subscriptions.create({ customer: customerId, items: [ { price: price.id, }, ], }); return { subscriptionId: subscription.id, priceId: price.id, };}async function recordTokenConsumption(subscriptionId, tokenCount) { // Call Stripe to record usage // (See Stripe metering documentation for exact API) console.log(`Recorded ${tokenCount} tokens consumed`);}module.exports = { createMeteringSubscription, recordTokenConsumption };
Client Dashboard: What to Display
Your clients need to understand what they're being charged for. Build a dashboard showing:
Pricing agent services requires balancing three cost streams: API costs, infrastructure, and profit margin.
I run subscription billing on my own blogs through Stripe — monthly plans and one-time lifetime tiers — and what I have found genuinely hard about pricing is not the number itself but designing an experience people keep paying for. When I moved an automation I had built for my own use as an indie developer toward a paid service, the first wall I hit was the expectation that it simply never stops. For personal use, a day of degraded accuracy is something you can shrug off; for someone paying you, it is not. So I would recommend deciding how you will respond to failures before you finalize a single figure. The numbers in a pricing table only become persuasive once that commitment sits behind them.
Three-Tier Pricing Structure
Service
Setup Fee
Monthly Base
Usage Fee
Target Market
Weekly Report
$500
$299/mo
$0.10/report (after 20 free)
Early-stage startups
Data Analysis
$1,000
$499/mo
$0.05 per 1M tokens
SMB to mid-market
Content Pipeline
$2,000
$999/mo
$0.001/piece unlimited
Enterprise, agencies
The Math Behind Monthly Pricing
For Weekly Report Generator at $299/month:
Anthropic API cost: ~$50/month (assuming 20 reports × $2.50 per report)
Infrastructure & ops: ~$50/month
Support & SLA overhead: ~$50/month
Gross profit: ~$149/month
That's 50% margin on month-to-month costs, which funds product development and customer acquisition.
For usage beyond the free tier ($0.10/report):
Your cost: ~$0.08/report
Your margin: $0.02/report (20%)
This structure makes the base fee worthwhile for customers (20 free reports) while giving them flexibility to scale usage affordably.
Critical Implementation Considerations
1. Define Your SLA
Be specific: "99.5% uptime measured monthly" or "less than 30 minutes MTTR for outages." Don't promise 99.99% if you can't deliver it.
2. Handle Data Privacy
If you're processing client data (customer lists, analytics, financial data), ensure compliance with GDPR, CCPA, SOC 2, or industry-specific regulations.
3. Start Small, Scale Carefully
Launch with a single client or small beta cohort. Verify infrastructure stability and support workflows before offering to dozens of clients.
4. Build Support Runbooks
Document: What do we do if a client's report fails to generate? How quickly do we refund? Who investigates? Create clear escalation paths.
What Running It Actually Taught Me
The three pillars—reliability, measurability, transparency—look tidy on paper. Once real money is involved, each one takes on a different weight. Here is what I learned running my own service, written plainly.
The moment "occasional failure" stops being acceptable
For my own automation, an agent stumbling a few times a month was fine; I'd patch it by hand that day. With a paying client on the other end, a single failure means something entirely different.
One morning my generation pipeline quietly produced an empty body. For personal use, you just notice and discard it. With a recipient downstream, that one article erodes trust directly. That is why, in a commercial design, "how do you detect a failure and absorb it quietly" comes before any new feature.
Metering isn't only for billing
I assumed token logging existed for invoicing. In practice, the logs turned out to be a mirror showing which agent wasn't paying its way.
If one operation spikes in consumption, a design flaw is hiding there. Before the usage data ever reaches Stripe, it became the metric I study most. Placing measurement first as a tool for questioning my own operational health—before billing—proved the more practical order for me.
Transparency is a quiet force against churn
Showing clients exactly what cost what felt uncomfortable at first. Letting people see the breakdown of their charges is a little frightening from this side.
Yet the more I opened up the itemization, the calmer the inquiries became. Letting clients verify numbers they can accept, any time, lowers your explanation cost and builds the ground for a long relationship. Transparency isn't defense—it's an investment in keeping the relationship.
Price from "can I sustain this," not the market
When setting a usage rate, it's tempting to look at competitors first. I chose a different anchor: "can I keep this running at this price without burning out?"
An unsustainable low price shortens a service's life. The longer I work as an indie developer, the more I quietly believe a sustainable price is the most important feature of all.
The Agent Economy Begins Now
The gap between "I automated my workflow" and "I sell automation to others" is the gap between a tool and a business. Filling that gap requires reliability, transparency, and precise billing—three things we've implemented throughout this article.
Antigravity's AgentKit 2.0 gives you the orchestration primitives. Combined with proper error handling, token tracking, and Stripe metering, you have everything you need to launch agent-powered services.
If you're currently spending 20 hours per month on work that agents could handle, you've found your first product. Use the patterns from this article—orchestration, resilience, usage logging, and SaaS billing—to transform that time savings into a revenue stream.
The agent economy is here. Will you sell into it?
I'm still learning how hard it is to offer something as a service. But the very process of getting reliability, measurability, and transparency in place, one at a time, is the work of turning technology into value for someone else. If this helps anyone taking that same first step, nothing would make me happier. Thank you for reading this far.
Share
Thank You for Reading
Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.