Skip to content

Building a service

Define the parameters, pricing formula and rules for a repeatable service such as a regrind.

A service is a calculation definition. You describe the parameters an item is measured against, any derived values, the rules that gate the work and the outputs you want, usually a price and a lead time. The same engine runs both manually and through the AEI, so a service priced in chat matches one priced at the bench.

Defining parameters

Open Servicing, then the Services tab. Start from one of the eight templates or from blank. The builder has three columns: metadata on the left, the definition editor in the centre and a shared test bench on the right.

  • Parameters are the inputs you measure, each with a kind: number, dimension, select, boolean or text.
  • Derived values are computed in order and can reference parameters and earlier derived values.
  • Rules run after derived values. A block rule stops the run and returns its message. A warn rule attaches a warning.
  • Outputs are expressions. Price and lead time are the common ones, and you can add your own.

The pricing formula

Outputs are written as expressions over your parameters and derived values. Money is calculated with decimal precision and rounded half-up to minor units only at the final display. The example below is the endmill regrind service: a tiered base price by diameter, a per flute charge, a multiplier for the faces reground and a fixed coating strip fee.

text
base = tiered(diameter_mm, [[0, 8.50], [6, 10.00], [12, 14.00], [20, 22.00]])
price = round((base + flutes * 0.85) * lookup_meta('regrind_faces', 'f') + if(coating_strip, 4.50, 0), 2)
leadtime_days = if(coating_strip, 7, 4)

Worked through: a 10mm four flute endmill, ground on the outside diameter only with no coating strip. The base tier for 10mm is £10.00. Add four flutes at £0.85, giving £13.40. The od_only option carries a multiplier of 1.0, so the price holds at £13.40, with a four day lead time. Choose od_and_face instead and the 1.4 multiplier lifts it to £18.76.

Rules

The regrind service blocks anything too large for the cell with a rule that fires when diameter_mm is over 25, returning the message "Too large for our regrind cell". A blocked run produces no price. In chat the same block surfaces as a rejected row carrying that message.

Saving a service runs its stored test cases. Activation requires a price output and green tests, so a service cannot go live with a formula that fails its own checks.