Revenue Estimator

A participants slider, price-per-person options and the resulting total, updating live.

Pattern

≈ 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 value to the headcount the user mentioned; otherwise it starts at the midpoint of min and max.
  • Give two to five tiers, cheapest first, each with a short label and a per-person price. tierId picks the one selected at the start (default the first).
  • Label everything the user reads: countLabel over the slider, priceLabel over the options, totalLabel over the figure.
  • Use note for 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 step increments between min and max; 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, onResult fires 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

app/api/chat/route.ts
import { tool } from "ai"
import { revenueEstimatorTool } from "@/components/genui/revenue-estimator.schema"

const tools = {
  [revenueEstimatorTool.name]: tool({
    description: revenueEstimatorTool.description,
    inputSchema: revenueEstimatorTool.inputSchema,
  }),
}
components/message.tsx
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

PropTypeNotes
questionstring?Shown above the card
titlestringCard heading
countLabel, priceLabel, totalLabelstringLabels for the slider, the options and the total
currencystringISO 4217 code. Default USD
min, max, stepnumberDefault 1, 50 and 1
valuenumber?Starting count
tiers{ id, label, price }[]2–5. Price is data-bound
tierIdstring?Starting tier
notestring?One line under the total, up to 120 characters

Host props: status (streaming, ready), onResult, result and className.

Source

On this page