Skip to content
Platform / Functions

Write business logic your whole product can use.

Define typed queries and computations over your business data. Reuse their results in applications, workflows, and agents.

Explore FunctionsInspect source

How do you calculate and evaluate?

Inputs
Named, typed parameters
Output
Declared schema and cardinality
Dependencies
Queries, computation, models, external reads
Execution
Declared limits and determinism

One calculation. A result you can inspect.

Adjust the terms of a quote and follow the calculation from inputs to its typed result.

bookingQuote / Q-2081Local calculation · sample terms

Define the terms.

20% sample tax. Amounts are calculated in integer cents; discount and tax round to the nearest cent.

unit_price_minor: integerunits: integerdiscount_bps: integer
$2,700.00

Calculated total, including tax.

Subtotal
$2,500.00
Discount
−$250.00
Tax
$450.00
Result type
total_minor: integer

Changing the inputs clears the previous verification and plan.

This local demo does not call an authoritative backend.Inspect the real client code

How Functions work.

Explore quote and acceptance

Calculate what matters.

Express pricing, discounts, tax, and operational metrics as named Functions. Declare their inputs and result types so consumers know exactly what they receive.

Evaluate business conditions.

Check whether evidence is complete or a request has reached a terminal state. Reuse the result in an application, a Workflow, or declared Action preparation.

Compose reads and computation.

Combine governed queries, bounded product code, model calls, and admitted external reads. The Function contract describes its dependencies and execution limits.

Keep results separate from changes.

A calculated quote or extracted document is a result. Accepting it is a separate Action, where current business conditions and proposed effects are checked.

Follow it into the source.

An exact excerpt from the repository, with the complete source file available to inspect and download.

Verify and accept a quote tsx
  async function acceptCurrentQuote() {    if (local === null || isAcceptanceInFlight.current) return;    isAcceptanceInFlight.current = true;    setIsAccepting(true);    const revision = inputRevision.current;    const input = {      request_id: requestId, unit_price_minor: BigInt(unitPrice), units: BigInt(units),      discount_bps: BigInt(discount), tax_bps: BigInt(tax),    };    try {      setOperationError(null);      const plan = await acceptBookingQuote.plan(client, input, { targetKey: requestId });      if (inputRevision.current !== revision) return;      await acceptBookingQuote.execute(client, plan, { planHash: plan.hash });      if (inputRevision.current !== revision) return;      setAccepted(true);    } catch (cause) {      if (inputRevision.current !== revision) return;

Model-backed Functions may be nondeterministic. A browser calculation is useful for feedback; it does not authorize a change. Acceptance still uses the authoritative Action path.

Read the capability reference

Connect the next part of the process.

Bring us a process.
We'll build it with you.

A business process, the systems it touches, and the rules it needs to follow.