Revenue Estimator
A participants slider, price-per-person options and the resulting total, updating live.
≈ 945 tokens per use (tool 590 · guidance 228 · typical payload 127)How token costs are estimated
Example: Revenue Estimator
How much can I make from a cohort of my course?
How much can I make from a cohort?
Cohort revenue calculator
Participants
Price per participant
Revenue including ticket sales₪9,800
Before VAT, payment fees, commissions, marketing and expenses.
When to use
- The user asks how much they could earn from a number of paying people: a course cohort, workshop, event or tour.
- There are a few price options to compare and the headcount is uncertain.
When not to use
- Income depends on more than a count and a price (costs, discounts, growth over time). Use a Simulation or Calculator.
- There is a single price and a fixed count. State the number in text.
- You don't know the prices. Ask first; the prices are data, not guesses.
How the agent should use it
- Set
valueto the headcount the user mentioned; otherwise it starts at the midpoint ofminandmax. - Give two to five
tiers, cheapest first, each with a short label and a per-personprice.tierIdpicks the one selected at the start (default the first). - Label everything the user reads:
countLabelover the slider,priceLabelover the options,totalLabelover the figure. - Use
notefor what the total leaves out (VAT, fees, costs), in one line. - Present the total as an estimate from the stated prices, not advice.
Interaction
- The slider moves in
stepincrements betweenminandmax; the price options are a radio group (arrow keys move between them). - Total is
count × price, shown in large type and announced to screen readers on every change. - About 0.7 seconds after the user settles,
onResultfires with the choice. While streaming, controls are disabled and tiers appear one by one.
Installation
npx shadcn@latest add https://your-site.com/r/revenue-estimator.json
Usage
import { tool } from "ai"
import { revenueEstimatorTool } from "@/components/genui/revenue-estimator.schema"
const tools = {
[revenueEstimatorTool.name]: tool({
description: revenueEstimatorTool.description,
inputSchema: revenueEstimatorTool.inputSchema,
}),
}import { RevenueEstimator } from "@/components/genui/revenue-estimator"
function ToolPart({ part, addToolResult }) {
if (part.type !== "tool-estimate_revenue") return null
return (
<RevenueEstimator
{...part.input}
status={part.state === "input-streaming" ? "streaming" : undefined}
result={part.state === "output-available" ? part.output : undefined}
onResult={(result) =>
addToolResult({
tool: "estimate_revenue",
toolCallId: part.toolCallId,
output: result,
})
}
/>
)
}The result tells the agent what the user settled on:
{ action: "set", count: 20, tierId: "early", price: 490, total: 9800 }Schema
| Prop | Type | Notes |
|---|---|---|
question | string? | Shown above the card |
title | string | Card heading |
countLabel, priceLabel, totalLabel | string | Labels for the slider, the options and the total |
currency | string | ISO 4217 code. Default USD |
min, max, step | number | Default 1, 50 and 1 |
value | number? | Starting count |
tiers | { id, label, price }[] | 2–5. Price is data-bound |
tierId | string? | Starting tier |
note | string? | One line under the total, up to 120 characters |
Host props: status (streaming, ready), onResult, result and className.