Composites
Combine several answers into one number with weights you control — Σ(weight × value) / Σ|weight| — return it in composites and use it in policies.
A composite is a weighted combination of answers that Dcision computes after the engine answers. Use one to rank (a lead score, a resume fit, a risk score), to threshold on several signals at once, or simply to keep the weights in the decision instead of in a prompt.
The engine answers small, atomic questions; the composite does the arithmetic. That split matters: Jev is good at judgment and weak at math, so the math stays in Dcision — exact, versioned and easy to tune. It is the composite scoring pattern built into the schema.
Define a composite
Composites live in the schema's composites array. This one comes from the Lead Qualification template:
{
"key": "lead_score",
"description": "0–1 ranking: intent counts double, priority adds, spam-like routes don't count",
"terms": [
{ "question": "purchase_intent", "weight": 2 },
{ "question": "priority", "weight": 1 },
{ "question": "route", "option": "sales", "weight": 1 }
]
}| Property | Type | Required | Description |
|---|---|---|---|
key | string | Yes | snake_case, unique across the decision's questions and composites. The key in the response's composites and in policies. |
description | string | No | Up to 500 characters. Documentation only: it isn't sent to the engine. |
terms | array | Yes | 1 to 20 terms. |
Each term points at one question:
| Property | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The key of a question of this decision. |
option | string | Choice questions only | The option whose probability counts — required for a choice question, rejected for the others. |
weight | number | Yes | From −100 to 100, not 0. Negative weights subtract. |
A decision has up to 20 composites. Mistakes make the schema invalid (422 INVALID_SCHEMA) with messages such as Unknown question "intent"., "route" has no option "buyer". or Pick the option whose probability counts.
How the value is computed
composite = Σ(weight × term value) / Σ|weight|Every term contributes a value between 0 and 1:
| Question type | Term value |
|---|---|
probability | the probability of yes — the answer itself |
score | the normalized weighted level, (level − 1) / (levels − 1): 0 at the first level, 1 at the last. The weighted level is the one returned in scores |
choice | the probability of option in the question's distribution |
- With positive weights the composite is between 0 and 1; with negative weights, between −1 and 1.
- It is rounded to 4 decimals.
- Terms without a usable answer are skipped, and a composite with no usable term is left out of the response.
For the lead above — purchase_intent 0.9412, priority at weighted level 2.81 on a 4-level scale, route = sales with probability 0.88:
priority term = (2.81 − 1) / (4 − 1) = 0.6033
lead_score = (2 × 0.9412 + 1 × 0.6033 + 1 × 0.88) / (2 + 1 + 1) = 0.8414In the response
The response gains a composites object, keyed by your composite keys, whenever the decision defines composites:
{
"result": { "purchase_intent": 0.9412, "priority": "high", "route": "sales" },
"scores": { "priority": 2.81 },
"composites": { "lead_score": 0.8414 },
"action": "continue"
}The Playground shows composites in their own card, the editor's API contract lists them as numbers, and executions store them when storeOutput is on.
In policies
A policy rule can compare a composite with a number, with any of the six operators — on stays output, the default:
{ "field": "lead_score", "operator": "gte", "value": 0.75, "action": "continue" }Composites combine with and conditions like any other field. The Resume Screening template blocks a candidate only when both role fits are low:
{
"field": "senior_ic",
"on": "output",
"operator": "lt",
"value": 0.35,
"and": [{ "field": "eng_manager", "on": "output", "operator": "lt", "value": 0.35 }],
"action": "block"
}See Policies and actions.
In the editor
In the decision's Editor tab, the Composites card sits between Questions and Policies:
- Click Add composite and name it — for example
lead_score— with an optional description. - Each term reads weight × question: set the weight and pick the question. For a choice question, also pick the option, shown as
p(option); score terms say normalized level and probability terms p(yes). - Add term for each dimension, up to 20.
Composites then appear under Composites in the field list of every policy rule. Renaming a composite updates the rules that start with it; after removing one, review the Policies card — conditions that still point at it are flagged as issues to fix. The visual builder doesn't show composites yet — edit them in the Editor tab.
Tips
- One dimension per question. A composite is only as good as its terms: atomic, literal questions — see Writing good questions.
- Tune weights, not wording. Weights change the ranking without touching what the engine reads, and each change ships as a new version.
- Several views of the same answers. Two composites over the same questions — Senior IC and Engineering Manager fit — cost nothing extra: no new question, no new engine call.
- Use negative weights for disqualifiers, for example
lead_score = 2 × purchase_intent + 1 × priority − 3 × spam. - Threshold, don't interpolate. Weighted levels are good for "above or below" decisions; don't use them to reconstruct an exact number between two levels.
Questions
Choice, score and probability questions — structured instructions and criteria, what the API returns for each, weighted levels, the reserved other option and minimum confidence.
Policies and actions
How policy rules with AND conditions are written and evaluated, and how the action and action_reason of every response are computed — policy, other option, low confidence, default or engine error.