Documentation Index
Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Computed values let you define formulas on offer categories that are evaluated dynamically for each customer during a Decision Flow. This enables personalization like custom pricing, dynamic discounts, and tailored messaging.How It Works
- Define computed fields on a category with a formula and output type
- Configure enrichment in a Decision Flow to load customer data from schema tables
- Add a compute stage to evaluate formulas per candidate offer
- Access results in the Recommend API response under the
personalizationfield - Verify in the studio — the Recommendation Preview on the decision-flow detail view now renders the computed
personalizationvalues inline under each offer card, so authors can confirm a formula produces the expected value before any API client is wired up
Formula Syntax
The formula engine supports the following features. Each example is shown in a code block so it copies cleanly into the editor. ArithmeticVariable Namespaces
| Prefix | Source | Example |
|---|---|---|
| (none) | Other custom fields on the offer | base_rate |
customer.* | Enriched data from schema tables | customer.loan_amount |
attributes.* | Request-time attributes from Recommend API | attributes.tier |
Example
A “Personal Loan” category with a computed field:personalized_rate using the customer’s enriched loyalty_score and the offer’s base_rate.
Personalization patterns
The compute node covers a broad set of personalization use cases. Each pattern below is a copy-pasteable formula plus the inputs it expects and the output it produces. All formulas in this section have been verified against the live formula engine — seeplatform/scripts/test-compute-personalization.mts for the executable proof.
Greetings and templated copy
attributes.first_name (optional). Output (string): "Hi Anuraag, welcome back!" — falls back to "Hi there, welcome back!" when the attribute is missing. coalesce chains as many fallbacks as you need.
Tier-based numeric output (credit limit, discount)
customer.tier, base_rate (custom field on the offer). For a Platinum customer with base_rate = 5000, returns 25000. For a Gold customer with the same base_rate, returns 10000.
Multi-band ladder (credit score → limit)
50000; at 620 the safe-default 5000.
Risk-adjusted APR
base_apr = 5.5 and a score of 820, the personalized APR is 6.10. At 650 it becomes 9.50. round(x, n) is the safe way to format money values — never returns more than n decimal places.
Ceiling clamp (program-cap underwriting)
75000.
Conditional CTA / region-specific disclosure
disclosure_text alongside the numeric output.
Cross-field arithmetic on the offer
customer.balance = 8500, current_rate = 24.99, new_rate = 12.99, returns 1020 — the estimated annual interest savings the response can show under each card offer.
Loyalty waiver
"WAIVED"; newer customers see the raw annual_fee value. The output type can be text even though the else-branch returns a number — the Recommend response carries the value through unchanged.
Null and error handling
The engine is null-safe and crash-free:- Missing variable → result is
null.customer.balance * 0.05with nocustomer.balancereturnsnull, notNaN. - Divide by zero → result is
null.100 / 0returnsnull, notInfinity. - Invalid formula at write time → the
/api/v1/categoriesendpoint runsvalidateFormulavia Zod refinement and rejects with a 422 before persisting.
Function(...), eval(...), and process.env are not recognized identifiers, so any such expression evaluates to null and is logged as a parse error.
Next Steps
Formula Reference
Complete list of operators, functions, and variable namespaces.
Decision Flows
See how computed values are evaluated in the Compute stage.
Scoring Strategies
How the same candidates produce different rankings under each scoring method.