Skip to content
Tradebird Docs
Build a sales agentBuilding blocks

Calculate quantities and price estimates

When a buyer asks how many boxes to order, let the agent gather the quantity and let a function do the arithmetic. Say what one box holds, which units the buyer orders in, and how you round a partly filled box.

What happens at the edge of a box?

Units orderedUnits per boxBoxes needed
24241
25242
49243

A buyer ordering 25 units needs to hear why there are two boxes. Have the tool return the inputs along with the result. Decide what zero means for your business and ask for a quantity if it’s missing. For a price estimate, also return the currency, rounding rules, and what the estimate covers.

Use a read-only operation for a calculation. A buyer who asks to reserve the boxes is asking for a new action with its own permission. Build an estimate step by step.

Check the unit before you round

A buyer writes “25” after discussing both boxes and individual units. With 24 units per box, 25 units calls for two boxes. 25 boxes is 600 units. Have the agent carry the unit into the calculation and show it in the reply. If the message leaves it unclear, a short “Do you mean 25 boxes or 25 individual units?” is worth asking.

One more detail changes the buyer’s decision: if you sell only full boxes, two boxes contain 48 units. Tell the buyer what will actually arrive before they ask for a price. If your company also sells loose units, teach that option and its price separately.