AGENT WORKFLOW · RUNNABLE EXAMPLE

Verify supplied invoice arithmetic without floating point drift

Line extensions and totals can disagree. Binary floating point also makes a poor representation for exact invoice amounts.

A bounded tool call for your agent

Your agent supplies JSON to invoice_arithmetic and reads a deterministic result. Its operator decides what happens next.

  1. Use signed integer strings for amounts, positive integer quantities and a declared scale. With scale 2, "1999" means 19.99.
  2. Provide the tax, shipping and discount amounts explicitly. Expected total = computed subtotal + tax + shipping − discount.
  3. Inspect valid and issues. A completed mismatch report is a resolved diagnostic, not an approved invoice.

Example input

Synthetic demonstration data, not a customer record.

{
  "currency": "USD",
  "scale": 2,
  "lines": [
    {
      "quantity": 3,
      "unit_minor": "1999",
      "line_minor": "5997"
    },
    {
      "quantity": 2,
      "unit_minor": "500",
      "line_minor": "1000"
    }
  ],
  "subtotal_minor": "6997",
  "tax_minor": "700",
  "shipping_minor": "500",
  "discount_minor": "200",
  "total_minor": "7997"
}

Actual engine output

{
  "service": "invoice_arithmetic",
  "version": "0.5.0",
  "status": "resolved",
  "flags": [],
  "valid": true,
  "summary": "0 arithmetic mismatches across 2 lines",
  "issues": [],
  "currency": "USD",
  "scale": 2,
  "expected": {
    "line_minor": [
      "5997",
      "1000"
    ],
    "subtotal_minor": "6997",
    "total_minor": "7997",
    "total_decimal": "79.97"
  },
  "scope": "Exact arithmetic of supplied amounts. Scale is caller-declared, not inferred from currency. Tax and shipping are taken as supplied; discount is subtracted. No rounding, FX, tax compliance, authenticity or accounting approval."
}

Limits that matter

No OCR, fractional quantities, tax-rate determination, document authenticity, currency conversion or accounting approval. The supplied scale is not validated against currency minor-unit conventions.

One completed diagnostic, even if arithmetic mismatches are found. No tax calculation, accounting approval or document extraction. Hosted price: 0.0050 USDC per completed operation. Local execution is free.

Use this check in your agent

One completed hosted batch costs 0.005 USDC. Start with the unsigned quote, then use your approved authorizer and a 5000-unit maximum if you choose to purchase.

Inspect locally