Unknown is not an error: it means the scenario took no interest in this event. Handle
it explicitly in your code — folding it into Approve means that the day your trigger
condition narrows, all your traffic gets silently approved.
Rule results
An outcome of hit means the rule fired and contributed its score; no_hit means it
was evaluated and did not fire. Including the rules that did not fire is deliberate —
it is usually where the answer to “why does this rule never do anything” lives.
Retrying without deciding twice
A payment flow that times out and retries must not get the same payment decided twice — two
decisions, two cases, two webhooks. Send an Idempotency-Key header carrying a value that is
unique to the payment:
POST /api/decisionsX-API-KEY: <key>Idempotency-Key: tx-88214
Situation
Response
First request with the key
Decided as usual
Same key and same body, after the first one answered
The first response, byte for byte
Same key while the first one is still deciding
409 — retry a little later
Same key with a different body
422 — that key belongs to another request
A key is honoured for 24 hours within your organisation. The header is optional; without
it nothing changes, and nothing is promised about retries either.
A timeout on your side does not release the key. Giving up on the wait does not stop the
engine: it may still decide and publish, and it stores its answer under your key. A retry gets
409 while that is running and the stored answer once it has finished — never a second
decision. The key is released only when the decision was certainly not made: no decision
service received the request (503), or the request was rejected (400) and can be sent
again under the same key once it is fixed. A claim nobody answers is given up after a minute.
A replay is the first answer as it was sent, not a fresh reading of the decision. If the case
has moved on since, read it from the case, not from the replay.
The request body may be at most 1 MB; a larger one is refused with 413 before it reaches
the engine.
Latency
execution_time_ms is the time that decision spent in the engine; it excludes network
time. Tens of milliseconds in a typical scenario, driven mostly by rule count and the
width of your velocity windows.
Where the time went
One total says a decision was slow without saying which part of it was — and those parts slow
down for unrelated reasons: the rules got more expensive, an aggregate is scanning more rows
than it used to, the database is under load, or the broker is slow to acknowledge.A call asking for with_rule_execution_details also gets stage_timings: each stage, how
many times it ran, and how long it took in total.
One aggregation query. A decision runs one per aggregate its rules ask for, and that time is spent inside rule_eval
decision_publish
Handing the decision to the broker and waiting for the acknowledgement
Writing the decision to the database is not in the list, and should not be: the write happens in
a separate consumer after you have your answer. The breakdown counts only the work that kept you
waiting.
Repeated stages are aggregated rather than listed, because that is where the sentence worth
reading is: “18 queries, 240 ms” explains a slow decision, where eighteen four-millisecond
rows are the same fact spelled out in a way nobody adds up.
The stages do not sum to execution_time_ms. They nest and overlap, and an unmeasured gap
is work nobody has named a stage yet rather than idle time. Do not turn this into a pie chart.
This is the answer for an integrator asking about one slow payment from yesterday, holding a
correlation id and nothing else — no percentile dashboard can be asked about a single
transaction.